|
CXI
|
The CXI API provides a general purpose Java interface to be used with the CryptoServer firmware module CXI.
To use this interface the firmware module must be loaded into the CryptoServer and the application must have been linked against the library file 'CryptoServerCXI.jar'.
The CXI API supports two operating modes:
See Programming Interface how to apply an operating mode.
The CXI API offers various cryptographic services:
The complete class overview can be found here.
CXI identifies keys 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 (internally) or on the host PC (externally). On generation or import of keys the application can decide whether to store the key internally (internalStorage = true) or externally (internalStorage = false).
An internal key is stored in the key database within the CryptoServer. The application receives a key handle linking to the key on the CryptoServer. In the case of an external key, the application receives a key blob containing key attributes and key components. Key components within a key blob are encrypted with the CryptoServer's Master Backup Key.
CXI offers a key store (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 both key handles and key blobs. If a key handle is given the key is loaded from the CryptoServer's key database. If a key blob is given the key is decrypted with the Master Backup Key. Essentially 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 several users with shared permissions (e.g. Two-person/Four-eyes rule). In either case the CryptoServer adds all authenticated users' permission levels and checks whether the desired command may be executed.
The CryptoServer API supports the following authentication methods:
Pure authentication (without secure messaging) can be applied by using one of the prepareAuthenticationXXX methods (see CryptoServerAPI.CryptoServer).
Instead of authenticating every command, the CryptoServer API allows creation of an encrypted 'Secure Messaging' session with the CryptoServer. Thereby the user only authenticates the creation of the session (exchange of the session key). The session 'remembers' the permissions of all users being logged in. Any command sent through this session is automatically authenticated with the combined permissions of the users.
A session can be created using the getSessionKeyDH method (see CryptoServerAPI.CryptoServer).
In order to simplify session creation the following methods combine authentication and secure messaging:
Any user who wants to access an - internal or external - key has to authenticate to the CryptoServer (see above).
If a key has been assigned to a group (on key generation or import), it may only be accessed by a user who is a member of the same group. To achieve this, 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.
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 stays connected to this device and does not switch back. Optionally a fallback interval time may be configured causing the API to switch back to the first (primary) device of the device list after a certain amount of time.
CryptoServerCXI also provides an event handler interface to obtain information about state changes and errors occurring on the cluster.
By default the event handler messages are written to the default log file (see CxiLog ).
The application may also implement its own event handler and register it, see CryptoServerCluster.setEventHandler(CryptoServerCluster.EventHandler).
In order to use the CXI API the application has to be linked against the CXI library file (CryptoServerCXI.jar).
The API consists of its main class CXI and several other classes that are needed to deal with objects (e.g. keys, properties, configuration).
Main class:
Other classes:
The complete class overview can be found here.
CXI offers three constructors to be used for different purposes:
The following code illustrates how to manage keys with the CXI API:
The following code illustrates how to use cryptographic functions:
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, CCM | None, PKCS#5, ISO7816, Random |
| Mac | CBC, GMAC | 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-Se2-Series-4.01.0.5.mpkg
Create one or more users with authentication mechanism either HMAC-password or signature (RSA, ECDSA) and the following properties:
There are US laws restricting the export of software containing "strong" cryptographic mechanisms. Therefore the SUN JCE provider (which is used by the CXI API) does not support "strong" encryption by default, leading to an exception in the CXI API. To remove these restrictions, please download the package called "unlimited strength jurisdiction policy files" from Oracle's website (unfortunately Oracle's general terms and conditions do not allow packaging these files).
After this replace the old files local_policy.jar and US_export_policy.jar in the folder <java-installation-path>\<java-jre-name>\lib\security by the newly downloaded ones. Now the provider can make use of all cryptographic algorithms and the exception should not longer occur.
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).