|
CXI
|
The CXI API provides an general purpose C++ interface used to access the external functions of the CryptoServer firmware module CXI from an application running on a host.
With the CryptoServer API it is possible either to access a CryptoServer plugged in a slot of the local computer or to access a CryptoServer LAN over TCP/IP.
The CXI API can use different logical protocols with a variable number of protocol layers to communicate with the CryptoServer.
To use this interface the firmware module CXI must be loaded into the CryptoServer and the application must be able to load the specific shared library (cxi.dll / libcxi.so).
The CXI API basically supports two operating modes:
The CXI API is also available for the programming languages JAVA (CryptoServerCXI.jar) and the dot.NET languages C#, C++ and Basic (cxi.net.dll).
Within CXI keys are identified by their key name, key group and key specifier. The key name is mandatory, group and specifier are optional and may be omitted.
In either case the combination of name, group and specifier has to be unique.
Keys can either be stored on the CryptoServer (internal) or on the host PC (external). On generation or import of keys the application can decide whether to store the key internally or externally.
In case of internal keys the application receives a key handle that links to the key, otherwise, in case of external keys, the application receives a key blob, that contains the key, encrypted with the CryptoServers Master Backup Key. CXI offers a key store (see cxi::KeyStore) that can be used to store external keys, but the application may also use other storage locations for external keys (e.g. key files).
Any function on the CryptoServer that needs a key as input parameter (e.g. encryption or signature creation), accepts either key handles or key blobs. If a key handle is given the key is loaded from the key database, if a key blob is given the key is decrypted with the Master Backup Key. Basically the usage of internal and external keys can be mixed.
Any user who wants to execute security relevant commands on the CryptoServer has to authenticate to the CryptoServer. Some commands can either be executed by one user holding the exclusive permissions or by two users with shared permissions (two-person rule). In either case the CryptoServer calculates the resulting permission level, and checks whether the desired command may be executed.
The CryptoServer API supports the following authentication methods:
Instead of authenticating every command, the CryptoServer API allows to create an encrypted 'Secure Messaging' session with the CryptoServer. Thereby the user only authenticates the creation of the session (exchange of the session key). Any command sent through this session will automatically be authenticated with the permission of the user.
A session can be created by using one of the following methods:
Any user who wants to access an - internal or external - key has to authenticate to the CryptoServer. The CryptoServer checks on a resulting permission level of 2 in group 0 (mask: 00000002). The necessary permission level of 2 in group 0 can be achieved by either two user with a permission level of one (Two-Persons-Rule) or one user with a permission level of 2.
If a key has been assigned to a group (on key generation or import), it may only be accessed by a user who is member of the same group. Therefore the user attribute 'CXI_GROUP' has to be set on creation of the user. The CXI_GROUP attribute may also contain wildcards '*' or question marks '?' in order to assign a user to multiple groups.
Examples:
If no group attribute has been set for a key, the key may be accessed by all users regardless of their group membership.
In a load balancing cluster the CryptoServer devices are configured to optimize the use of resources to reach higher system performance, and to avoid overloading a single device. All CryptoServer in the cluster must be configured identically. A new connection is always established to the CryptoServer with the least number of existing connections. In case of communication errors the API automatically switches to the next device and tries to execute the command on that CryptoServer. Only if the API wasn't able to execute the command on any device, it gives up and throws an exception.
CXI provides fault tolerant operation on a CryptoServer cluster. In case of communication errors the API automatically switches to the next device and tries to execute the command on that CryptoServer. Only if the API wasn't able to execute the command on any device, it gives up and throws an exception.
After having successfully switched to another device the API basically stays connected with this device and does not switch back. Optionally, a fallback interval may be configured that causes the API to switch back to the first (primary) device of the device list.
In order to use the CXI API the file 'cxi.h' has to be included and the application has to be linked against the CXI library file.
The API consists of its main class CXI and several other classes that are needed to handle with objects (e.g. keys, properties, configuration).
The complete class overview can be found here
CXI offers three constructors to be used for different purposes:
cxi::Cxi::Cxi(char *device, int timeout, int ctimeout)
Opens the specified CryptoServer with the given connect and command timeouts. Use this constructor if you want to use a single device exclusively.
cxi::Cxi::Cxi(char **devices, int ndevs, int timeout, int ctimeout, int fallback_interval)
Opens multiple CryptoServer as a cluster. Use this constructor if you want to set up a fault-tolerant system that supports failover.
The following code illustrates how to manage keys on a single device:
The following code illustrates how to use cryptographic functions on a cluster of devices:
The CXI firmware module supports the following algorithms and mechanisms:
| Algorithm | Key Sizes [bit] | Mode | Chaining | Padding |
|---|---|---|---|---|
| DES | 56,112,168 | Encryption, Decryption | ECB, CBC | None, PKCS#5, ISO7816, Random |
| Mac | CBC, CBC-Retail, CFB-Retail | None, Zero, PKCS#5, ISO7816, Random | ||
| AES | 128,192,256 | Encryption, Decryption | ECB, CBC, GCM, OFB, CCM | None, PKCS#5, ISO7816, Random |
| Mac | CBC, GMAC, CMAC | None, Zero, PKCS#5, ISO7816, Random | ||
| RSA | 512...16384 (delta = 1bit) | Encryption, Decryption | - | None, PKCS#1, PKCS-OAEP |
| Sign, Verify | - | PKCS#1, X9.31, PKCS-PSS | ||
| ECDSA | Brainpool: 160..512 NIST: 192..521 secp: 112..571 | Encryption, Decryption (ECIES) | - | - |
| Sign, Verify (Raw Format, ASN.1 Format) | - | - | ||
| DSA | P: 512..1024, Q: 160 | Sign, Verify | - | - |
The following hash algorithms are supported:
Load the firmware module package (e.g. SecurityServer-XX-Series-x.x.x.mpkg) into the CryptoServer.
Example:
csadm <authentication> LoadPKG=SecurityServer-CS-Series-2.21.5.mpkg
Create one or more users with authentication mechanism either HMAC-password or signature (RSA, ECDSA) and the following properties:
On Microsoft Windows the CXI API requires the redistributable package runtime library to be installed. It is required to run applications developed with Visual C++ 2008 SP1 on a PC that have no Visual C++ 2008 SP1 installed. The package is automatically installed on installation of the Utimaco CryptoServer Product CD, but it also can be obtained from the Microsoft websites (a version for 32 bit and 64 bit is available).