Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

CryptoCell RSA primitive APIs

CryptoCell RSA primitive APIs
[CryptoCell RSA APIs]

Functions

CIMPORT_C 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.
CIMPORT_C 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.

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

CIMPORT_C 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.
CIMPORT_C 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.