![]() |
TrustCore SDK NanoCert API reference
version 7.0
|
Header file for SoT Platform PKCS #5 convenience API. More...
Go to the source code of this file.
Macros | |
#define | MOC_MIN_800_132_ITERATION_COUNT 1000 |
#define | MOC_MIN_800_132_KEY_LEN 14 |
#define | MOC_MIN_800_132_SALT_LEN 16 |
Functions | |
MOC_EXTERN MSTATUS | PKCS5_CreateKey_PBKDF1 (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pSalt, ubyte4 saltLen, ubyte4 iterationCount, enum hashFunc hashingFunction, const ubyte *pPassword, ubyte4 passwordLen, ubyte4 dkLen, ubyte *pRetDerivedKey) |
Generate a key based on the RFC 2898 PBKDF1 key generation method. More... | |
MOC_EXTERN MSTATUS | PKCS5_CreateKey_PBKDF2 (MOC_HASH(hwAccelDescr hwAccelCtx) const ubyte *pSalt, ubyte4 saltLen, ubyte4 iterationCount, ubyte rsaAlgoId, const ubyte *pPassword, ubyte4 passwordLen, ubyte4 dkLen, ubyte *pRetDerivedKey) |
Generate a key based on the RFC 2898 PBKDF2 key generation method. More... | |
MOC_EXTERN MSTATUS | PKCS5_decrypt (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte subType, CStream cs, ASN1_ITEMPTR pPBEParam, ASN1_ITEMPTR pEncrypted, const ubyte *password, sbyte4 passwordLen, ubyte **privateKeyInfo, sbyte4 *privateKeyInfoLen) |
Decrypt data that is PKCS5 encrypted. More... | |
MOC_EXTERN MSTATUS | PKCS5_decryptV2 (MOC_SYM(hwAccelDescr hwAccelCtx) const ubyte *pAsn1PBE, ubyte4 pbeLen, ubyte *pData, ubyte4 dataLen, const ubyte *pPassword, sbyte4 passwordLen, ubyte *pPrivateKeyInfo, ubyte4 privKeyInfoBufferLen, ubyte4 *pPrivKeyInfoLen) |
Decrypt data that is PKCS5 V2 encrypted and in a raw buffer form. More... | |
MOC_EXTERN MSTATUS | PKCS5_encryptV1 (MOC_SYM(hwAccelDescr hwAccelCtx) ubyte pkcs5SubType, const ubyte *password, ubyte4 passwordLen, const ubyte *salt, ubyte4 saltLen, ubyte4 iterCount, ubyte *plainText, ubyte4 ptLen) |
Encrypt a plaintext buffer with PBES1 encryption as defined in RFC 2898. More... | |
MOC_EXTERN MSTATUS | PKCS5_encryptV2 (MOC_SYM(hwAccelDescr hwAccelCtx) const BulkEncryptionAlgo *pAlgo, ubyte rsaAlgoId, ubyte4 keyLength, sbyte4 effectiveKeyBits, const ubyte *password, ubyte4 passwordLen, const ubyte *salt, ubyte4 saltLen, ubyte4 iterCount, const ubyte *iv, ubyte *plainText, ubyte4 ptLen) |
Encrypt a plaintext buffer with PBES2 encryption as defined in RFC 2898. More... | |
MOC_EXTERN MSTATUS | PKCS5_encryptV2_Alt (ubyte encryptionAlgo, ubyte digestAlg, ubyte4 keyLength, sbyte4 effectiveKeyBits, const ubyte *pPassword, ubyte4 passwordLen, const ubyte *pSalt, ubyte4 saltLen, ubyte4 iterCount, const ubyte *pIv, ubyte *pPlainText, ubyte4 ptLen, ubyte *pCipherText, ubyte4 ctBufferLen, ubyte4 *pCtLen) |
Encrypt a plaintext buffer with PBES2 encryption as defined in RFC 2898. More... | |
Header file for SoT Platform PKCS #5, version 2.0, convenience API, as defined by RFC 2898.
MOC_EXTERN MSTATUS PKCS5_encryptV2_Alt | ( | ubyte | encryptionAlgo, |
ubyte | digestAlg, | ||
ubyte4 | keyLength, | ||
sbyte4 | effectiveKeyBits, | ||
const ubyte * | pPassword, | ||
ubyte4 | passwordLen, | ||
const ubyte * | pSalt, | ||
ubyte4 | saltLen, | ||
ubyte4 | iterCount, | ||
const ubyte * | pIv, | ||
ubyte * | pPlainText, | ||
ubyte4 | ptLen, | ||
ubyte * | pCipherText, | ||
ubyte4 | ctBufferLen, | ||
ubyte4 * | pCtLen | ||
) |
This function encrypts a plaintext buffer with PBES2 encryption as defined in RFC 2898. It combines the PBKDF2 password-based key derivation function with the given bulk encryption algorithm.
encryptionAlgo | The encryption algorithm. One of the following enum values
|
digestAlg | Pseudorandom function algorithm to apply to the password and salt; any of the following enum values from src/crypto/crypto.h:
|
keyLength | Length of key to derive; the maximum value is (2^32 - 1) bytes. |
effectiveKeyBits | Specify "1" to ensure encryption. |
pPassword | Pointer to password to use for key derivation. |
passwordLen | Length in bytes of password (password ). |
pSalt | Pointer to salt to use for key derivation. |
saltLen | Length in bytes of the salt (salt ). |
iterCount | Iteration count to use for key derivation. |
pIv | Initialization vector whose first pAlgo->blockSize bytes are appended to the derived key. |
pPlainText | Buffer holding the plaintext message to encrypt. |
ptLen | Length in bytes of plaintext message, plainText . |
pCipherText | Buffer to hold the resulting cipherText. It must have enough space for a padded message. |
ctBufferLen | Length of the pCipherText buffer in bytes. |
pCtLen | Contents will be set to the number of bytes contained in the resulting ciphertext. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.