UBK PKI Middleware Handbook
UBK PKI Middleware Handbook
44801 Bochum
E-Mail: [email protected]
Internet: www.escrypt.com
Middleware Handbook
www.escrypt.com
Version: 1.6
Date: 2014-10-17
Document History
0.2 JPE Added new information about smart card TLS 05-Sep-2013
authentication
0.9.1 MOM Added comment regarding system variables for TLS 12-Sep-2013
communication
1.4 JPE, MOM - Update for latest middleware; removed information 20-May-2014
pertaining to proxy authentication
Contents
ECU Protection PKI ...................................................................................................................................1
Contents.......................................................................................................................................................3
1 Introduction .......................................................................................................................................4
7 Troubleshooting............................................................................................................................ 14
8 Bibliography ................................................................................................................................... 15
1 Introduction
This document describes the process and necessary steps that need to be taken to
install and use the ECU Protection PKI middleware on a Windows 7 32/64-bit
machine. The DLL provided in the release is 32-bit.
Section 2 provides details about the content of the release package. Sections 3 and 4
describe how the middleware is installed. Section 5 contains all information needed
to use the middleware. Section 6 provides information that may be relevant during
development. Finally, Section 7 contains some frequently asked questions that may
help in troubleshooting.
src: contains source code written in C. These files provide an example on how
to use the PKCS #11 functions that the middleware implements.
bin: contains the PKCS#11 middleware library (PKCS11Library.dll).
deploy: contains the modified axis2c libraries, as well as the axis2.xml
configuration file.
gnutls_downloaded: A placeholder for a GnuTLS download. Needs to contain
the GnuTLS libraries used for secure communication with the ECU Protection
PKI server.
dummy: contains credentials that are used to “ping” the ECU Protection PKI
server in the PKCS#11 function C_GetSlotList.
Additionally, the following files related to the execution of the middleware are
included in the base directory:
ftp://ftp.gnutls.org/gcrypt/gnutls/w32/
In order to communicate with the PKCS#11 interface (separate from the interface
used in the middleware), the OpenSC PKCS#11 provider library (opensc-pkcs11.dll)
must be downloaded. The installer for OpenSC can be found at the following web
address:
http://sourceforge.net/projects/opensc/files/OpenSC/opensc-0.13.0/opensc-0.13.0-
win32.msi/download
1. Extract all contents of the release archive into a folder of your choice, keeping
the directory structure of the archive intact.
2. Navigate to the folder of your choice and run the file MiddlewareInstaller.bat
from the command line. (This will define several system variables the
middleware relies on and that were not defined previously. Also, the batch file
calls the installers for the Visual C++ 2008 Redistributable libraries, and Visual
C++ 2012 Redistributable libraries.)
Note: The installer may place the file in system, System32, or SysWOW64.
Upon completion of this step, the bin directory will have the following
contents:
In order to use the server and smart card slots of the middleware, a smart card and a
smart card reader are both necessary.
Note: The officially supported smart card readers are those in the Omnikey CardMan
3x21 series. The middleware requires the official drivers supplied by Omnikey. Other
smart card readers and drivers may work with the middleware, but this is not tested.
The PIN must be entered through the tool integrating the middleware during its call
to the PKCS#11 function C_Login.
Note: This PIN is statically stored in memory and used until any of the PKCS#11
functions C_Finalize, C_Logout, C_CloseSession, or C_CloseAllSessions are called.
The combination of SSPI and NTLM provides a transparent authentication without the
need to authenticate manually for each connection.
The correct setup of the middleware can be verified at any time after installation by
running the file MiddlewareVerifier.exe. The executable can be called as follows from
the command line:
MiddlewareVerifier.exe
Note: It is necessary to call the executable from a new command line after installing the
middleware. Otherwise the required addition of system variables during the installation
does not take effect. Also, every incorrect PIN attempt is counted in terms of the
maximum consecutive incorrect attempts for your smartcard.
Note: The PIN is entered during program execution where the characters entered are
shown as *’s.
The tool looks at the various aspects of running the middleware (e.g. system
environment variables were properly set, the smart card reader and smart card are
available, etc.) and generates an output log file.
<soap:Envelope_xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
"><soap:Body><ns2:findKeysResponse_xmlns:ns2="http://service.ubkpki.
escrypt.com/"><return>6</return><return>25</return><return>47</retur
n><return>48</return><return>58</return><return>59</return><return>6
9</return><return>70</return><return>80</return><return>81</return><
return>99</return><return>100</return><return>522</return><return>52
3</return></ns2:findKeysResponse></soap:Body></soap:Envelope>
█ ESCRYPT GmbH – Embedded Security
Below is an example of a “successful” response (in the sense that the server
responded). However, there are no key handles being returned (no return tags), which
may signify that the user ID corresponding to the smart card does not have the
proper access rights for any key. Contact an admin of the PKI if that is not correct.
<soap:Envelope_xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
"><soap:Body><ns2:findKeysResponse_xmlns:ns2="http://service.ubkpki.
escrypt.com/"/></soap:Body></soap:Envelope>
While trying to communicate with the ECU Protection PKI server, several errors can
occur that are signified by LibCURL (or cURL) error codes.
Here is the list of PKCS#11 functions that communicate with the ECU Protection PKI
server (note that for C_GetSlotList, an error does not translate into a PKCS#11 error):
C_GetSlotList
C_FindObjects
C_SignFinal
C_GetAttributeValue
C_DeriveKey
C_Decrypt
Here is a list of codes that that may show up during the execution of the middleware:
6 System Variables
The batch file MiddlewareInstaller.bat will add or modify the following system
variables. Under normal circumstances, no manual configuration is necessary.
However, it may become necessary to update paths if, for instance, files are moved or
changed by the user.
The following system variables are used for the overall configuration of the
middleware:
Note: The tags with the parameters SERVER_CERT, KEY_FILE and SSL_PASSPHRASE all
must remain commented out in axis2.xml.
PROVIDER_DLL: DLL that is needed for services with the smart card. If this
variable is not specified, the middleware assumes that the DLL is located in
“C:\”.
Example value: C:\middleware\gnutls_downloaded\bin\opensc-pkcs11.dll
CURL_CA_BUNDLE: Used for handshaking with the ECU Protection PKI server
(this is its certificate). The handshaking is used to determine whether the server
is running and reachable. As an object on the smartcard, this file is also used
for normal handshaking as well.
Example value: C:\middleware\dummy\curl-ca-bundle.crt
DUMMY_CERT: Used for handshaking with the with the ECU Protection PKI
server. This is a fake certificate. The handshaking is used to determine whether
the server is running and reachable.
Example value: C:\middleware\dummy\cert.cer
DUMMY_KEY: Used for handshaking with the with the ECU Protection PKI
server. This is a fake certificate. The handshaking is used to determine whether
the server is running and reachable.
Example value: C:\middleware\dummy\private.key
7 Troubleshooting
The middleware does not work.
Please run the middleware verifier that should come with your middleware distribution.
It will check the correct setup of the dependencies of the middleware. If some of those
checks fail, the verifier provides additional information in its log files that may help in
isolating the problem.
I have installed a new version of the middleware and now it does not work
anymore.
Please try completely uninstalling the previous version of the middleware as there may
be a conflict due to outdated files.
8 Bibliography
ESCRYPT GmbH. (2013). ECU Protection PKI for UBK Middleware Specifications.