nRF5 SDK v17.1.0
Macros | Functions
CryptoCell RSA primitive APIs

Macros

#define CRYS_RSA_PRIM_Sign   CRYS_RSA_PRIM_Decrypt
 Implements the RSASP1 algorithm, as defined in [PKCS1_2.1] - 6.2.1, as a call to CRYS_RSA_PRIM_Decrypt, since the signature primitive is identical to the decryption primitive.
 
#define CRYS_RSA_PRIM_Verify   CRYS_RSA_PRIM_Encrypt
 Implements the RSAVP1 algorithm, as defined in [PKCS1_2.1] - 6.2.2, as a call to CRYS_RSA_PRIM_Encrypt.
 

Functions

CRYSError_t CRYS_RSA_PRIM_Encrypt (CRYS_RSAUserPubKey_t *UserPubKey_ptr, CRYS_RSAPrimeData_t *PrimeData_ptr, uint8_t *Data_ptr, uint16_t DataSize, uint8_t *Output_ptr)
 Implements the RSAEP algorithm, as defined in [PKCS1_2.1] - 6.1.1. More...
 
CRYSError_t CRYS_RSA_PRIM_Decrypt (CRYS_RSAUserPrivKey_t *UserPrivKey_ptr, CRYS_RSAPrimeData_t *PrimeData_ptr, uint8_t *Data_ptr, uint16_t DataSize, uint8_t *Output_ptr)
 Implements the RSADP algorithm, as defined in [PKCS1_2.1] - 6.1.2. More...
 

Detailed Description

Note
Direct use of primitive functions, rather than schemes to protect data, is strongly discouraged as primitive functions are susceptible to well-known attacks.

Function Documentation

CRYSError_t CRYS_RSA_PRIM_Decrypt ( CRYS_RSAUserPrivKey_t UserPrivKey_ptr,
CRYS_RSAPrimeData_t PrimeData_ptr,
uint8_t *  Data_ptr,
uint16_t  DataSize,
uint8_t *  Output_ptr 
)

Implements the RSADP algorithm, as defined in [PKCS1_2.1] - 6.1.2.

Returns
CRYS_OK on success.
A non-zero value from crys_rsa_error.h on failure.
Parameters
[in]UserPrivKey_ptrPointer to the private key data structure. The key representation (pair or quintuple) and hence the RSA algorithm (CRT or not-CRT) is determined by enum value in the structure CRYS_RSA_Build_PrivKey or CRYS_RSA_Build_PrivKeyCRT.
[in]PrimeData_ptrPointer to a temporary structure containing internal buffers required for the RSA operation.
[in]Data_ptrPointer to the data to be decrypted.
[in]DataSizeThe size (in bytes) of input data must be ≤ modulus size. If the size is smaller (not recommendet), then the data will be zero-padded by the function on left side up to the modulus size and therefore, after further decrypt operation,its result will contain zero-padding also. If the function is used for recovering the plain data from result of inverse function (CRYS_RSA_PRIM_Encrypt), the input size must be equal to modulus size exactly.
[out]Output_ptrPointer to the decrypted data. The buffer size must be ≤ the modulus size.
CRYSError_t CRYS_RSA_PRIM_Encrypt ( CRYS_RSAUserPubKey_t UserPubKey_ptr,
CRYS_RSAPrimeData_t PrimeData_ptr,
uint8_t *  Data_ptr,
uint16_t  DataSize,
uint8_t *  Output_ptr 
)

Implements the RSAEP algorithm, as defined in [PKCS1_2.1] - 6.1.1.

Returns
CRYS_OK on success.
A non-zero value from crys_rsa_error.h on failure.
Parameters
[in]UserPubKey_ptrPointer to the public key data structure.
[in]PrimeData_ptrPointer to a temporary structure containing internal buffers.
[in]Data_ptrPointer to the data to encrypt.
[in]DataSizeThe size (in bytes) of input data must be ≤ modulus size. If is smaller, then the function padds it by zeros on left side up to the modulus size and therefore, after further decrypt operation, its result will contain zero-padding also. If the function is used for recovering the plain data from result of inverse function (CRYS_RSA_PRIM_Decrypt), the input size must be equal to modulus size exactly.
[out]Output_ptrPointer to the encrypted data. The buffer size must be ≥ the modulus size.

Documentation feedback | Developer Zone | Subscribe | Updated