|
CXI
|
Modules | |
| Key Components | |
Classes | |
| class | CryptoServerCXI.Key |
| This class is used to encapsulate CXI keys. More... | |
| class | CryptoServerCXI.KeyFile |
| This class is used to write the public components of an RSA key into a keyfile. More... | |
| class | CryptoServerCXI.KeyAttributes |
| This class provides methods to create and handle key attribute (property) lists. More... | |
| class | CryptoServerCXI.KeyComponents |
| This class provides methods to create and handle key component lists. More... | |
| class | CryptoServerCXI.MechanismParameter |
| This class is used to construct a mechanism parameter which provides additional, mechanism-specific information. More... | |
| class | CryptoServerCXI.MechParamOAEP |
| This class is used to construct a mechanism parameter for RSA encryption / decryption with PKCS#1_v2.1 RSAES-OAEP padding scheme. More... | |
| class | CryptoServerCXI.MechParamPSS |
| This class is used to construct a mechanism parameter for RSA signature creation / verification with PKCS#1_v2.1 RSASSA-PSS padding scheme. More... | |
| class | CryptoServerCXI.MechParamECIES |
| This class is used to construct a mechanism parameter for 'Elliptic Curve (Augmented) Encryption Scheme' (ECIES, see ANSI X9.63). More... | |
| class | CryptoServerCXI.MechParamGCM |
| This class is used to construct a mechanism parameter for AES encryption / decryption with GCM (Galois Counter Mode, see NIST SP-800-38D) chaining. More... | |
| class | CryptoServerCXI.MechParamGMAC |
| This class is used to construct a mechanism parameter for AES MAC creation / verification with 'Galois Counter MAC' chaining (GMAC, see NIST SP-800-38D). More... | |
| class | CryptoServerCXI.MechParamCCM |
| This class is used to construct a mechanism parameter for AES encryption / decryption in mode Counter with CBC-MAC (CCM, see NIST SP-800-38C). More... | |
| class | CryptoServerCXI.KeyAttAndComp |
| This class is used to encapsulate key attributes (see KeyAttributes) and key components (see KeyComponents) of a key. More... | |
| class | CryptoServerCXI.ECPublicKey |
| This class provides methods to create and handle public EC keys. More... | |
| class | CryptoServerCXI.ECParameter |
| This class provides methods to handle EC domain parameters. More... | |
| class | CryptoServerCXI.KeyStore |
| Key storage for external (MBK encrypted) keys More... | |
| class | CryptoServerCXI.ByteArray |
| Flexible byte array. More... | |
Functions | |
| static double | getVersion () |
| Returns the version of the CXI API (x.xx). | |
| Key (byte[] value) throws CryptoServerException | |
| Creates a key object from the given data. More... | |
| boolean | isHandle () |
| Inquires if the key contains a key handle. More... | |
| byte[] | getEncoded () |
| Returns the key in its encoded (serialized) form. More... | |
| KeyAttributes | getAttributes () throws CryptoServerException |
| Returns the key attributes. More... | |
| byte[] | getUName () throws NoSuchAlgorithmException, CryptoServerException |
| Returns the unique key name. More... | |
| KeyAttributes () | |
| Creates an empty key attribute list. | |
| KeyAttributes (byte[] list, int ofs) throws CryptoServerException | |
| Creates a key attribute list from the given (serialized) attribute stream. More... | |
| KeyAttributes (byte[] list) throws CryptoServerException | |
| Creates a key attribute list from the given (serialized) attribute stream. More... | |
| KeyAttributes | clone () |
| Creates a full copy of the source object. More... | |
| byte[] | toByteArray () throws CryptoServerException |
| Serializes the attribute list and returns an attribute stream. More... | |
| void | setAlgo (int algo) |
| Sets the key algorithm attribute. More... | |
| int | getAlgo () |
| Returns the key algorithm attribute. More... | |
| void | setType (int type) |
| Sets the key type attribute. More... | |
| int | getType () |
| Returns the key type attribute (see Key Types). | |
| void | setSize (int size) |
| Sets the key size. More... | |
| int | getSize () |
| Returns the key size in bits. More... | |
| void | setExport (int exp) |
| Sets the key export attribute. More... | |
| int | getExport () |
| Returns the key export attribute. More... | |
| void | setUsage (int usage) |
| Sets the key usage attribute. More... | |
| int | getUsage () |
| Returns the key usage attribute. More... | |
| void | setLabel (String label) throws CryptoServerException |
| Sets the key label attribute. More... | |
| String | getLabel () throws CryptoServerException |
| Returns the key label attribute. More... | |
| void | setExponent (byte[] exp) |
| Sets the public exponent of a RSA key. More... | |
| void | setExponent (BigInteger exp) |
| Sets the public exponent of a RSA key. More... | |
| byte[] | getExponent () |
| Returns the public exponent of a RSA key. More... | |
| void | setModulus (byte[] mod) |
| Sets the modulus of a RSA key. More... | |
| void | setModulus (BigInteger mod) |
| Sets the modulus of a RSA key. More... | |
| byte[] | getModulus () |
| Returns the modulus of a RSA key. More... | |
| void | setParamP (byte[] par) |
| Sets the prime value P of a DSA key. More... | |
| void | setParamP (BigInteger par) |
| Sets the prime value P of a DSA key. More... | |
| byte[] | getParamP () |
| Returns the prime value P of a DSA key. More... | |
| void | setParamQ (byte[] par) |
| Sets the prime value Q of a DSA key. More... | |
| void | setParamQ (BigInteger par) |
| Sets the prime value Q of a DSA key. More... | |
| byte[] | getParamQ () |
| Returns the prime value Q of a DSA key. More... | |
| void | setParamG (byte[] par) |
| Sets the generator value G of a DSA key. More... | |
| void | setParamG (BigInteger par) |
| Sets the generator value G of a DSA key. More... | |
| byte[] | getParamG () |
| Returns the generator value G of a DSA key. | |
| void | setDSAPub (byte[] par) |
| Sets the public key part of a DSA key. More... | |
| void | setDSAPub (BigInteger par) |
| Sets the public key part of a DSA key. More... | |
| byte[] | getDSAPub () |
| Returns the public key part of a DSA key. | |
| void | setCurve (String name) throws CryptoServerException |
| Sets the domain parameter of an ECDSA key. More... | |
| void | setCurve (byte[] curve) |
| Sets the domain parameter of an ECDSA key. More... | |
| void | setCurve (ECParameterSpec curve) throws CryptoServerException |
| Sets the domain parameter for an ECDSA key. More... | |
| byte[] | getCurve () |
| Returns the domain parameters for a ECDSA key. More... | |
| byte[] | getCurveEncoded () throws IOException, CryptoServerException |
| Returns the domain parameters for a ECDSA key. More... | |
| void | setECPub (byte[] par) |
| Sets the public key part of a ECDSA key. More... | |
| void | setECPub (BigInteger par) |
| Sets the public key part of a ECDSA key. More... | |
| byte[] | getECPub () |
| Returns the public key part of a ECDSA key. More... | |
| void | setName (String name) throws CryptoServerException |
| Sets the key name attribute. More... | |
| String | getName () throws CryptoServerException |
| Returns the key name. More... | |
| void | setGroup (String group) throws CryptoServerException |
| Sets the key group attribute. More... | |
| String | getGroup () throws CryptoServerException |
| Returns the key group. More... | |
| void | setSpecifier (int spec) |
| Sets the key specifier attribute. More... | |
| int | getSpecifier () |
| Returns the key specifier. More... | |
| void | setGenerationDate (Date date) |
| Sets the generation date attribute of the key. More... | |
| void | setGenerationDate (byte[] utcTime) |
| Sets the generation date attribute of the key. More... | |
| void | setExpirationDate (Date date) |
| Sets the expiration date attribute of the key. More... | |
| void | setExpirationDate (byte[] utcTime) |
| Sets the expiration date attribute of the key. More... | |
| Date | getGenerationDate () |
| Returns the generation date attribute or null if the data attribute was not set. More... | |
| Date | getExpirationDate () |
| Returns the expiration date attribute or null if the data attribute was not set. More... | |
| void | setCertificate (byte[] cert) |
| Sets a certificate for the key. More... | |
| byte[] | getCertificate () |
| Returns the certificate or null if the key doesn't have a certificate attribute. | |
| void | setMechs (int[] mechs) throws CryptoServerException, UnsupportedEncodingException |
| Sets an int array with mechanisms for a key. More... | |
| byte[] | getMechs () |
| Returns a list of key mechanisms as byte array. More... | |
| void | setFIPSUsage (int usage) |
| Sets the fips key usage/padding specifier attribute. More... | |
| int | getFIPSUsage () |
| Returns the fips key usage/padding specifier attribute. More... | |
Variables | |
| static final int | FLAG_OVERWRITE = 0x00000001 |
| Overwrite key if already existing. | |
| static final int | FLAG_EXTERNAL = 0x00000002 |
| Don't store key on CryptoServer but return MBK encrypted key blob to be stored externally. | |
| static final int | FLAG_VOLATILE = 0x00000004 |
| Volatile key storage (until next restart of CryptoServer) | |
| static final int | FLAG_HASH_PART = 0x00000020 |
| Don't finalize hash, return hash digest info instead. | |
| static final int | FLAG_HASH_DATA = 0x00000040 |
| Given data has to be hash. | |
| static final int | FLAG_ENCRYPT_SECRET = 0x00000080 |
| Encrypt shared secret with MBK. | |
| static final int | FLAG_CRYPT_INIT = 0x00000100 |
| Initialize En/Decryption Operation (RFU) | |
| static final int | FLAG_CRYPT_FINAL = 0x00000200 |
| Finalize En/Decryption Operation. | |
| static CryptoServerLog | CxiLog = new CryptoServerLog("cxi.log", CryptoServerLog.LogLevel.Warning, 0x100000) |
| Static instance of CryptoServerLog that provides unified logging. More... | |
Constructors | |
| CryptoServerCXI (String device) throws IOException, NumberFormatException, CryptoServerException | |
| Creates a new connection to a single CryptoServer. More... | |
| CryptoServerCXI (String device, int timeout) throws IOException, NumberFormatException, CryptoServerException | |
| Creates a new connection to a single CryptoServer. More... | |
| CryptoServerCXI (String[] devices, int timeout) throws IOException, CryptoServerException | |
| Creates a new connection to a CryptoServer cluster. More... | |
| CryptoServerCXI (CryptoServerConfig config) throws IOException, CryptoServerException | |
| Creates a new connection to a CryptoServer or CryptoServer cluster. More... | |
Miscellaneous Functions | |
| int | getFirmwareVersion () throws IOException, CryptoServerException |
| Returns the version number of the CryptoServer firmware module CXI (x.x.x.x). | |
Functions for Key Management | |
| Key | generateKey (int flags, KeyAttributes keyTemplate, int mech) throws IOException, CryptoServerException |
| Generates a new keys according on the given template (key attributes). More... | |
| Key | generateKey (int flags, KeyAttributes keyTemplate) throws IOException, CryptoServerException |
| Generates a new keys according on the given template (key attributes). More... | |
| KeyAttributes | generateDSADomainParam (int psize, int qsize, int mech) throws IOException, CryptoServerException |
| Creates the domain parameter (P, Q and G), needed to create a DSA key (see CryptoServerCXI.CryptoServerCXI.generateKey). More... | |
| byte[] | generateDSAPQParam (int psize, int qsize, int mech, int hash, byte[] seed, int index) throws IOException, CryptoServerException |
| Creates the domain parameter (P and Q), needed to create a DSA key (see CryptoServerCXI.CryptoServerCXI.generateKey) as described in FIPS 186-4. More... | |
| KeyAttributes | generateDSAGParam (byte[] mechParamAndPropList) throws IOException, CryptoServerException |
| Creates the domain parameter G, needed to create a DSA key (see CryptoServerCXI.CryptoServerCXI.generateKey) as described in FIPS 186-4. More... | |
| Key | findKey (int flags, KeyAttributes keyTemplate) throws IOException, CryptoServerException |
| Finds a key in the internal database of the CryptoServer and returns either a key handle or a key backup blob. More... | |
| Key | findKey (KeyAttributes keyTemplate) throws IOException, CryptoServerException |
| Finds a key in the internal database of the CryptoServer and returns a key handle. More... | |
| KeyAttributes | getKeyAttributes (Key key, boolean all) throws IOException, CryptoServerException |
| Inquires key attributes of a key. More... | |
| Key | setKeyAttributes (Key key, KeyAttributes attr) throws IOException, CryptoServerException |
| Sets one or more key attributes for a key. More... | |
| KeyAttributes | getKeyAttributes (Key key, int[] desired) throws IOException, CryptoServerException |
| KeyAttributes[] | listKeys (KeyAttributes keyTemplate) throws IOException, CryptoServerException |
| Enumerates the keys which are currently stored in the CXI database on the CryptoServer. More... | |
| KeyAttributes[] | listKeys () throws IOException, CryptoServerException |
| Enumerates the keys which are currently stored in the CXI database on the CryptoServer. More... | |
| Key | backupKey (Key key) throws IOException, CryptoServerException |
| Exports a key as key backup blob. More... | |
| Key | restoreKey (int flags, Key key, KeyAttributes keyTemplate) throws IOException, CryptoServerException |
| Restores (imports) a key from a key backup blob, see Format of Key Blobs. More... | |
| void | deleteKey (Key key) throws IOException, CryptoServerException |
| Delete a key from the CryptoServer. More... | |
| byte[] | exportKey (Key key, int type, Key wrapKey, int mech) throws IOException, CryptoServerException |
| Export a key from the CryptoServer. More... | |
| byte[] | exportKey (Key key, int type, Key wrapKey) throws IOException, CryptoServerException |
| Export a key from the CryptoServer. More... | |
| KeyAttAndComp | exportClearKey (Key key, int type) throws IOException, CryptoServerException |
| Export a key (cleartext) from the CryptoServer. More... | |
| Key | importKey (int flags, int type, KeyAttributes keyTemplate, byte[] keyBlob, Key wrapKey, int mech) throws IOException, CryptoServerException |
| Imports a key blob of type 'Simple Blob' (see Format of Key Blobs). More... | |
| Key | importKey (int flags, int type, KeyAttributes keyTemplate, byte[] keyBlob, Key wrapKey) throws IOException, CryptoServerException |
| Imports a key blob of type 'Simple Blob' (see Format of Key Blobs). More... | |
| Key | importClearKey (int flags, int type, KeyAttributes keyTemplate, KeyComponents keyComponents) throws IOException, CryptoServerException |
| Imports a clear text key. More... | |
Cryptographic Functions | |
| byte[] | crypt (int flags, Key key, int mech, byte[] mechParam, byte[] data, ByteArray iv, ByteArray tag, byte[] tag_in) throws IOException, CryptoServerException |
| Encrypt or decrypt data. More... | |
| byte[] | crypt (Key key, int mech, byte[] mechParam, byte[] data, ByteArray iv) throws IOException, CryptoServerException |
| Encrypt or decrypt data. More... | |
| byte[][] | bulkCrypt (Key key, int mech, byte[][] data) throws IOException, CryptoServerException |
| Encrypt or decrypt multiple data items in one operation. More... | |
| byte[] | sign (int flags, Key key, int mech, byte[] mechParam, byte[] data, ByteArray iv) throws IOException, CryptoServerException |
| Digitally signs the given hash value (asymmetric algorithms) or calculates a Message Authentication Code (MAC) or hash based MAC (HMAC) (symmetric algorithms). More... | |
| byte[] | sign (Key key, int mech, byte[] data) throws IOException, CryptoServerException |
| Digitally signs the given hash value (asymmetric algorithms) or calculates a Message Authentication Code (MAC) or hash based MAC (HMAC) (symmetric algorithms). More... | |
| byte[][] | bulkSign (Key key, int mech, byte[][] data) throws IOException, CryptoServerException |
| Digitally signs up to 16(ECDSA)/50(RSA) hash values in one operation. More... | |
| boolean | verify (int flags, Key key, int mech, byte[] mechParam, byte[] data, byte[] signature, ByteArray iv) throws IOException, CryptoServerException |
| Verifies a digital signature, Message Authentication Code (MAC) or hash based MAC (HMAC). More... | |
| boolean | verify (Key key, int mech, byte[] data, byte[] signature) throws IOException, CryptoServerException |
| Verifies a digital signature, Message Authentication Code (MAC) or hash based MAC (HMAC). More... | |
| byte[] | generateRandom (int length, int mech) throws IOException, CryptoServerException |
| Generate random bytes. More... | |
| byte[] | computeHash (int flags, int mech, byte[] data, byte[] info, Key key) throws IOException, CryptoServerException |
| Computes a hash or hash based MAC (HMAC) over the given data. More... | |
| byte[] | agreeSecret (int flags, Key privateKey, Key publicKey, int mech, byte[] mechParam) throws IOException, CryptoServerException |
| This function calculates a shared secret from two ECDH or ECDSA keys as described in TR-03111. More... | |
| Key | deriveKey (int flags, Key privateKey, KeyAttributes keyTemplate, int mech, byte[] mechParam) throws IOException, CryptoServerException |
| Key | setFIPSUsage (Key key, int usage) throws CryptoServerException, IOException |
| Sets the FIPS usage/padding specifier in the attribute list of the Key. More... | |
| CryptoServerCXI | ( | String | device | ) | throws IOException, NumberFormatException, CryptoServerException |
Creates a new connection to a single CryptoServer.
| device | Address of the CryptoServer. May contain the prefix "TCP:" followed by the IP address or port number and IP address (seperated by a '@'), or the prefix "PCI:" followed by the device name of a PCI device. Examples:
|
| CryptoServerCXI | ( | String | device, |
| int | timeout | ||
| ) | throws IOException, NumberFormatException, CryptoServerException |
Creates a new connection to a single CryptoServer.
| device | Address of the CryptoServer. May contain the prefix "TCP:" followed by the IP address or port number and IP address (seperated by a '@'), or the prefix "PCI:" followed by the device name of a PCI device. Examples:
|
| timeout | Timeout in milliseconds to establich the connection. |
| CryptoServerCXI | ( | String[] | devices, |
| int | timeout | ||
| ) | throws IOException, CryptoServerException |
Creates a new connection to a CryptoServer cluster.
Internally only one CryptoServer is connected at a time. The API provides a failover mechanism that switches to another device in case of failure and returns as soon as one device has been successfully connected. If none of the devices in the cluster can be connected an exception will be thrown.
| devices | Array of the CryptoServer device addresses. Each address may contain the prefix "TCP:" followed by the IP address or port number and IP address (seperated by a '@'), or the prefix "PCI:" followed by the device name of a PCI device. Examples:
|
| timeout | Timeout in milliseconds to establich the connection to a CryptoServer. |
| CryptoServerCXI | ( | CryptoServerConfig | config | ) | throws IOException, CryptoServerException |
Creates a new connection to a CryptoServer or CryptoServer cluster.
| config | Configuration object, see CryptoServerConfig. The following key names will be recognized:
|
| Key generateKey | ( | int | flags, |
| KeyAttributes | keyTemplate, | ||
| int | mech | ||
| ) | throws IOException, CryptoServerException |
Generates a new keys according on the given template (key attributes).
Dependant on the given flags the key is either stored in the internal database and a key handle
is returned or the key is not stored on the CryptoServer but an MBK encrypted key backup blob is returned.
| flags | Command flags (see Command Flags), XOR combination of:
A value of 0 can be used to set none of the above flags. |
| keyTemplate | Key attributes to be set for the new key (see Key Properties). The following attributes are mandatory for the key template:
|
| mech | Mechanism specifier, XOR combination of:
A value of -1 can be used to set the default values. |
| Key generateKey | ( | int | flags, |
| KeyAttributes | keyTemplate | ||
| ) | throws IOException, CryptoServerException |
Generates a new keys according on the given template (key attributes).
Dependant on the given flags the key is either stored in the internal database and a key handle
is returned or the key is not stored on the CryptoServer but an MBK encrypted key backup blob is returned.
| flags | Command flags, XOR combination of:
A value of 0 can be used to set none of the above flags. |
| keyTemplate | Key attributes to be set for the new key (see Key Properties). The following attributes are mandatory for the key template:
|
| KeyAttributes generateDSADomainParam | ( | int | psize, |
| int | qsize, | ||
| int | mech | ||
| ) | throws IOException, CryptoServerException |
Creates the domain parameter (P, Q and G), needed to create a DSA key (see CryptoServerCXI.CryptoServerCXI.generateKey).
| psize | Size of prime P. |
| qsize | Size of prime Q. |
| mech | XOR combination of:
|
| byte[] generateDSAPQParam | ( | int | psize, |
| int | qsize, | ||
| int | mech, | ||
| int | hash, | ||
| byte[] | seed, | ||
| int | index | ||
| ) | throws IOException, CryptoServerException |
Creates the domain parameter (P and Q), needed to create a DSA key (see CryptoServerCXI.CryptoServerCXI.generateKey) as described in FIPS 186-4.
| psize | Size of prime P. |
| qsize | Size of prime Q. |
| mech | Random mode (see Random Generation Parameter):
|
| hash | Hash algo
|
| seed | Optional seed value |
| index | unused (for further use) |
| KeyAttributes generateDSAGParam | ( | byte[] | mechParamAndPropList | ) | throws IOException, CryptoServerException |
Creates the domain parameter G, needed to create a DSA key (see CryptoServerCXI.CryptoServerCXI.generateKey) as described in FIPS 186-4.
| mechParamAndPropList | PropertyList and Mechanism Parameter as byte array, for example generated by generateDSAPQParam |
| Key findKey | ( | int | flags, |
| KeyAttributes | keyTemplate | ||
| ) | throws IOException, CryptoServerException |
Finds a key in the internal database of the CryptoServer and returns either a key handle or a key backup blob.
On a cluster of CryptoServer the function searches on all devices and returns the first matching key.
| flags | XOR combination of:
A value of 0 can be used to set none of the above flags. |
| keyTemplate | Key Attributes that specify the key to be found. The key is identified by the following attributes:
|
The wildcards are not supported for the attributes listed above. If name and group are using default values (i.e. empty string) they have not to (for name even must not) be set within provided key atributes (keyTemplate).
| Key findKey | ( | KeyAttributes | keyTemplate | ) | throws IOException, CryptoServerException |
Finds a key in the internal database of the CryptoServer and returns a key handle.
On a cluster of CryptoServer the function searches on all devices and returns the first matching key.
| keyTemplate | Key Attributes that specify the key to be found. The key is identified by the following attributes:
|
The wildcards are not supported for the attributes listed above. If name and group are using default values (i.e. empty string) they have not to (for name even must not) be set within provided key atributes (keyTemplate).
| KeyAttributes getKeyAttributes | ( | Key | key, |
| boolean | all | ||
| ) | throws IOException, CryptoServerException |
Inquires key attributes of a key.
| key | Key object, whose attributes are to be inquired |
| all |
|
| Key setKeyAttributes | ( | Key | key, |
| KeyAttributes | attr | ||
| ) | throws IOException, CryptoServerException |
Sets one or more key attributes for a key.
| key | Key object, whose attributes are to be set |
| attr | List of attrubutes to be set |
| KeyAttributes[] listKeys | ( | KeyAttributes | keyTemplate | ) | throws IOException, CryptoServerException |
Enumerates the keys which are currently stored in the CXI database on the CryptoServer.
The returned key list contains those keys that
1)
The user is allowed to access keys according to his group membership and 'global' keys without a group attribute.
2)
A attribute list may be given to specify a partial set of keys to be listed. Thereby only those keys are listed that match the given attribute values. If no attribute list is given keys are not filtered.
| keyTemplate | List of attributes that define search criteria for the keys to be listed. Keys that don't match the given criteria will not be listed. |
| KeyAttributes[] listKeys | ( | ) | throws IOException, CryptoServerException |
Enumerates the keys which are currently stored in the CXI database on the CryptoServer.
| Key backupKey | ( | Key | key | ) | throws IOException, CryptoServerException |
Exports a key as key backup blob.
The private or secret key parts within the blob
are encrypted with the CryptoServer's Master Box Key (MBK).
| key | Key handle. |
| Key restoreKey | ( | int | flags, |
| Key | key, | ||
| KeyAttributes | keyTemplate | ||
| ) | throws IOException, CryptoServerException |
Restores (imports) a key from a key backup blob, see Format of Key Blobs.
| flags | XOR combination of:
A value of 0 can be used to set none of the above flags. |
| key | Key to be restored. |
| keyTemplate | Key attributes to be set or modified. If one or more of these attributes are already present in the key backup blob, they will be overwritten, as long as the attribute value is not read-only, e.g. it is not possible to change the algorithm or key size attribute. Optionally, if no additional attributes should be set, keyTemplate can be set to null. |
| void deleteKey | ( | Key | key | ) | throws IOException, CryptoServerException |
Delete a key from the CryptoServer.
| key | Key handle of key to be deleted. |
| byte[] exportKey | ( | Key | key, |
| int | type, | ||
| Key | wrapKey, | ||
| int | mech | ||
| ) | throws IOException, CryptoServerException |
Export a key from the CryptoServer.
| key | Key to be exported |
| type | Key type (see Key Types):
|
| wrapKey | Key encryption key (null on clear key export) |
| mech | XOR combination of mechanism parameter used to encrypt key (see Mechanism Parameter):
A value of -1 can be used to set the default values (CBC, PKCS#5). |
| byte[] exportKey | ( | Key | key, |
| int | type, | ||
| Key | wrapKey | ||
| ) | throws IOException, CryptoServerException |
Export a key from the CryptoServer.
| key | Key to be exported |
| type | Key type (see Key Types):
|
| wrapKey | Key encryption key (null on clear key export) |
| KeyAttAndComp exportClearKey | ( | Key | key, |
| int | type | ||
| ) | throws IOException, CryptoServerException |
| Key importKey | ( | int | flags, |
| int | type, | ||
| KeyAttributes | keyTemplate, | ||
| byte[] | keyBlob, | ||
| Key | wrapKey, | ||
| int | mech | ||
| ) | throws IOException, CryptoServerException |
Imports a key blob of type 'Simple Blob' (see Format of Key Blobs).
| flags | XOR combination of command flags (see Command Flags):
A value of 0 can be used to set none of the above flags. |
| type | Blob type (see Blob Types):
|
| keyTemplate | Updated key attributes to be set for the new key or null. |
| keyBlob | Key blob to be imported |
| wrapKey | Key Encryption Key to be used to encrypt key. The key may be imported in plain. The value of wrapKey has to be set to 'null' in this case. |
| mech | XOR combination of mechanism parameter used to decrypt key or -1 to use default values:
A value of -1 can be used to set the default values. |
| Key importKey | ( | int | flags, |
| int | type, | ||
| KeyAttributes | keyTemplate, | ||
| byte[] | keyBlob, | ||
| Key | wrapKey | ||
| ) | throws IOException, CryptoServerException |
Imports a key blob of type 'Simple Blob' (see Format of Key Blobs).
| flags | XOR combination of command flags (see Command Flags):
A value of 0 can be used to set none of the above flags. |
| type | Blob type (see Blob Types):
|
| keyTemplate | Key attributes to be set for the new key. |
| keyBlob | Key blob to be imported |
| wrapKey | Key Encryption Key to be used to encrypt key. The key may be imported in plain. The value of wrapKey has to be set to 'null' in this case. |
| Key importClearKey | ( | int | flags, |
| int | type, | ||
| KeyAttributes | keyTemplate, | ||
| KeyComponents | keyComponents | ||
| ) | throws IOException, CryptoServerException |
Imports a clear text key.
| flags | XOR combination of:
A value of 0 can be used to set none of the above flags. |
| type | Blob type (see Blob Types):
|
| keyTemplate | Key attributes to be set for the new key. |
| keyComponents | Key components of the key to be imported. This parameter may be 'null' on public keys. In this case the key template has to contain the public key componets. |
| byte[] crypt | ( | int | flags, |
| Key | key, | ||
| int | mech, | ||
| byte[] | mechParam, | ||
| byte[] | data, | ||
| ByteArray | iv, | ||
| ByteArray | tag, | ||
| byte[] | tag_in | ||
| ) | throws IOException, CryptoServerException |
Encrypt or decrypt data.
The following algorithms are supported:
| flags | Command flags:
|
| key | Key to be used for encryption or decryption. The key usage property has to contain the KEY_USAGE_ENCRYPT and/or KEY_USAGE_DECRYPT value (see Usage Specifier). |
| mech | XOR combination of mechanisms (see Mechanism Parameter):
|
| mechParam | Optional mechanism parameter (see MechanismParameter) or null if no mechanism parameter should be used: |
| data | Data to be en- or decrypted. |
| iv | Initialization vector used to chain cipher blocks.
|
| tag | Authentication tag / MAC for AES GCM / CCM or null
|
| tag_in | Authentication tag / MAC for AES GCM / CCM to check when decrypting or null. |
| byte[] crypt | ( | Key | key, |
| int | mech, | ||
| byte[] | mechParam, | ||
| byte[] | data, | ||
| ByteArray | iv | ||
| ) | throws IOException, CryptoServerException |
Encrypt or decrypt data.
| byte[][] bulkCrypt | ( | Key | key, |
| int | mech, | ||
| byte | data[][] | ||
| ) | throws IOException, CryptoServerException |
Encrypt or decrypt multiple data items in one operation.
The function utilizes a cryptographic accelerator if present on the target hardware and therefore speeds up RSA calculations.
| key | RSA Key to be used for encryption or decryption. The key usage property has to contain the KEY_USAGE_ENCRYPT and/or KEY_USAGE_DECRYPT value (see Usage Specifier). |
| mech | XOR combination of mechanisms (see Mechanism Parameter):
|
| data | Array of data items to be en- or decrypted |
| byte[] sign | ( | int | flags, |
| Key | key, | ||
| int | mech, | ||
| byte[] | mechParam, | ||
| byte[] | data, | ||
| ByteArray | iv | ||
| ) | throws IOException, CryptoServerException |
Digitally signs the given hash value (asymmetric algorithms) or calculates a Message Authentication Code (MAC) or hash based MAC (HMAC) (symmetric algorithms).
The function supports cipher block chaining on MACs and multipart calculation on HMACs and hashing for asymmetric algorithms.
On MAC calculation the returned MAC can be used as input IV on the next block.
On HMAC calculation and asymmetric algorithms the function can be instructed not to finalize the hash but return the intermediate digest information that can be used as input ('IV') for the next block.
| flags | Command flags (see Command Flags):
A value of 0 can be used to set none of the above flags. |
| key | Key to be used to create the signature or calculate the MAC or HMAC. The key usage property has to contain the KEY_USAGE_SIGN value (see Usage Specifier). |
| mech | XOR combination of mechanism parameter (see Mechanism Parameter):
|
| mechParam | optional mechanism parameter (see MechanismParameter) or null if no mechanism parameter should be used: |
| data | Hash value to be signed or data to be MAC'ed.
|
| iv | Initialization vector used to chain cipher blocks or digest information to continue a multipart hash calculation.
|
| byte[] sign | ( | Key | key, |
| int | mech, | ||
| byte[] | data | ||
| ) | throws IOException, CryptoServerException |
Digitally signs the given hash value (asymmetric algorithms) or calculates a Message Authentication Code (MAC) or hash based MAC (HMAC) (symmetric algorithms).
| byte[][] bulkSign | ( | Key | key, |
| int | mech, | ||
| byte | data[][] | ||
| ) | throws IOException, CryptoServerException |
Digitally signs up to 16(ECDSA)/50(RSA) hash values in one operation.
The function utilizes a cryptographic accelerator if present on the target hardware and therefore speeds up RSA and ECDSA calculations.
| key | RSA or ECDSA Key to be used to create the signature. The key usage property has to contain the KEY_USAGE_SIGN value (see Usage Specifier). |
| mech | XOR combination of mechanism (see Mechanism Parameter):
|
| data | Array of hash values to be signed. |
| boolean verify | ( | int | flags, |
| Key | key, | ||
| int | mech, | ||
| byte[] | mechParam, | ||
| byte[] | data, | ||
| byte[] | signature, | ||
| ByteArray | iv | ||
| ) | throws IOException, CryptoServerException |
Verifies a digital signature, Message Authentication Code (MAC) or hash based MAC (HMAC).
The function supports cipher block chaining on MACs and multipart calculation on HMACs.
On MAC verification the returned IV can be used as input IV on the next block.
On HMAC calculation the function can be instructed not to finalize the HMAC but return the intermediate HMAC digest information that can be used as input ('IV') for the next block.
| flags | Command flags (see Command Flags):
A value of 0 can be used to set none of the above flags. |
| key | Key to be used to verify the signature, MAC or HMAC. The key usage property has to contain the KEY_USAGE_VERIFY value (see cxi_usage). |
| mech | XOR combination of mechanism (see Mechanism Parameter):
|
| mechParam | Optional mechanism parameter (see MechanismParameter) or null if no mechanism parameter should be used: |
| data | Reference hash to be compared (asym. algorithms) or data to be MAC'ed for comparison.
|
| signature | Signature, MAC or HMAC to be verified
|
| iv | Initialization vector used to chain cipher blocks or HMAC digest information used to calculate a multipart HMAC.
|
| boolean verify | ( | Key | key, |
| int | mech, | ||
| byte[] | data, | ||
| byte[] | signature | ||
| ) | throws IOException, CryptoServerException |
Verifies a digital signature, Message Authentication Code (MAC) or hash based MAC (HMAC).
| byte[] generateRandom | ( | int | length, |
| int | mech | ||
| ) | throws IOException, CryptoServerException |
Generate random bytes.
| length | Number of random bytes to be generated. |
| mech | Generation mode (see Random Generation Parameter):
A value of -1 can be used to set the default values. |
| byte[] computeHash | ( | int | flags, |
| int | mech, | ||
| byte[] | data, | ||
| byte[] | info, | ||
| Key | key | ||
| ) | throws IOException, CryptoServerException |
Computes a hash or hash based MAC (HMAC) over the given data.
| flags | Command flags:
A value of 0 can be used to set none of the above flags. |
| mech | XOR combination of hash mode (see Mode Parameter) and hash algorithm (see Hash Algorithms). |
| data | Plain data to be hashed. |
| info | Optional hash digest information to continue a multipart hash calculation or NULL_REF(ByteArray) to start a new hash calculation. |
| key | Optional key:
|
| byte[] agreeSecret | ( | int | flags, |
| Key | privateKey, | ||
| Key | publicKey, | ||
| int | mech, | ||
| byte[] | mechParam | ||
| ) | throws IOException, CryptoServerException |
This function calculates a shared secret from two ECDH or ECDSA keys as described in TR-03111.
The algorithm is based on a point multiplication, which takes the private part of the first key and the public part of the second key as input parameter. The returned secret consists either of the complete resulting point (x and y coordinate) or only of its x- coordinate in case CXI_MECH_FORMAT_X was given in the mechanism parameters. The function returns either the plain secret value or encrypts the secret with the CryptoServer's MBK in case CXI_FLAG_ENCRYPT_SECRET was given in the command flags.
| flags | Command flags (see Command Flags):
|
| privateKey | Private part of key #1. The key usage property has to contain the KEY_USAGE_DERIVE value. |
| publicKey | Public part of key #2.
|
| mech | Mechanism (see Mechanism Parameter):
|
| mechParam | Public Key: X9.42 encoded public part of key #2 (optional, if not already given in the publicKey parameter) |
| Key deriveKey | ( | int | flags, |
| Key | privateKey, | ||
| KeyAttributes | keyTemplate, | ||
| int | mech, | ||
| byte[] | mechParam | ||
| ) | throws IOException, CryptoServerException |
| flags | |
| privateKey | |
| keyTemplate | |
| mech |
| IOException | |
| CryptoServerException |
| Key setFIPSUsage | ( | Key | key, |
| int | usage | ||
| ) | throws CryptoServerException, IOException |
| Key | ( | byte[] | value | ) | throws CryptoServerException |
Creates a key object from the given data.
| value | Serialized key blob or key handle encoded in CryptoServer format |
| boolean isHandle | ( | ) |
Inquires if the key contains a key handle.
| byte[] getEncoded | ( | ) |
Returns the key in its encoded (serialized) form.
| KeyAttributes getAttributes | ( | ) | throws CryptoServerException |
Returns the key attributes.
| CryptoServerException | if the key is a reference to an internal key (key handle). |
| byte[] getUName | ( | ) | throws NoSuchAlgorithmException, CryptoServerException |
Returns the unique key name.
| KeyAttributes | ( | byte[] | list, |
| int | ofs | ||
| ) | throws CryptoServerException |
Creates a key attribute list from the given (serialized) attribute stream.
| list | Serialized attribute list. |
| ofs | Offset to attribute list. |
| KeyAttributes | ( | byte[] | list | ) | throws CryptoServerException |
Creates a key attribute list from the given (serialized) attribute stream.
| list | Serialized attribute list. |
| KeyAttributes clone | ( | ) |
Creates a full copy of the source object.
| byte[] toByteArray | ( | ) | throws CryptoServerException |
Serializes the attribute list and returns an attribute stream.
Attribute lists are encoded in a simple, TLV encoded key blob format. Each item is encoded as follows:
| Tag | Lengh | Value |
|---|---|---|
| 2 bytes | 2 bytes | Length bytes |
| void setAlgo | ( | int | algo | ) |
Sets the key algorithm attribute.
| algo | Algorithm specifier (see Algorithm Specifier). |
| int getAlgo | ( | ) |
Returns the key algorithm attribute.
| void setType | ( | int | type | ) |
Sets the key type attribute.
| type | key type attribute (see Key Types). |
| void setSize | ( | int | size | ) |
Sets the key size.
| size | Key size in bits. |
| int getSize | ( | ) |
Returns the key size in bits.
| void setExport | ( | int | exp | ) |
Sets the key export attribute.
| exp | Key export attribute (see Export Policy Specifier). |
| int getExport | ( | ) |
Returns the key export attribute.
| void setUsage | ( | int | usage | ) |
Sets the key usage attribute.
| usage | Key usage attribute (see Usage Specifier). |
| int getUsage | ( | ) |
Returns the key usage attribute.
| void setLabel | ( | String | label | ) | throws CryptoServerException |
Sets the key label attribute.
| label | Optional label to be set for the key. |
| String getLabel | ( | ) | throws CryptoServerException |
Returns the key label attribute.
| void setExponent | ( | byte[] | exp | ) |
Sets the public exponent of a RSA key.
| exp | Public exponent of the key. |
| void setExponent | ( | BigInteger | exp | ) |
Sets the public exponent of a RSA key.
| exp | Public exponent of the key. |
| byte[] getExponent | ( | ) |
Returns the public exponent of a RSA key.
| void setModulus | ( | byte[] | mod | ) |
Sets the modulus of a RSA key.
| mod | Modulus of the RSA key. |
| void setModulus | ( | BigInteger | mod | ) |
Sets the modulus of a RSA key.
| mod | Modulus of the RSA key. |
| byte[] getModulus | ( | ) |
Returns the modulus of a RSA key.
| void setParamP | ( | byte[] | par | ) |
Sets the prime value P of a DSA key.
| par | Prime value P of the DSA key. |
| void setParamP | ( | BigInteger | par | ) |
Sets the prime value P of a DSA key.
| par | Prime value P of the DSA key. |
| byte[] getParamP | ( | ) |
Returns the prime value P of a DSA key.
| void setParamQ | ( | byte[] | par | ) |
Sets the prime value Q of a DSA key.
| par | Prime value Q of the DSA key. |
| void setParamQ | ( | BigInteger | par | ) |
Sets the prime value Q of a DSA key.
| par | Prime value Q of the DSA key. |
| byte[] getParamQ | ( | ) |
Returns the prime value Q of a DSA key.
| void setParamG | ( | byte[] | par | ) |
Sets the generator value G of a DSA key.
| par | Generator value G of the DSA key. |
| void setParamG | ( | BigInteger | par | ) |
Sets the generator value G of a DSA key.
| par | Generator value G of the DSA key. |
| void setDSAPub | ( | byte[] | par | ) |
Sets the public key part of a DSA key.
| par | Public key part of the DSA key. |
| void setDSAPub | ( | BigInteger | par | ) |
Sets the public key part of a DSA key.
| par | Public key part of the DSA key. |
| void setCurve | ( | String | name | ) | throws CryptoServerException |
Sets the domain parameter of an ECDSA key.
| name | Name of the build in curve to be set (e.g. "NIST-P256") |
| void setCurve | ( | byte[] | curve | ) |
Sets the domain parameter of an ECDSA key.
| curve | Curve to be set, either the object identifier for a build in curve or the ASN1 coded curve definition. |
| void setCurve | ( | ECParameterSpec | curve | ) | throws CryptoServerException |
Sets the domain parameter for an ECDSA key.
| curve | Encoded domain parameter to be set for the key. |
| byte[] getCurve | ( | ) |
Returns the domain parameters for a ECDSA key.
| byte[] getCurveEncoded | ( | ) | throws IOException, CryptoServerException |
Returns the domain parameters for a ECDSA key.
| void setECPub | ( | byte[] | par | ) |
Sets the public key part of a ECDSA key.
| par | Public key part of the ECDSA key. |
| void setECPub | ( | BigInteger | par | ) |
Sets the public key part of a ECDSA key.
| par | Public key part of the ECDSA key. |
| byte[] getECPub | ( | ) |
Returns the public key part of a ECDSA key.
| void setName | ( | String | name | ) | throws CryptoServerException |
Sets the key name attribute.
| name | Name of the key that is used to identify the key. The key name attribute is mandatory for keys stored on the CryptoServer but optional for keys stored externally. |
| String getName | ( | ) | throws CryptoServerException |
Returns the key name.
| void setGroup | ( | String | group | ) | throws CryptoServerException |
Sets the key group attribute.
| group | Key group of the key. The key group attribute is used to apply access restrictions on a key. If set the key can only be access by users of the corresponding user group. If no key group is set for a key, it can be accessed by everyone. |
| String getGroup | ( | ) | throws CryptoServerException |
Returns the key group.
| void setSpecifier | ( | int | spec | ) |
Sets the key specifier attribute.
| spec | Key specifier of the key. The key specifier is an optional attribute that can be set in addition to name and group to identify the key. A value of -1 is used to mark an empty attribute and should therefor not be set. |
| int getSpecifier | ( | ) |
Returns the key specifier.
| void setGenerationDate | ( | Date | date | ) |
Sets the generation date attribute of the key.
| date | Generation date to be set. |
| void setGenerationDate | ( | byte[] | utcTime | ) |
Sets the generation date attribute of the key.
| utcTime | time string ('YYMMDDHHMMSSZ') |
| void setExpirationDate | ( | Date | date | ) |
Sets the expiration date attribute of the key.
| date | Expiration date to be set. |
| void setExpirationDate | ( | byte[] | utcTime | ) |
Sets the expiration date attribute of the key.
| utcTime | time string ('YYMMDDHHMMSSZ') |
| Date getGenerationDate | ( | ) |
Returns the generation date attribute or null if the data attribute was not set.
| Date getExpirationDate | ( | ) |
Returns the expiration date attribute or null if the data attribute was not set.
| void setCertificate | ( | byte[] | cert | ) |
Sets a certificate for the key.
| cert | Optional certificate of the key. |
| void setMechs | ( | int[] | mechs | ) | throws CryptoServerException, UnsupportedEncodingException |
Sets an int array with mechanisms for a key.
| mechs | Key mechanisms int array. |
| UnsupportedEncodingException | |
| CryptoServerException |
| byte[] getMechs | ( | ) |
Returns a list of key mechanisms as byte array.
| void setFIPSUsage | ( | int | usage | ) |
Sets the fips key usage/padding specifier attribute.
| usage | FIPS Key usage/padding specifier attribute (see Usage / Padding Specifier for FIPS). |
| int getFIPSUsage | ( | ) |
Returns the fips key usage/padding specifier attribute.
|
static |
Static instance of CryptoServerLog that provides unified logging.
Initially the logging is disabled (log level is set to CryptoServerAPI.CryptoServerLog.LogLevel).
The application has to call CxiLog.init(...) with appropriate values to enable logging, e.g.: