Symmetric and asymmetric cryptographic hash operations.
Functions | |
byte[] | createHash (int nAlgId, byte[] hKey, int nFlags) throws TacException |
Creates a context for Hash calculation. | |
byte[] | createHash (int nAlgId) throws TacException |
Creates a context for calculating the hash. | |
byte[] | genEcdhKey (int dwOP, String szPriKey, byte[] pbInData) throws TacException |
It generates a shared secret/key using the ECDH (Elliptc Curve Diffie-Hellman) key-agreement protocol. | |
byte[] | genEcdhKeyX963 (int dwOP, String szPriKey, String szTargetKeyName, int dwTargetKeyAlg, int dwTargetKeyAttributes, byte[] pbPubKey, byte[] pbKDFData, int dwFlags) throws TacException |
Generates a shared secret/key using the ANSI X9.63 standard ECDH (Elliptc Curve Diffie-Hellman) key-agreement protocol. | |
byte[] | genEcdhKeyX963Sha256 (String szPriKey, String szTargetKeyName, int dwTargetKeyAlg, boolean isExportable, boolean isTemporary, byte[] pbPubKey, byte[] pbKDFData) throws TacException |
Generates a shared secret/key using the key-agreement protocol ECDH (Elliptc Curve Diffie-Hellman) standard ANSI X9.63 SHA256. | |
byte[] | getRand (int size) throws TacException |
Generates a pseudo-random buffer, generated in the HSM, for cryptographic use. | |
byte[] | encrypt (String strKeyId, byte[] byInput) throws TacException |
Encrypts a data buffer. | |
byte[] | encrypt (String strKeyId, byte[] byInput, int flags) throws TacException |
Encrypts a data buffer. | |
byte[] | encrypt (String strKeyId, byte[] byInput, byte[] byIV, int dwPadding, int dwMode) throws TacException |
Encrypts data. | |
byte[] | encrypt (String strKeyId, byte[] byInput, byte[] byIV, int dwPadding, int dwMode, int flags) throws TacException |
Encrypts data. | |
byte[] | decrypt (String keyId, byte[] input) throws TacException |
Decrypts data, often encrypted by the DEncrypt function. | |
byte[] | decrypt (String keyId, byte[] input, int flags) throws TacException |
Decrypts data, often encrypted by the DEncrypt function. | |
byte[] | decrypt (String keyId, byte[] input, byte[] byIV, int dwPadding, int dwMode) throws TacException |
Decrypts data, often encrypted by the DEncrypt function. | |
byte[] | decrypt (String keyId, byte[] input, byte[] byIV, int dwPadding, int dwMode, int flags) throws TacException |
Decrypts data, often encrypted by the DEncrypt function. | |
int | verifySignature (String keyId, int algHash, byte[] bSignature, byte[] bMessage) throws TacException |
Check a message. | |
int | verifySignature (String keyId, int algHash, int padding, byte[] bSignature, byte[] bMessage) throws TacException |
Check a message. | |
int | verifySignature (byte[] hPublicKey, byte[] hHash, byte[] bSignature) throws TacException |
Check a message. | |
int | verifySignature (byte[] hPublicKey, int hashAlg, byte[] bSignature, byte[] bMessage) throws TacException |
Check a message. | |
byte[] | signHash (String keyId, int algHash, byte[] bMessage) throws TacException |
Signs a piece of data based on its content. | |
byte[] | sign (String keyId, int algHash, byte[] bMessage) throws TacException |
Signs a piece of data based on its content. | |
byte[] | sign (String keyId, int algHash, int padding, byte[] bMessage) throws TacException |
Signs a piece of data based on its content. | |
byte[] | signHashedData (String keyId, int algHash, byte[] bHash) throws TacException |
Signs a piece of data based on its previously computed hash. | |
byte[] | signHashedData (String keyId, int algHash, byte[] bHash, boolean useOID) throws TacException |
Signs a piece of data based on its previously computed hash. | |
byte[] | signHashedData (String keyId, int algHash, byte[] bHash, int nFlags) throws TacException |
Signs a piece of data based on its previously computed hash. | |
byte[] | signHashedData (byte[] privateKeyHandle, int algHash, byte[] bHash, int nFlags) throws TacException |
Signs a piece of data based on its previously computed hash. | |
byte[] | generateHash (int algId, int flags, byte[] data) throws TacException |
Generates a hash in just one call. | |
byte[] | generateHash (int algId, byte[] data) throws TacException |
Generates a hash in just one call. | |
void | initHash (int algId, int flags) throws TacException |
Initializes a piecewise hash operation. | |
void | initHash (int algId) throws TacException |
Initializes a piecewise hash operation. | |
void | updateHash (byte[] data) throws TacException |
Updates a hash operation with more data. | |
byte[] | endHash () throws TacException |
Finalizes a hash operation. | |
byte[] | generateMAC (int algId, String macKey, int flags, byte[] data) throws TacException |
Generates a MAC in just one call. | |
byte[] | generateMAC (int algId, String macKey, byte[] data) throws TacException |
Generates a MAC in just one call. | |
void | initMAC (int algId, String macKey, int flags) throws TacException |
Initializes a MAC operation in parts. | |
void | initMAC (int algId, String macKey) throws TacException |
Initializes a MAC operation in parts. | |
void | updateMAC (byte[] data) throws TacException |
Updates a MAC operation with more data. | |
byte[] | endMAC () throws TacException |
Ends a MAC operation. | |
byte[] createHash | ( | int | nAlgId, |
byte[] | hKey, | ||
int | nFlags ) throws TacException |
Creates a context for Hash calculation.
nAlgId | Identifier of the algorithm to be used |
hKey | Key context to be used |
nFlags |
TacException |
byte[] createHash | ( | int | nAlgId | ) | throws TacException |
Creates a context for calculating the hash.
nAlgId | Indicates the algorithm associated with the hash context.
|
TacException |
byte[] genEcdhKey | ( | int | dwOP, |
String | szPriKey, | ||
byte[] | pbInData ) throws TacException |
It generates a shared secret/key using the ECDH (Elliptc Curve Diffie-Hellman) key-agreement protocol.
dwOP | Indicates the algorithm associated with the hash context.
| ||||
szPriKey | String containing the identifier of the private key within the HSM. This identifier must not contain spaces or special characters. Uppercase and lowercase characters are case sensitive. | ||||
pbInData | Function input data. Must be filled in as described in the dwOP options. |
TacException |
byte[] genEcdhKeyX963 | ( | int | dwOP, |
String | szPriKey, | ||
String | szTargetKeyName, | ||
int | dwTargetKeyAlg, | ||
int | dwTargetKeyAttributes, | ||
byte[] | pbPubKey, | ||
byte[] | pbKDFData, | ||
int | dwFlags ) throws TacException |
Generates a shared secret/key using the ANSI X9.63 standard ECDH (Elliptc Curve Diffie-Hellman) key-agreement protocol.
dwOP | Indicates the algorithm used.
| ||||
szPriKey | Identifier of the private key within the HSM. | ||||
szTargetKeyName | Identifier of the key that will be generated in the HSM. Only alphanumeric characters and underline '_' with a maximum length of TacNDJavaLib.MAX_OBJ_ID. Uppercase and lowercase characters are case sensitive. This parameter can be null if you want the contents of the generated key to be returned by the method. | ||||
dwTargetKeyAlg | Algorithm of the key that will be generated in the HSM. See options in the createKey method. | ||||
dwTargetKeyAttributes | Additional parameters of the key that will be generated in the HSM. See createKey. | ||||
pbPubKey | The other party's public key, in DER format. The maximum size of the pbPubKey and pbKDFData buffers together must not exceed TacNDJavaLib.DN_ECDH_GEN_KEY_MAX_DATA. | ||||
pbKDFData | Data that will be used to derive the key. The maximum size of the pbPubKey and pbKDFData buffers together must not exceed TacNDJavaLib.DN_ECDH_GEN_KEY_MAX_DATA. | ||||
dwFlags | Reserved for future use. You must pass 0. |
TacException |
byte[] genEcdhKeyX963Sha256 | ( | String | szPriKey, |
String | szTargetKeyName, | ||
int | dwTargetKeyAlg, | ||
boolean | isExportable, | ||
boolean | isTemporary, | ||
byte[] | pbPubKey, | ||
byte[] | pbKDFData ) throws TacException |
Generates a shared secret/key using the key-agreement protocol ECDH (Elliptc Curve Diffie-Hellman) standard ANSI X9.63 SHA256.
szPriKey | Identifier of the private key within the HSM. |
szTargetKeyName | Identifier of the key that will be generated in the HSM. Only alphanumeric characters and underline '_' with a maximum length of TacNDJavaLib.MAX_OBJ_ID. Uppercase and lowercase characters are case sensitive. This parameter can be null if you want the contents of the generated key to be returned by the method. |
dwTargetKeyAlg | Algorithm of the key that will be generated in the HSM. See options in the createKey method. |
isTemporary | Informs whether the key, which will be generated in the HSM, is temporary. |
isExportable | Informs whether the key, which will be generated in the HSM, is exportable. |
pbPubKey | The other party's public key, in DER format. The maximum size of the pbPubKey and pbKDFData buffers together must not exceed TacNDJavaLib.DN_ECDH_GEN_KEY_MAX_DATA. |
pbKDFData | Data that will be used to derive the key. The maximum size of the pbPubKey and pbKDFData buffers together must not exceed TacNDJavaLib.DN_ECDH_GEN_KEY_MAX_DATA. |
TacException |
byte[] getRand | ( | int | size | ) | throws TacException |
Generates a pseudo-random buffer, generated in the HSM, for cryptographic use.
size | Size of the buffer that will be generated. |
TacException |
byte[] encrypt | ( | String | strKeyId, |
byte[] | byInput ) throws TacException |
Encrypts a data buffer.
strKeyId | Key identifier. |
byInput | Buffer containing the data to be encrypted. |
TacException |
byte[] encrypt | ( | String | strKeyId, |
byte[] | byInput, | ||
int | flags ) throws TacException |
Encrypts a data buffer.
strKeyId | Key identifier. | ||||||
byInput | Buffer containing the data to be encrypted. | ||||||
flags | Indicates additional options for operation.
|
TacException |
byte[] encrypt | ( | String | strKeyId, |
byte[] | byInput, | ||
byte[] | byIV, | ||
int | dwPadding, | ||
int | dwMode ) throws TacException |
Encrypts data.
strKeyId | Key identifier. | ||||||||||||||
byInput | Buffer containing the data to be encrypted. | ||||||||||||||
byIV | Buffer containing the IV(Initialization Vector). Can be passed null to Not used or use the default. Initialization vector used with blockchain algorithms according to their symmetric encryption mode of operation. The size of the initialization vector depends on the symmetric algorithm used, since it has the same length as the block operation. Only valid for symmetric keys. | ||||||||||||||
dwPadding | The library can work with the following forms of padding.
Only valid for symmetric keys. | ||||||||||||||
dwMode | Indicates the encryption operating mode of the block algorithm.
Only valid for symmetric keys and block algorithms. |
TacException |
byte[] encrypt | ( | String | strKeyId, |
byte[] | byInput, | ||
byte[] | byIV, | ||
int | dwPadding, | ||
int | dwMode, | ||
int | flags ) throws TacException |
Encrypts data.
strKeyId | Key identifier. | ||||||||||||||
byInput | Buffer containing the data to be encrypted. | ||||||||||||||
byIV | Buffer containing the IV(Initialization Vector). Can be passed null to Not used or use the default. Initialization vector used with blockchain algorithms according to their symmetric encryption mode of operation. The size of the initialization vector depends on the symmetric algorithm used, since it has the same length as the block operation. Only valid for symmetric keys. | ||||||||||||||
dwPadding | The library can work with the following forms of padding.
Only valid for symmetric keys. | ||||||||||||||
dwMode | Indicates the encryption operating mode of the block algorithm.
Only valid for symmetric keys and block algorithms. | ||||||||||||||
flags | Indicates additional options for operation.
|
TacException |
byte[] decrypt | ( | String | keyId, |
byte[] | input ) throws TacException |
Decrypts data, often encrypted by the DEncrypt function.
keyId | Key identifier. |
input | Buffer containing the data to be decrypted. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. |
TacException |
byte[] decrypt | ( | String | keyId, |
byte[] | input, | ||
int | flags ) throws TacException |
Decrypts data, often encrypted by the DEncrypt function.
keyId | Key identifier. | ||||||
input | Buffer containing the data to be decrypted. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. | ||||||
flags | Indicates additional options for operation.
|
TacException |
byte[] decrypt | ( | String | keyId, |
byte[] | input, | ||
byte[] | byIV, | ||
int | dwPadding, | ||
int | dwMode ) throws TacException |
Decrypts data, often encrypted by the DEncrypt function.
keyId | Key identifier. | ||||||||||||||
input | Buffer containing the data to be decrypted. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. | ||||||||||||||
byIV | Buffer containing the IV(Initialization Vector). Can be passed null to Not used or use the default. Initialization vector used with blockchain algorithms according to their symmetric encryption mode of operation. The size of the initialization vector depends on the symmetric algorithm used, since it has the same length as the block operation. Only valid for symmetric keys. | ||||||||||||||
dwPadding | The library can work with the following forms of padding.
Only valid for symmetric keys. | ||||||||||||||
dwMode | Indicates the encryption operating mode of the block algorithm.
Only valid for symmetric keys and block algorithms. |
TacException |
byte[] decrypt | ( | String | keyId, |
byte[] | input, | ||
byte[] | byIV, | ||
int | dwPadding, | ||
int | dwMode, | ||
int | flags ) throws TacException |
Decrypts data, often encrypted by the DEncrypt function.
keyId | Key identifier. | ||||||||||||||
input | Buffer containing the data to be decrypted. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. | ||||||||||||||
byIV | Buffer containing the IV(Initialization Vector). Can be passed null to Not used or use the default. Initialization vector used with blockchain algorithms according to their symmetric encryption mode of operation. The size of the initialization vector depends on the symmetric algorithm used, since it has the same length as the block operation. Only valid for symmetric keys. | ||||||||||||||
dwPadding | The library can work with the following forms of padding.
Only valid for symmetric keys. | ||||||||||||||
dwMode | Indicates the encryption operating mode of the block algorithm.
Only valid for symmetric keys and block algorithms. | ||||||||||||||
flags | Indicates additional options for operation.
|
TacException |
int verifySignature | ( | String | keyId, |
int | algHash, | ||
byte[] | bSignature, | ||
byte[] | bMessage ) throws TacException |
Check a message.
Uses PKCS#1 padding.
keyId | Identifier of the private key from which the public key will be extracted for verification. |
algHash | Hash algorithm used to verify the signature. See options in initHash(). |
bSignature | Signature. |
bMessage | Message for signature verification. |
TacException |
int verifySignature | ( | String | keyId, |
int | algHash, | ||
int | padding, | ||
byte[] | bSignature, | ||
byte[] | bMessage ) throws TacException |
Check a message.
keyId | Identifier of the private key from which the public key will be extracted for verification. |
algHash | Hash algorithm used to verify the signature. See options in initHash(). |
padding | Padding used in the signature. See options in setPadding(). |
bSignature | Signature. |
bMessage | Message for signature verification. |
TacException |
int verifySignature | ( | byte[] | hPublicKey, |
byte[] | hHash, | ||
byte[] | bSignature ) throws TacException |
Check a message.
hPublicKey | Handle of the public key. importKey(). |
hHash | Handle of the message hash. See initHash(). |
bSignature | Signature. |
TacException |
int verifySignature | ( | byte[] | hPublicKey, |
int | hashAlg, | ||
byte[] | bSignature, | ||
byte[] | bMessage ) throws TacException |
Check a message.
hPublicKey | Handle of the public key. See importKey(). |
hashAlg | Hash algorithm. See options in initHash(). |
bSignature | Signature. |
bMessage | Message for signature verification. |
TacException |
byte[] signHash | ( | String | keyId, |
int | algHash, | ||
byte[] | bMessage ) throws TacException |
Signs a piece of data based on its content.
keyId | Private key identifier. |
algHash | Hash algorithm used in the signature. See options in initHash(). |
bMessage | Message. |
TacException |
byte[] sign | ( | String | keyId, |
int | algHash, | ||
byte[] | bMessage ) throws TacException |
Signs a piece of data based on its content.
Uses standard padding.
keyId | Private key identifier. |
algHash | Hash algorithm used in the signature. See options in initHash(). |
bMessage | Message. |
TacException |
byte[] sign | ( | String | keyId, |
int | algHash, | ||
int | padding, | ||
byte[] | bMessage ) throws TacException |
Signs a piece of data based on its content.
keyId | Private key identifier. |
algHash | Hash algorithm used in the signature. See options in initHash(). |
padding | Padding used in the signature. See options in setPadding(). |
bMessage | Message. |
TacException |
byte[] signHashedData | ( | String | keyId, |
int | algHash, | ||
byte[] | bHash ) throws TacException |
Signs a piece of data based on its previously computed hash.
keyId | Private key identifier. | ||||||||||||||||||||||||||
algHash | Hash algorithm used in the signature.
| ||||||||||||||||||||||||||
bHash | Previously computed hash of the message according to the algorithm defined in algHash. |
TacException |
byte[] signHashedData | ( | String | keyId, |
int | algHash, | ||
byte[] | bHash, | ||
boolean | useOID ) throws TacException |
Signs a piece of data based on its previously computed hash.
keyId | Private key identifier. | ||||||||||||||||||||||||||
algHash | Hash algorithm used in the signature.
| ||||||||||||||||||||||||||
bHash | Previously computed hash of the message according to the algorithm defined in algHash. | ||||||||||||||||||||||||||
useOID | When this argument is set to false, the object identifier (OID) is not placed in front of the hash value, as provided for in PKCS#7, DigestInfo attribute. |
TacException |
byte[] signHashedData | ( | String | keyId, |
int | algHash, | ||
byte[] | bHash, | ||
int | nFlags ) throws TacException |
Signs a piece of data based on its previously computed hash.
keyId | Private key identifier. | ||||||||||||||||||||||||||
algHash | Hash algorithm used in the signature.
| ||||||||||||||||||||||||||
bHash | Previously computed hash of the message according to the algorithm defined in algHash. | ||||||||||||||||||||||||||
nFlags | You must pass 0 or some modifier defined in the list below.
|
TacException |
byte[] signHashedData | ( | byte[] | privateKeyHandle, |
int | algHash, | ||
byte[] | bHash, | ||
int | nFlags ) throws TacException |
Signs a piece of data based on its previously computed hash.
privateKeyHandle | Handle of the private key. Retrieved by the getKeyHandle() method. | ||||||||||||||||||||||||||
algHash | Hash algorithm used in the signature.
| ||||||||||||||||||||||||||
bHash | Previously computed hash of the message according to the algorithm defined in algHash. | ||||||||||||||||||||||||||
nFlags | You must pass 0 or some modifier defined in the list below.
|
TacException |
byte[] generateHash | ( | int | algId, |
int | flags, | ||
byte[] | data ) throws TacException |
Generates a hash in just one call.
algId | Indicates the HASH algorithm.
| ||||||||||||||||||||||||||
flags | Zero must be spent. | ||||||||||||||||||||||||||
data | Message. |
TacException |
byte[] generateHash | ( | int | algId, |
byte[] | data ) throws TacException |
Generates a hash in just one call.
algId | Indicates the HASH algorithm.
| ||||||||||||||||||||||||||
data | Message. |
TacException |
void initHash | ( | int | algId, |
int | flags ) throws TacException |
Initializes a piecewise hash operation.
It must be finalized with endHash.
algId | Indicates the HASH algorithm.
| ||||||||||||||||||||||||||
flags | Zero must be spent. |
TacException |
void initHash | ( | int | algId | ) | throws TacException |
Initializes a piecewise hash operation.
It must be finalized with endHash.
algId | Indicates the HASH algorithm.
|
TacException |
void updateHash | ( | byte[] | data | ) | throws TacException |
Updates a hash operation with more data.
data | Message. |
TacException |
byte[] endHash | ( | ) | throws TacException |
Finalizes a hash operation.
TacException |
byte[] generateMAC | ( | int | algId, |
String | macKey, | ||
int | flags, | ||
byte[] | data ) throws TacException |
Generates a MAC in just one call.
algId | Indicates the MAC algorithm.
| ||||||||||||||||
macKey | MAC key name. | ||||||||||||||||
flags | Zero must be spent. | ||||||||||||||||
data | Message. |
TacException |
byte[] generateMAC | ( | int | algId, |
String | macKey, | ||
byte[] | data ) throws TacException |
Generates a MAC in just one call.
algId | Indicates the MAC algorithm.
| ||||||||||||||||
macKey | MAC key name. | ||||||||||||||||
data | Message. |
TacException |
void initMAC | ( | int | algId, |
String | macKey, | ||
int | flags ) throws TacException |
Initializes a MAC operation in parts.
It must be finalized with endMAC.
algId | Indicates the MAC algorithm.
| ||||||||||||||||
macKey | MAC key name. | ||||||||||||||||
flags | Zero must be spent. |
TacException |
void initMAC | ( | int | algId, |
String | macKey ) throws TacException |
Initializes a MAC operation in parts.
It must be finalized with endMAC.
algId | Indicates the MAC algorithm.
| ||||||||||||||||
macKey | MAC key name. |
TacException |
void updateMAC | ( | byte[] | data | ) | throws TacException |
Updates a MAC operation with more data.
data | Message. |
TacException |
byte[] endMAC | ( | ) | throws TacException |
Ends a MAC operation.
TacException |