TrustCore SDK Crypto Interface API reference  version 2.0
crypto_interface_rsa.h File Reference

Cryptographic Interface header file for declaring RSA functions. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_applyPrivateKeyAux (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, RNGFun rngFun, void *rngFunArg, ubyte *pInput, ubyte4 inputLen, ubyte **ppOutput, vlong **ppVlongQueue)
 Apply the private key to the input data. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_applyPublicKeyAux (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, ubyte *pInput, ubyte4 inputLen, ubyte **ppOutput, vlong **ppVlongQueue)
 Apply the public key to the input data. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_byteStringFromKey (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pKey, ubyte *pBuffer, ubyte4 *pRetLen)
 Convert RSA key to a string of (PKCS #1) bytes. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_cloneKey (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey **ppNewKey, const RSAKey *pSrc, vlong **ppVlongQueue)
 Clone (copy) an RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_createKey (void **ppNewKey, ubyte4 keyType, void *pKeyAttributes)
 Create a new RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_createKeyAux (RSAKey **ppNewKey)
 Create a new RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_decryptAux (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pKey, const ubyte *pCipherText, ubyte *pPlainText, ubyte4 *pPlainTextLen, RNGFun rngFun, void *pRngFunArg, vlong **ppVlongQueue)
 Decrypts the given cipher text using RSA decryption. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_encryptAux (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pKey, const ubyte *pPlainText, ubyte4 plainTextLen, ubyte *pCipherText, RNGFun rngFun, void *pRngFunArg, vlong **ppVlongQueue)
 Creates RSA encryption. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_equalKey (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pKey1, const RSAKey *pKey2, byteBoolean *pRes)
 Determine whether two RSA keys are equal. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_freeKeyAux (RSAKey **ppRsaKey, vlong **ppVlongQueue)
 Free an RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_freeKeyTemplateAux (RSAKey *pKey, MRsaKeyTemplate *pTemplate)
 Free the RSA key template. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_generateKey (MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, RSAKey *pRsaKey, ubyte4 keySize, vlong **ppVlongQueue)
 Generate a key pair for pRsaKey using pRandomContext for entropy. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_generateKeyAlloc (MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, void **ppNewKey, ubyte4 keySize, vlong **ppVlongQueue, ubyte4 keyType, void *pKeyAttributes)
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_getCipherTextLengthAux (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pKey, sbyte4 *pCipherTextLen)
 Get length of cipher text associated with RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_getKeyBitLen (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, ubyte4 *pBitLen)
 Gets the bitlength of an RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_getKeyParametersAllocAux (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, MRsaKeyTemplate *pTemplate, ubyte keyType)
 Allocates and sets the appropriate key parameters of pTemplate with the data in the key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_keyFromByteString (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey **ppKey, const ubyte *pByteString, ubyte4 len, vlong **ppVlongQueue)
 Make an RSAKey object from a byte string. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_pkcs15Pad (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, ubyte4 operation, RNGFun rngFun, void *pRngFunArg, ubyte *pM, ubyte4 mLen, ubyte **ppRetPaddedMsg, ubyte4 *pRetPaddedMsgLen)
 Used to generated PKCS 1.5 padded data. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_setAllKeyDataAux (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, ubyte *pPubExpo, ubyte4 pubExpoLen, const ubyte *pModulus, ubyte4 modulusLen, const ubyte *pPrime1, ubyte4 prime1Len, const ubyte *pPrime2, ubyte4 prime2Len, vlong **ppVlongQueue)
 Set all the parameters in a RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_setAllKeyParameters (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, ubyte4 exponent, const ubyte *modulus, ubyte4 modulusLen, const ubyte *prime1, ubyte4 prime1Len, const ubyte *prime2, ubyte4 prime2Len, vlong **ppVlongQueue)
 Set all the parameters in a RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_setPublicKeyData (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, ubyte *pPubExpo, ubyte4 pubExpoLen, const ubyte *pModulus, ubyte4 modulusLen, vlong **ppVlongQueue)
 Set the public parameters of an RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_setPublicKeyParametersAux (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, ubyte4 exponent, const ubyte *pModulus, ubyte4 modulusLen, vlong **ppVlongQueue)
 Set the public parameters of an RSA key. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_signMessageAux (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pKey, const ubyte *pPlainText, ubyte4 plainTextLen, ubyte *pCipherText, vlong **ppVlongQueue)
 Uses an RSA key to sign the plain text and write to pCipherText. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_verifyDigest (MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, ubyte *pMsgDigest, ubyte4 digestLen, ubyte *pSignature, ubyte4 sigLen, intBoolean *pIsValid, vlong **ppVlongQueue)
 Verify the digest of a message. More...
 
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_verifySignatureAux (MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pKey, const ubyte *pCipherText, ubyte *pPlainText, ubyte4 *pPlainTextLen, vlong **ppVlongQueue)
 Uses an RSA key to verify the signature and write to pCipherText. More...
 

Detailed Description

Add details here.

crypto_interface_rsa.h

Function Documentation

◆ CRYPTO_INTERFACE_RSA_applyPrivateKeyAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_applyPrivateKeyAux ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
RNGFun  rngFun,
void *  rngFunArg,
ubyte *  pInput,
ubyte4  inputLen,
ubyte **  ppOutput,
vlong **  ppVlongQueue 
)

The input data must be the same length as the RSA modulus. The output buffer will be allocated by this function and must be freed by the caller.

Parameters
pKeyThe key used to perform the operation. This must contain RSA private key data.
rngFunFunction pointer to a random number generation function.
pRngFunArgInput data into the random number generation function pointer.
pInputThe input data to process. Must be the same length as the RSA modulus.
inputLenThe input data length.
ppOutputThe output buffer. This buffer will be allocated by this function and must be freed by the caller using MOC_FREE.
ppVlongQueueOptional vlong queue.
keyTypeThe key type, must be akt_rsa or akt_tap_rsa.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_applyPublicKeyAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_applyPublicKeyAux ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
ubyte *  pInput,
ubyte4  inputLen,
ubyte **  ppOutput,
vlong **  ppVlongQueue 
)

The input data must be the same length as the RSA modulus. The output buffer will be allocated by this function and must be freed by the caller.

Parameters
pKeyThe key used to perform the operation. This must contain RSA public key data.
pInputThe input data to process. Must be the same length as the RSA modulus.
inputLenThe input data length.
ppOutputThe output buffer. This buffer will be allocated by this function and must be freed by the caller using MOC_FREE.
ppVlongQueueOptional vlong queue.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_byteStringFromKey()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_byteStringFromKey ( MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *  pKey,
ubyte *  pBuffer,
ubyte4 *  pRetLen 
)
Parameters
pKeyPointer to RSAKey that will be used to get byte string.
pBufferPointer to buffer where byte string will be stored.
keySizeubyte4 containing size of key
ppVlongQueueDouble Pointer to the vlong.

crypto_interface_rsa.h

Returns
OK (0) if sucessful; otherwise a negative number error code defintion 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.

crypto_interface_rsa.h

◆ CRYPTO_INTERFACE_RSA_cloneKey()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_cloneKey ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey **  ppNewKey,
const RSAKey *  pSrc,
vlong **  ppVlongQueue 
)
Parameters
ppNewKeyDouble pointer to cloned RSAKey.
pSrcPointer RSAKey that will be cloned.
ppVlongQueueDouble Pointer to the vlong.

crypto_interface_rsa.h

Returns
OK (0) if sucessful; otherwise a negative number error code defintion 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.

crypto_interface_rsa.h

◆ CRYPTO_INTERFACE_RSA_createKey()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_createKey ( void **  ppNewKey,
ubyte4  keyType,
void *  pKeyAttributes 
)

This will allocate the RSA key shell. The caller is responsible for freeing the memory by calling RSA_freeKey.

Parameters
ppNewKeyPointer to the location that will recieve the new key.
keyTypeThe key type, must be akt_rsa.
pKeyAttributesPointer to a key attribute structure.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_createKeyAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_createKeyAux ( RSAKey **  ppNewKey)

This will allocate the RSA key shell. The caller is responsible for freeing the memory by calling CRYPTO_INTERFACE_RSA_freeKeyAux.

Parameters
ppNewKeyPointer to the location that will recieve the new key.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_decryptAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_decryptAux ( MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *  pKey,
const ubyte *  pCipherText,
ubyte *  pPlainText,
ubyte4 *  pPlainTextLen,
RNGFun  rngFun,
void *  pRngFunArg,
vlong **  ppVlongQueue 
)

This function decrypts given cipher text using RSA decryption. It supports TAP Key and SW key for doing RSA decryption.

Parameters
pRSAKeyPointer to RSAKey. It could be MocAsymkey or RSAKey.
pCipherTextPointer to the cipher text.
pPlainTextPointer to the plain text to be signed.
pPlainTextLenPointer to the length of the plain text.
rngFunRandom function pointer.
rngFunArgArgument to the random function.
ppVlongQueueDouble Pointer to the vlong.

crypto_interface_rsa.h

Returns
OK (0) if sucessful; otherwise a negative number error code defintion 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.

crypto_interface_rsa.h

◆ CRYPTO_INTERFACE_RSA_encryptAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_encryptAux ( MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *  pKey,
const ubyte *  pPlainText,
ubyte4  plainTextLen,
ubyte *  pCipherText,
RNGFun  rngFun,
void *  pRngFunArg,
vlong **  ppVlongQueue 
)

This function creates RSA encryption of the given input buffer. It supports TAP Key and SW key for calculating RSA encryption.

Parameters
pKeyPointer to RSAKey. It could be MocAsymkey or RSAKey.
pPlainTextPointer to the plain text to be signed.
plainTextLenPointer to the length of the plain text.
pCipherTextPointer to the cipher text.
rngFunRandom function pointer.
pRngFunArgArgument to the random function.
ppVlongQueueDouble Pointer to the vlong.

crypto_interface_rsa.h

Returns
OK (0) if sucessful; otherwise a negative number error code defintion 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.

crypto_interface_rsa.h

◆ CRYPTO_INTERFACE_RSA_equalKey()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_equalKey ( MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *  pKey1,
const RSAKey *  pKey2,
byteBoolean *  pRes 
)
Parameters
pKey1Pointer to an RSAKey that will be compared.
pKey2Pointer to other RSAKey that will be compared.
pResPointer to result of comparison.

crypto_interface_rsa.h

Returns
OK (0) if sucessful; otherwise a negative number error code defintion 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.

crypto_interface_rsa.h

◆ CRYPTO_INTERFACE_RSA_freeKeyAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_freeKeyAux ( RSAKey **  ppRsaKey,
vlong **  ppVlongQueue 
)
Parameters
ppRsaKeyDouble pointer to the key to be deleted.
ppVlongQueueOptional vlong queue.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_freeKeyTemplateAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_freeKeyTemplateAux ( RSAKey *  pKey,
MRsaKeyTemplate *  pTemplate 
)
Parameters
pKeyThe key used to delete the key template. This key is not always required.
pTemplateTemplate to free.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_generateKey()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_generateKey ( MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *  pRandomContext,
RSAKey *  pRsaKey,
ubyte4  keySize,
vlong **  ppVlongQueue 
)
Parameters
pRandomContextPointer to random context used for entropy.
pRsaKeyPointer to an RSAKey object.
keySizeubyte4 containing size of key.
ppVlongQueueDouble Pointer to the vlong.

crypto_interface_rsa.h

Returns
OK (0) if sucessful; otherwise a negative number error code defintion 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.

crypto_interface_rsa.h

◆ CRYPTO_INTERFACE_RSA_getCipherTextLengthAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_getCipherTextLengthAux ( MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *  pKey,
sbyte4 *  pCipherTextLen 
)
Parameters
pKeyPointer to the key used in signing
pCipherTextLenPointer to length of cipher text
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_getKeyBitLen()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_getKeyBitLen ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
ubyte4 *  pBitLen 
)
Parameters
pKeyThe RSA key in question.
pBitLenContents will be set to the key's bitlength
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

◆ CRYPTO_INTERFACE_RSA_getKeyParametersAllocAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_getKeyParametersAllocAux ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
MRsaKeyTemplate *  pTemplate,
ubyte  keyType 
)

Determine whether two RSA keys are equal.

The caller must provide an allocated MRsaKeyTemplate structure, which will then have its internal pointers allocated by this function. Note it is the callers responsibility to free this memory using RSA_freeKeyTemplate. The reqType should be either MOC_GET_PUBLIC_KEY_DATA or MOC_GET_PRIVATE_KEY_DATA. Tha latter option will get both the private and public key parameters. and as such can only be used with a private key. Retrieving the public data from a private key is allowed, retrieving the private data from a public key is impossible and will result in an error. See the documentation for MRsaKeyTemplate in capasym.h for more info on the format of template data.

Parameters
pKeyThe key to retrieve data from.
pTemplatePointer to an exisiting MRsaKeyTemplate structure. The internal pointers within structure will be allocated by this function.
keyTypeType of data to retrieve. This must be MOC_GET_PUBLIC_KEY_DATA or MOC_GET_PRIVATE_KEY_DATA.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h
Parameters
pKey1Pointer to an RSAKey that will be compared.
pKey2Pointer to other RSAKey that will be compared.
pResPointer to result of comparison.

crypto_interface_rsa.h

Returns
OK (0) if sucessful; otherwise a negative number error code defintion 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.

crypto_interface_rsa.h

◆ CRYPTO_INTERFACE_RSA_keyFromByteString()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_keyFromByteString ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey **  ppKey,
const ubyte *  pByteString,
ubyte4  len,
vlong **  ppVlongQueue 
)
Parameters
ppKeyPointer to an RSAKey pointer that will store newly created object.
pByteStringPointer to buffer storing key bytes
lenLength of pByteString
ppVlongQueueDouble Pointer to the vlong.

crypto_interface_rsa.h

Returns
OK (0) if sucessful; otherwise a negative number error code defintion 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.

crypto_interface_rsa.h

◆ CRYPTO_INTERFACE_RSA_pkcs15Pad()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_pkcs15Pad ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
ubyte4  operation,
RNGFun  rngFun,
void *  pRngFunArg,
ubyte *  pM,
ubyte4  mLen,
ubyte **  ppRetPaddedMsg,
ubyte4 *  pRetPaddedMsgLen 
)
Parameters
pKeyThe RSA key to use for this operation.
operationPKCS 1.5 includes a block type byte used to denote the type of operation being performed. This must be MOC_ASYM_KEY_FUNCTION_SIGN for signing.
rngFunThe RNG function pointer used to generated random bytes.
rngFunArgThe RNG function pointer argument.
pMThe plaintext message to be padded.
mLenLength in bytes of the input message to be padded.
ppRetPaddedMsgPointer to the pointer which will be allocated by this function and which will recieve the resulting PKCS 1.5 encoded message.
pRetPaddedMsgLenPointer to the location that will recieve the byte length of the resulting PKCS 1.5 encoded message.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h.

◆ CRYPTO_INTERFACE_RSA_setAllKeyDataAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_setAllKeyDataAux ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
ubyte *  pPubExpo,
ubyte4  pubExpoLen,
const ubyte *  pModulus,
ubyte4  modulusLen,
const ubyte *  pPrime1,
ubyte4  prime1Len,
const ubyte *  pPrime2,
ubyte4  prime2Len,
vlong **  ppVlongQueue 
)

The caller must provide the RSA exponent, RSA modulus, RSA prime, and RSA subprime values.

Parameters
pKeyThe key object to set.
pPubExpoThe RSA exponent as a byte string.
pubExpoLenThe RSA exponent length.
pModulusThe RSA modulus as a byte string.
modulusLenThe RSA modulus length.
pPrime1The RSA prime as a byte string.
prime1LenThe RSA prime length.
pPrime2The RSA subprime as a byte string.
prime2LenThe RSA subprime length.
ppVlongQueueOptional vlong queue.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_setAllKeyParameters()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_setAllKeyParameters ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
ubyte4  exponent,
const ubyte *  modulus,
ubyte4  modulusLen,
const ubyte *  prime1,
ubyte4  prime1Len,
const ubyte *  prime2,
ubyte4  prime2Len,
vlong **  ppVlongQueue 
)

The caller must provide the RSA exponent, RSA modulus, RSA prime, and RSA subprime values.

Parameters
pKeyThe key object to set.
exponentThe RSA exponent as 4 byte integer.
pModulusThe RSA modulus as a byte string.
modulusLenThe RSA modulus length.
pPrime1The RSA prime as a byte string.
prime1LenThe RSA prime length.
pPrime2The RSA subprime as a byte string.
prime2LenThe RSA subprime length.
ppVlongQueueOptional vlong queue.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_setPublicKeyData()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_setPublicKeyData ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
ubyte *  pPubExpo,
ubyte4  pubExpoLen,
const ubyte *  pModulus,
ubyte4  modulusLen,
vlong **  ppVlongQueue 
)

The caller must provide the RSA exponent as a ubyte4 and the RSA modulus as a byte string.

Parameters
pKeyThe key object to be set.
pPubExpoPointer to buffer containing exponent
pubExpoLenThe RSA exponent length.
pModulusThe RSA modulus as a byte string.
modulusLenThe length of the RSA modulus.
ppVlongQueueOptional vlong queue.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_setPublicKeyParametersAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_setPublicKeyParametersAux ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
ubyte4  exponent,
const ubyte *  pModulus,
ubyte4  modulusLen,
vlong **  ppVlongQueue 
)

The caller must provide the RSA exponent as a ubyte4 and the RSA modulus as a byte string.

Parameters
pKeyThe key object to be set.
exponentThe RSA exponent.
pModulusThe RSA modulus as a byte string.
modulusLenThe length of the RSA modulus.
ppVlongQueueOptional vlong queue.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_signMessageAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_signMessageAux ( MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *  pKey,
const ubyte *  pPlainText,
ubyte4  plainTextLen,
ubyte *  pCipherText,
vlong **  ppVlongQueue 
)
Parameters
pKeyPointer to the key used in signing
pPlainTextPointer to plain text buffer
plainTextLensize of plain text buffer
pCipherTextPointer to buffer for cipher text
ppVlongQueueOptional vlong queue.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h

◆ CRYPTO_INTERFACE_RSA_verifyDigest()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_verifyDigest ( MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *  pKey,
ubyte *  pMsgDigest,
ubyte4  digestLen,
ubyte *  pSignature,
ubyte4  sigLen,
intBoolean *  pIsValid,
vlong **  ppVlongQueue 
)

This function verifies the digest of a message, using the provided RSA public key.

Parameters
[in]hwAccelCtx(Reserved for future use.)
[in]pKeyPointer to RSA public key.
[in]pMsgDigestPointer to Msg Digest to be verified.
[in]digestLenThe length of the message digest in bytes.
[in]pSignaturePointer to the signature to be verified.
[in]sigLenThe length of the signature in bytes.
[out]pIsValidContents will be set with TRUE if the signature is valid and FALSE if otherwise.
[out]ppVlongQueueOn return, pointer to location in the vlong queue that contains this function's intermediate value, which can subsequently be used and eventually discarded. (Before ending, your application should be sure to free the entire queue.)
Returns
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.
Warning
Be sure to check for both a return status of OK and a pIsValid of TRUE before accepting that a signature is valid.

◆ CRYPTO_INTERFACE_RSA_verifySignatureAux()

MOC_EXTERN MSTATUS CRYPTO_INTERFACE_RSA_verifySignatureAux ( MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *  pKey,
const ubyte *  pCipherText,
ubyte *  pPlainText,
ubyte4 *  pPlainTextLen,
vlong **  ppVlongQueue 
)
Parameters
pKeyPointer to the key used in signing
pCipherTextPointer to buffer for cipher text
pPlainTextPointer to plain text buffer
plainTextLenPointer to number of bytes written to pPlainText
ppVlongQueueOptional vlong queue.
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h