Symmetric and asymmetric cryptographic hash operations.
Functions | |
void | Encrypt (IntPtr hKey, bool Final, byte[] byData, ref int DataLen, int BufferLen) |
Encrypt blocks or files by passing the key reference. Uses the default mode/padding, i.e. MODE CBC and padding PKCS#5. | |
void | Encrypt (String strKeyId, byte[] byData) |
Encrypts a block in ECB mode without any padding. This function is useful for PIN BLOCK. The size of the data array must be compatible with the type of key. | |
byte[] | EncryptDefault (String strKeyId, byte[] byData) |
Encrypts a block using the standard HSM parameterization. | |
void | Encrypt (string strKeyId, IntPtr hHash, bool Final, byte[] iv, MODE_TYPE mode, PADDING_TYPE padding, byte[] byData, ref int DataLen, int BufferLen) |
Encrypts a hash, general data or a file. | |
void | Encrypt (IntPtr hKey, IntPtr hHash, bool Final, int dwFlags, byte[] iv, MODE_TYPE mode, PADDING_TYPE padding, byte[] byData, ref int DataLen, int BufferLen) |
Encrypts a hash, general data or a file. | |
void | EncryptDefault (IntPtr hKey, IntPtr hHash, bool Final, int dwFlags, byte[] iv, byte[] byData, ref int DataLen, int BufferLen) |
Encrypts using the standard HSM parameterization. | |
int | GetEncryptBuffLen (IntPtr hKey, IntPtr hHash, int DataLen) |
Returns the size of the encryption buffer. | |
byte[] | KEKEncode (String strKeyId, byte[] byKey) |
Encrypts a symmetric key that is outside the HSM using an RSA inside the HSM. | |
byte[] | KEKDecode (String strKeyId, byte[] byKey) |
Decrypts a symmetric key that is outside the HSM using an RSA inside the HSM. | |
void | Decrypt (string strKeyId, IntPtr hHash, bool Final, byte[] byData, ref int DataLen) |
Decrypts a hash, general data or a file. | |
void | Decrypt (IntPtr hKey, IntPtr hHash, bool Final, byte[] byData, ref int DataLen) |
Decrypts a hash, general data or a file. | |
void | Decrypt (string strKeyId, byte[] byData) |
Decrypts a block in ECB mode without any padding. This function is useful for PIN BLOCK. The size of the data array must be compatible with the type of key. | |
byte[] | DecryptDefault (string strKeyId, byte[] byData) |
Decrypts a block using the standard HSM parameterization. | |
void | Decrypt (string strKeyId, IntPtr hHash, bool Final, byte[] iv, MODE_TYPE mode, PADDING_TYPE padding, byte[] byData, ref int DataLen) |
Decrypts a hash, general data or a file. | |
void | Decrypt (IntPtr hKey, IntPtr hHash, bool Final, int dwFlags, byte[] iv, MODE_TYPE mode, PADDING_TYPE padding, byte[] byData, ref int DataLen) |
Decrypts a hash, general data or a file. | |
void | DecryptDefault (IntPtr hKey, IntPtr hHash, bool Final, int dwFlags, byte[] iv, byte[] byData, ref int DataLen) |
Decrypted using the standard HSM parameterization. | |
IntPtr | CreateHash(HASH_ALG AlgId) |
Creates a handle for a hash. | |
byte[] | generateHash(HASH_ALG AlgId, byte[] Data, int Flags) |
Generates a HASH in just one call. | |
byte[] | generateHash(HASH_ALG AlgId, byte[] Data) |
Generates a HASH in just one call. | |
byte[] | generateMAC(HASH_ALG AlgId, String KeyId, byte[] Data, int Flags) |
Generates a MAC in just one call. | |
byte[] | generateMAC(HASH_ALG AlgId, String KeyId, byte[] Data) |
Generates a MAC in just one call. | |
void | initMAC(HASH_ALG AlgId, String KeyId, int Flags) |
Initializes a MAC operation in parts. It must be finalized with endMAC. | |
void | initMAC(HASH_ALG AlgId, String KeyId) |
Initializes a MAC operation in parts. It must be finalized with endMAC. | |
void | updateMAC (byte[] Data) |
Updates a MAC operation with more data. | |
byte[] | endMAC () |
Ends a MAC operation. | |
void | initHash(HASH_ALG AlgId, int Flags) |
Initializes a HASH operation in parts. It must be finalized with endHash. | |
void | initHash(HASH_ALG AlgId) |
Initializes a HASH operation in parts. It must be finalized with endHash. | |
void | updateHash (byte[] Data) |
Updates a HASH operation with more data. | |
byte[] | endHash () |
Ends a HASH operation. | |
void | HashData (IntPtr hHash, byte[] byData) |
Finds the hash for a piece of data and associates it with the hash handle. | |
byte[] | Hash(HASH_ALG alg, byte[] data) |
Returns the hash of a piece of data. | |
void | DestroyHash (IntPtr hHash) |
Releases the handle of the hash resource. | |
void | BatchSign (string strKeyId, byte[] pbBlock, Int32 dwBlockCount, Int32 dwFlags) |
Sends a batch of blocks for signature in the HSM. | |
void | BatchSign (IntPtr hPrivateKey, byte[] pbBlock, Int32 dwBlockCount, Int32 dwFlags) |
Sends a batch of blocks for signature in the HSM. | |
byte[] | SignHash (String keyId, byte[] bHash, DinamoClient.HASH_ALG algHash) |
Sign a hash. | |
byte[] | SignHash (String keyId, byte[] bHash, DinamoClient.HASH_ALG algHash, Int32 dwFlags) |
Sign a hash. | |
byte[] | SignHash (String keyId, IntPtr pHash, DinamoClient.HASH_ALG algHash) |
byte[] | SignHash (IntPtr hPrivateKey, IntPtr hHash) |
Sign a hash. | |
byte[] | SignHash (IntPtr hPrivateKey, IntPtr hHash, int dwFlags) |
Sign a hash. | |
bool | VerifySignature (IntPtr hHash, IntPtr hPublicKey, byte[] bySignature) |
Check a signature. | |
void | SetHashValue (IntPtr hHash, byte[] Value) |
Stores a hash. | |
byte[] | GetHashValue (IntPtr hHash) |
Returns the hash value. | |
byte[] | GetRandom (Int32 dwReturnLen) |
Returns a random number from the HSM generator. | |
DinamoApi.DN_M_OF_N_SPLIT_INFO | MofNSplit (byte bM, byte bN, byte[] pbSecret) |
Divides M from N in a secret. According to Shamir's secret sharing pattern. | |
byte[] | MofNRecover(DinamoApi.DN_M_OF_N_PART[] parts) |
Reconstructs the secret M of N from the parts of the custodians. According to Shamir's secret sharing pattern. | |
|
inline |
Encrypt blocks or files by passing the key reference. Uses the default mode/padding, i.e. MODE CBC and padding PKCS#5.
hKey | Key handle |
Final | Indicates whether the block is the last |
byData | Data to be encrypted. When the function returns, the original data is overwritten by the result of the encryption operation. The buffer size is specified by the dwBufLen parameter, the number of bytes to be processed is specified by the pdwDataLen parameter. The buffer size must be large enough to contain the encrypted data plus padding. |
DataLen | Block size.When input parameter, contains the number of bytes that will be processed, when output parameter, contains the number of bytes of encrypted data.If the allocated buffer is not enough to receive all the encrypted data (lack of padding space, for example) the function will fail returning D_MORE_DATA. |
BufferLen | Buffer size: For symmetric operations that require padding, the buffer must be at least the length of the data plus the size of the operation block of the algorithm to be used. |
DinamoException | Throws exception in case of error. |
|
inline |
Encrypts a block in ECB mode without any padding. This function is useful for PIN BLOCK. The size of the data array must be compatible with the type of key.
strKeyId | Key reference |
byData | Data to be encrypted. When the function returns, the original data is overwritten by the result of the encryption operation. The buffer size is specified by the dwBufLen parameter, the number of bytes to be processed is specified by the pdwDataLen parameter. The buffer size must be large enough to contain the encrypted data plus padding. |
DinamoException | Throws exception in case of error. |
|
inline |
Encrypts a block using the standard HSM parameterization.
For symmetric keys: MODE_CBC: Cipher Block Chain (CBC) PKCS5_PADDING: Padding is done following the pattern defined in PKCS#5. IV: Filled with zeros.
For RSA asymmetric keys: PKCS1_PADDING: PKCS#1 v1.5 padding is used.
strKeyId | Key reference |
byData | Data to be encrypted. |
DinamoException | Throws exception in case of error. |
|
inline |
Encrypts a hash, general data or a file.
strKeyId | Key reference | ||||||||||||||
hHash | Pointer to a hash | ||||||||||||||
Final | Indicates whether the block is the last | ||||||||||||||
iv | Initialization vector used with block 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. More details in the Remarks section. Only valid for symmetric keys. | ||||||||||||||
mode | Indicates the encryption operating mode of the block algorithm.
| ||||||||||||||
padding | The library can work with 3 forms of symmetrical padding:
| ||||||||||||||
byData | Data to be encrypted. When the function returns, the original data is overwritten by the result of the encryption operation. The buffer size is specified by the dwBufLen parameter, the number of bytes to be processed is specified by the pdwDataLen parameter. The buffer size must be large enough to contain the encrypted data plus padding. | ||||||||||||||
DataLen | Block size.When input parameter, contains the number of bytes that will be processed, when output parameter, contains the number of bytes of encrypted data.If the allocated buffer is not enough to receive all the encrypted data (lack of padding space, for example) the function will fail returning D_MORE_DATA. | ||||||||||||||
BufferLen | Buffer size: For symmetric operations that require padding, the buffer must be at least the length of the data plus the size of the operation block of the algorithm to be used. |
DinamoException | Throws exception in case of error. |
|
inline |
Encrypts a hash, general data or a file.
hKey | Key context | ||||||||||||||
hHash | Pointer to a hash | ||||||||||||||
Final | Indicates whether the block is the last | ||||||||||||||
dwFlags | Reserved for future use (must be 0). | ||||||||||||||
iv | Initialization vector used with block 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. More details in the Remarks section. Only valid for symmetric keys. | ||||||||||||||
mode | Indicates the encryption operating mode of the block algorithm.
| ||||||||||||||
padding | The library can work with 3 forms of symmetrical padding:
| ||||||||||||||
byData | Data to be encrypted. When the function returns, the original data is overwritten by the result of the encryption operation. The buffer size is specified by the dwBufLen parameter, the number of bytes to be processed is specified by the pdwDataLen parameter. The buffer size must be large enough to contain the encrypted data plus padding. | ||||||||||||||
DataLen | Block size. When input parameter, contains the number of bytes that will be processed, when output parameter, contains the number of bytes of encrypted data.If the allocated buffer is not enough to receive all the encrypted data (lack of space for padding, for example) the function will fail returning D_MORE_DATA. | ||||||||||||||
BufferLen | Buffer size: For symmetric operations that require padding, the buffer must be at least the length of the data plus the size of the operation block of the algorithm to be used. |
DinamoException | Throws exception in case of error. |
|
inline |
Encrypts using the standard HSM parameterization.
For symmetric keys: MODE_CBC: Cipher Block Chain (CBC) PKCS5_PADDING: Padding is done following the pattern defined in PKCS#5.
For RSA asymmetric keys: PKCS1_PADDING: PKCS#1 v1.5 padding is used.
hKey | Key context |
hHash | Pointer to a hash |
Final | Indicates whether the block is the last |
dwFlags | Reserved for future use (must be 0). |
iv | Initialization vector used with block 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. More details in the Remarks section. Only valid for symmetric keys. If null is passed, the zero-filled IV will be used. |
byData | Data to be encrypted. When the function returns, the original data is overwritten by the result of the encryption operation. The buffer size is specified by the dwBufLen parameter, the number of bytes to be processed is specified by the pdwDataLen parameter. The buffer size must be large enough to contain the encrypted data plus padding. |
DataLen | Block size. When input parameter, contains the number of bytes that will be processed, when output parameter, contains the number of bytes of encrypted data.If the allocated buffer is not enough to receive all the encrypted data (lack of space for padding, for example) the function will fail returning D_MORE_DATA. |
BufferLen | Buffer size: For symmetric operations that require padding, the buffer must be at least the length of the data plus the size of the operation block of the algorithm to be used. |
DinamoException | Throws exception in case of error. |
|
inline |
Returns the size of the encryption buffer.
hKey | Key context |
hHash | Pointer to a hash |
DataLen | Size of the data to be encrypted |
DinamoException | Throws exception in case of error. |
|
inline |
Encrypts a symmetric key that is outside the HSM using an RSA inside the HSM.
strKeyId | RSA Key Identification |
byKey | Content of the symmetric key |
DinamoException | Throws exception in case of error. |
|
inline |
Decrypts a symmetric key that is outside the HSM using an RSA inside the HSM.
strKeyId | RSA Key Identification |
byKey | Content of the encrypted symmetric key |
DinamoException | Throws exception in case of error. |
|
inline |
Decrypts a hash, general data or a file.
strKeyId | Key reference |
hHash | Pointer to a hash |
Final | Indicates whether the block is the last |
byData | Buffer containing the data to be decrypted. When the function returns, the original data is overwritten by the result of the encryption operation. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. |
DataLen | Returns the size of the data in byData. When input parameter, contains the number of bytes to be processed, when output parameter, contains the number of bytes of data in clear text. |
DinamoException | Throws exception in case of error. |
|
inline |
Decrypts a hash, general data or a file.
hKey | Key context |
hHash | Pointer to a hash |
Final | Indicates whether the block is the last |
byData | Buffer containing the data to be decrypted. When the function returns, the original data is overwritten by the result of the encryption operation. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. |
DataLen | Returns the size of the data in byData. When input parameter, contains the number of bytes to be processed, when output parameter, contains the number of bytes of data in clear text. |
DinamoException | Throws exception in case of error. |
|
inline |
Decrypts a block in ECB mode without any padding. This function is useful for PIN BLOCK. The size of the data array must be compatible with the type of key.
strKeyId | Key reference |
byData | Data buffer |
DinamoException | Throws exception in case of error. |
|
inline |
Decrypts a block using the standard HSM parameterization.
For symmetric keys: MODE_CBC: Cipher Block Chain (CBC) PKCS5_PADDING: Padding is done following the pattern defined in PKCS#5. IV: Filled with zeros.
For RSA asymmetric keys: PKCS1_PADDING: PKCS#1 v1.5 padding is used.
strKeyId | Key reference |
byData | Data buffer |
DinamoException | Throws exception in case of error. |
|
inline |
Decrypts a hash, general data or a file.
strKeyId | Key reference | ||||||||||||||
hHash | Pointer to a hash | ||||||||||||||
Final | Indicates whether the block is the last | ||||||||||||||
iv | Initialization vector used with block 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. More details in the Remarks section. Only valid for symmetric keys. | ||||||||||||||
mode | Indicates the encryption operating mode of the block algorithm.
| ||||||||||||||
padding | The library can work with 3 forms of symmetrical padding:
| ||||||||||||||
byData | Buffer containing the data to be decrypted. When the function returns, the original data is overwritten by the result of the encryption operation. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. | ||||||||||||||
DataLen | Returns the size of the data in byData. When input parameter, contains the number of bytes to be processed, when output parameter, contains the number of bytes of data in clear text. |
DinamoException | Throws exception in case of error. |
|
inline |
Decrypts a hash, general data or a file.
hKey | Key connection | ||||||||||||||
hHash | Pointer to a hash | ||||||||||||||
Final | Indicates whether the block is the last | ||||||||||||||
dwFlags | Reserved for future use (must be 0). | ||||||||||||||
iv | Initialization vector used with block 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. More details in the Remarks section. Only valid for symmetric keys. | ||||||||||||||
mode | Indicates the encryption operating mode of the block algorithm.
| ||||||||||||||
padding | The library can work with 3 forms of symmetrical padding:
| ||||||||||||||
byData | Buffer containing the data to be decrypted. When the function returns, the original data is overwritten by the result of the encryption operation. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. | ||||||||||||||
DataLen | Returns the size of the data in byData. When input parameter, contains the number of bytes to be processed, when output parameter, contains the number of bytes of data in clear text. |
DinamoException | Throws exception in case of error. |
|
inline |
Decrypted using the standard HSM parameterization.
For symmetric keys: MODE_CBC: Cipher Block Chain (CBC) PKCS5_PADDING: Padding is done following the pattern defined in PKCS#5.
For RSA asymmetric keys: PKCS1_PADDING: PKCS#1 v1.5 padding is used.
hKey | Key connection |
hHash | Pointer to a hash |
Final | Indicates whether the block is the last |
dwFlags | Reserved for future use (must be 0). |
iv | Initialization vector used with block 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. More details in the Remarks section. Only valid for symmetric keys. If null is passed, the zero-filled IV will be used. |
byData | Buffer containing the data to be decrypted. When the function returns, the original data is overwritten by the result of the encryption operation. For block symmetric operations, the size of the data must always be a multiple of the block used by the algorithm in question. |
DataLen | Returns the size of the data in byData. When input parameter, contains the number of bytes to be processed, when output parameter, contains the number of bytes of data in clear text. |
DinamoException | Throws exception in case of error. |
|
inline |
Creates a handle for a hash.
AlgId | Hash algorithm |
DinamoException | Throws exception in case of error. |
|
inline |
Generates a HASH in just one call.
AlgId | Hash algorithm |
Data | Message |
Flags | Zero must be passed |
DinamoException | Throws exception in case of error. |
|
inline |
Generates a HASH in just one call.
AlgId | Hash algorithm |
Data | Message |
DinamoException | Throws exception in case of error. |
|
inline |
Generates a MAC in just one call.
AlgId | Hash algorithm |
KeyId | MAC key name |
Data | Message |
Flags | Zero should be passed |
DinamoException | Throws exception in case of error. |
|
inline |
Generates a MAC in just one call.
AlgId | Hash algorithm |
KeyId | MAC key name |
Data | Message |
DinamoException | Throws exception in case of error. |
|
inline |
Initializes a MAC operation in parts. It must be finalized with endMAC.
AlgId | Hash algorithm |
KeyId | MAC key name |
Flags | Zero must be passed |
DinamoException | Throws exception in case of error. |
|
inline |
Initializes a MAC operation in parts. It must be finalized with endMAC.
AlgId | Hash algorithm |
KeyId | MAC key name |
DinamoException | Throws exception in case of error. |
|
inline |
Updates a MAC operation with more data.
Data | Message |
DinamoException | Throws exception in case of error. |
|
inline |
Ends a MAC operation.
DinamoException | Throws exception in case of error. |
|
inline |
Initializes a HASH operation in parts. It must be finalized with endHash.
AlgId | Hash algorithm |
Flags | Zero must be passed |
DinamoException | Throws exception in case of error. |
|
inline |
Initializes a HASH operation in parts. It must be finalized with endHash.
AlgId | Hash algorithm |
DinamoException | Throws exception in case of error. |
|
inline |
Updates a HASH operation with more data.
Data | Message |
DinamoException | Throws exception in case of error. |
|
inline |
Ends a HASH operation.
DinamoException | Throws exception in case of error. |
|
inline |
Finds the hash for a piece of data and associates it with the hash handle.
hHash | IntPtr Pointer to hash resource |
byData | Data in bytes |
DinamoException | Throws exception in case of error. |
|
inline |
Returns the hash of a piece of data.
alg | Hash algorithm |
data | Data in bytes |
DinamoException | Throws exception in case of error. |
|
inline |
Releases the handle of the hash resource.
hHash | IntPtr Pointer to hash resource |
DinamoException | Throws exception in case of error. |
|
inline |
Sends a batch of blocks for signature in the HSM.
strKeyId | Key name. |
pbBlock | Byte array containing the blocks that will be signed concatenated and with the appropriate paddings made. Add the zero padding of size DN_BATCH_SIGN_BLOCK_HEADER to the beginning of this array of blocks. The structure should be as follows. Zero padding of size DN_BATCH_SIGN_BLOCK_HEADER | BLOCK 1 | BLOCK 2 | BLOCK 3 | ... The signed blocks will be returned in the same positions as the input blocks. |
dwBlockCount | Number of blocks contained in pbBlock. |
dwFlags | Reserved for future use (must be 0). |
DinamoException | Throws exception in case of error. |
|
inline |
Sends a batch of blocks for signature in the HSM.
hPrivateKey | Key context. |
pbBlock | Byte array containing the blocks that will be signed concatenated and with the appropriate paddings made. Add the zero padding of size DN_BATCH_SIGN_BLOCK_HEADER to the beginning of this array of blocks. The structure should be as follows. Zero padding of size DN_BATCH_SIGN_BLOCK_HEADER | BLOCK 1 | BLOCK 2 | BLOCK 3 | ... The signed blocks will be returned in the same positions as the input blocks. |
dwBlockCount | Number of blocks contained in pbBlock. |
dwFlags | Reserved for future use (must be 0). |
DinamoException | Throws exception in case of error. |
|
inline |
Sign a hash.
keyId | Private key identifier |
bHash | Array with hash |
algHash | Hash algorithm used. See: HASH_ALG |
DinamoException | Throws exception in case of error. |
|
inline |
Sign a hash.
keyId | Private key identifier | ||||||||
bHash | Array with hash | ||||||||
algHash | Hash algorithm used. See: HASH_ALG | ||||||||
dwFlags | Subscription options, can be 0 or more of one of the values below:
|
DinamoException | Throws exception in case of error. |
|
inline |
|
inline |
Sign a hash.
hHash | Pointer to the hash resource |
hPrivateKey | Pointer to the private key |
DinamoException | Throws exception in case of error. |
|
inline |
Sign a hash.
hHash | Pointer to the hash resource | ||||||||
hPrivateKey | Pointer to the private key | ||||||||
dwFlags | Subscription options, can be 0 or more of one of the values below:
|
DinamoException | Throws exception in case of error. |
|
inline |
Check a signature.
hHash | Pointer to the hash resource |
hPublicKey | Pointer to the public key resource |
bySignature | Signature array |
DinamoException | Throws exception in case of error. |
|
inline |
Stores a hash.
hHash | Pointer to the hash resource |
Value | Hash value |
DinamoException | Throws exception in case of error. |
|
inline |
Returns the hash value.
hHash | Pointer to the hash resource |
DinamoException | Throws exception in case of error. |
|
inline |
Returns a random number from the HSM generator.
dwReturnLen | Size in bytes of the random number |
DinamoException | Throws exception in case of error. |
|
inline |
Divides M from N in a secret. According to Shamir's secret sharing pattern.
bM | Minimum number of parts needed to rebuild the secret. Minimum of DinamoApi.DN_M_OF_N_S_MIN and maximum of DinamoApi.DN_M_OF_N_S_MAX. |
bN | Total number of parts to be generated. |
pbSecret | Secret to be shared. Must have size DinamoApi.DN_M_OF_N_S_LEN. Can be passed null so that a secret is randomly generated by the HSM. |
DinamoException | Throws exception in case of error. |
|
inline |
Reconstructs the secret M of N from the parts of the custodians. According to Shamir's secret sharing pattern.
parts | Array of secret parts. |
DinamoException | Throws exception in case of error. |