![]() |
TrustCore SDK NanoCert API reference
version 7.0
|
Header file for SoT Platform PKCS #1 convenience API. More...
Go to the source code of this file.
Macros | |
| #define | MOC_PKCS1_ALG_MGF1 1 |
| #define | PKCS1_MGF1 PKCS1_MGF1_FUNC |
Typedefs | |
| typedef MSTATUS(* | mgfFunc) (MOC_RSA(hwAccelDescr hwAccelCtx) const ubyte *mgfSeed, ubyte4 mgfSeedLen, ubyte4 maskLen, BulkHashAlgo *H, ubyte **ppRetMask) |
Functions | |
| MOC_EXTERN MSTATUS | PKCS1_MGF1_FUNC (MOC_RSA(hwAccelDescr hwAccelCtx) const ubyte *mgfSeed, ubyte4 mgfSeedLen, ubyte4 maskLen, BulkHashAlgo *H, ubyte **ppRetMask) |
| MOC_EXTERN MSTATUS | PKCS1_rsaesOaepDecrypt (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte H_rsaAlgoId, mgfFunc MGF, const ubyte *C, ubyte4 cLen, const ubyte *L, ubyte4 lLen, ubyte **ppRetDecrypt, ubyte4 *pRetDecryptLength) |
| MOC_EXTERN MSTATUS | PKCS1_rsaesOaepEncrypt (MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte H_rsaAlgoId, mgfFunc MGF, const ubyte *M, ubyte4 mLen, const ubyte *L, ubyte4 lLen, ubyte **ppRetEncrypt, ubyte4 *pRetEncryptLen) |
| MOC_EXTERN MSTATUS | PKCS1_rsaOaepDecrypt (const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pCipherText, ubyte4 cLen, const ubyte *pLabel, ubyte4 lLen, ubyte **ppPlainText, ubyte4 *pPlainTextLen) |
| Perform RSA-OAEP decryption. More... | |
| MOC_EXTERN MSTATUS | PKCS1_rsaOaepEncrypt (randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pLabel, ubyte4 lLen, ubyte **ppCipherText, ubyte4 *pCipherTextLen) |
| Perform RSA-OAEP encryption. More... | |
| MOC_EXTERN MSTATUS | PKCS1_rsaPssSign (randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, ubyte4 saltLen, ubyte **ppSignature, ubyte4 *pSignatureLen) |
| Use the provided RSA Key to sign some data using the PSS scheme. More... | |
| MOC_EXTERN MSTATUS | PKCS1_rsaPssSignExt (randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, ubyte4 saltLen, ubyte **ppSignature, ubyte4 *pSignatureLen, void *pExtCtx) |
| Use the provided RSA Key to sign some data using the PSS scheme. More... | |
| MOC_EXTERN MSTATUS | PKCS1_rsaPssVerify (const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, ubyte4 *pVerify) |
| Use the provided RSA Key to verify a PSS signature. More... | |
| MOC_EXTERN MSTATUS | PKCS1_rsaPssVerifyExt (const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, ubyte4 *pVerify, void *pExtCtx) |
| Use the provided RSA Key to verify a PSS signature. More... | |
| MOC_EXTERN MSTATUS | PKCS1_rsassaFreePssSign (MOC_RSA(hwAccelDescr hwAccelCtx) ubyte **ppSignature) |
| MOC_EXTERN MSTATUS | PKCS1_rsassaPssSign (MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte H_rsaAlgoId, mgfFunc MGF, const ubyte *pMessage, ubyte4 mesgLen, ubyte4 saltLen, ubyte **ppRetSignature, ubyte4 *pRetSignatureLen) |
| MOC_EXTERN MSTATUS | PKCS1_rsassaPssVerify (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte H_rsaAlgoId, mgfFunc MGF, const ubyte *const pMessage, ubyte4 mesgLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, intBoolean *pRetIsSignatureValid) |
Header file for SoT Platform PKCS #1, version 2.1, convenience API, as defined by RFC 3447.
For documentation for this file's definitions, enumerations, and functions, see pkcs1.c.
| MOC_EXTERN MSTATUS PKCS1_rsaOaepDecrypt | ( | const RSAKey * | pRSAKey, |
| ubyte | hashAlgo, | ||
| ubyte | mgfAlgo, | ||
| ubyte | mgfHashAlgo, | ||
| const ubyte * | pCipherText, | ||
| ubyte4 | cLen, | ||
| const ubyte * | pLabel, | ||
| ubyte4 | lLen, | ||
| ubyte ** | ppPlainText, | ||
| ubyte4 * | pPlainTextLen | ||
| ) |
| pRSAKey | The RSA private key to use for this operation. |
| hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
| mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
| mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
| pCipherText | The ciphertext to be decrypted |
| cLen | Length in bytes of the ciphertext to be decrypted. |
| pLabel | Optional label to use in the decoding. |
| lLen | Length in bytes of the label. |
| ppPlainText | Pointer to the pointer which will be allocated by this function and which will recieve the resulting plaintext. |
| pPlainTextLen | Pointer to the location that will recieve the byte length of the resulting plaintext. |
OK (0) if successful; otherwise a negative number error code definition from merrors.h. | MOC_EXTERN MSTATUS PKCS1_rsaOaepEncrypt | ( | randomContext * | pRandomContext, |
| const RSAKey * | pRSAKey, | ||
| ubyte | hashAlgo, | ||
| ubyte | mgfAlgo, | ||
| ubyte | mgfHashAlgo, | ||
| const ubyte * | pMessage, | ||
| ubyte4 | mLen, | ||
| const ubyte * | pLabel, | ||
| ubyte4 | lLen, | ||
| ubyte ** | ppCipherText, | ||
| ubyte4 * | pCipherTextLen | ||
| ) |
| pRandomContext | The random context to use for this operation. |
| pRSAKey | The RSA public key to use for this operation. |
| hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
| mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
| mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
| pMessage | The plaintext message to be encrypted, the length must be less than or equal to (k - 2hlen - 2) where k is the length in octets of the RSA modulus N. |
| mLen | Length in bytes of the input message to be encrypted. |
| pLabel | Optional label to use in the encoding. |
| lLen | Length in bytes of the label. |
| ppCipherText | Pointer to the pointer which will be allocated by this function and which will recieve the resulting ciphertext. |
| pCipherTextLen | Pointer to the location that will recieve the byte length of the resulting ciphertext. |
OK (0) if successful; otherwise a negative number error code definition from merrors.h. | MOC_EXTERN MSTATUS PKCS1_rsaPssSign | ( | randomContext * | pRandomContext, |
| const RSAKey * | pRSAKey, | ||
| ubyte | hashAlgo, | ||
| ubyte | mgfAlgo, | ||
| ubyte | mgfHashAlgo, | ||
| const ubyte * | pMessage, | ||
| ubyte4 | mLen, | ||
| ubyte4 | saltLen, | ||
| ubyte ** | ppSignature, | ||
| ubyte4 * | pSignatureLen | ||
| ) |
| pRandomContext | The random context to use for this operation. |
| pRSAKey | The RSA private key to use for this operation. |
| hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
| mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
| mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
| pMessage | The plaintext message to be signed, note this is not the digest of the data to be signed. |
| mLen | Length in bytes of the input message to be signed. |
| saltLen | Length in bytes of the salt. |
| ppSignature | Pointer to the pointer which will be allocated by this function and which will recieve the resulting signature. |
| pSignatureLen | Pointer to the location that will recieve the byte length of the resulting signature. |
OK (0) if successful; otherwise a negative number error code definition from merrors.h. | MOC_EXTERN MSTATUS PKCS1_rsaPssSignExt | ( | randomContext * | pRandomContext, |
| const RSAKey * | pRSAKey, | ||
| ubyte | hashAlgo, | ||
| ubyte | mgfAlgo, | ||
| ubyte | mgfHashAlgo, | ||
| const ubyte * | pMessage, | ||
| ubyte4 | mLen, | ||
| ubyte4 | saltLen, | ||
| ubyte ** | ppSignature, | ||
| ubyte4 * | pSignatureLen, | ||
| void * | pExtCtx | ||
| ) |
| pRandomContext | The random context to use for this operation. |
| pRSAKey | The RSA private key to use for this operation. |
| hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
| mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
| mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
| pMessage | The plaintext message to be signed, note this is not the digest of the data to be signed. |
| mLen | Length in bytes of the input message to be signed. |
| saltLen | Length in bytes of the salt. |
| ppSignature | Pointer to the pointer which will be allocated by this function and which will recieve the resulting signature. |
| pSignatureLen | Pointer to the location that will recieve the byte length of the resulting signature. |
| pExtCtx | Extended Context for future use. |
OK (0) if successful; otherwise a negative number error code definition from merrors.h. | MOC_EXTERN MSTATUS PKCS1_rsaPssVerify | ( | const RSAKey * | pRSAKey, |
| ubyte | hashAlgo, | ||
| ubyte | mgfAlgo, | ||
| ubyte | mgfHashAlgo, | ||
| const ubyte * | pMessage, | ||
| ubyte4 | mLen, | ||
| const ubyte * | pSignature, | ||
| ubyte4 | signatureLen, | ||
| sbyte4 | saltLen, | ||
| ubyte4 * | pVerify | ||
| ) |
| pRSAKey | The RSA public key to use for this operation. |
| hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
| mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
| mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
| pMessage | The plaintext message to be verified, note this is not the digest of the data to be verified. |
| mLen | Length in bytes of the input message to be signed. |
| pSignature | Pointer to the signature to be verified. |
| signatureLen | Length in bytes of the signature value. |
| saltLen | Length in bytes of the salt. Use -1 to retrieve saltLen from signature. |
| pVerify | Pointer to the value which will recieve the verification result, zero if it verified successfully, nonzero otherwise. |
OK (0) if successful; otherwise a negative number error code definition from merrors.h. | MOC_EXTERN MSTATUS PKCS1_rsaPssVerifyExt | ( | const RSAKey * | pRSAKey, |
| ubyte | hashAlgo, | ||
| ubyte | mgfAlgo, | ||
| ubyte | mgfHashAlgo, | ||
| const ubyte * | pMessage, | ||
| ubyte4 | mLen, | ||
| const ubyte * | pSignature, | ||
| ubyte4 | signatureLen, | ||
| sbyte4 | saltLen, | ||
| ubyte4 * | pVerify, | ||
| void * | pExtCtx | ||
| ) |
| pRSAKey | The RSA public key to use for this operation. |
| hashAlgo | The hash algorithm to use for this operation, must be one of the ht_sha* values in crypto.h |
| mgfAlgo | The Mask Generation Function (MGF) to use, this function currently only supports MOC_PKCS1_ALG_MGF1. |
| mgfHashAlgo | The hash algorithm to use for the MGF. Typically the MGF uses the same hashAlgo. |
| pMessage | The plaintext message to be verified, note this is not the digest of the data to be verified. |
| mLen | Length in bytes of the input message to be signed. |
| pSignature | Pointer to the signature to be verified. |
| signatureLen | Length in bytes of the signature value. |
| saltLen | Length in bytes of the salt. |
| pVerify | Pointer to the value which will recieve the verification result, zero if it verified successfully, nonzero otherwise. |
| pExtCtx | Extended Context for future use. |
OK (0) if successful; otherwise a negative number error code definition from merrors.h.