This module defines the API that implements the [PKCS1_2.1] primitive functions.
More...
|
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...
|
|
This module defines the API that implements the [PKCS1_2.1] primitive functions.
- Note
- Direct use of primitive functions, rather than schemes to protect data, is strongly discouraged as primitive functions are susceptible to well-known attacks.
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_ptr | Pointer to the private key data structure. The representation (pair or quintuple) and hence the algorithm (CRT or not-CRT) is determined by the Private Key data structure - using CRYS_RSA_Build_PrivKey or CRYS_RSA_Build_PrivKeyCRT to determine which algorithm is used. |
[in] | PrimeData_ptr | Pointer to a temporary structure containing internal buffers required for the RSA operation. |
[in] | Data_ptr | Pointer to the data to be decrypted. |
[in] | DataSize | The size (in bytes) of the data to decrypt. Must be equal to the modulus size. |
[out] | Output_ptr | Pointer to the decrypted data. The buffer size must be ≤ the modulus size. |
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_ptr | Pointer to the public key data structure. |
[in] | PrimeData_ptr | Pointer to a temporary structure containing internal buffers. |
[in] | Data_ptr | Pointer to the data to encrypt. |
[in] | DataSize | The size (in bytes) of the data to encrypt. Data size must be ≤ Modulus size. It can be smaller than the modulus size but it is not recommended. If smaller, the data is zero-padded up to the modulus size. Since the result of decryption is always the size of the modulus, this will cause the size of the decrypted data to be larger than the originally encrypted data. |
[out] | Output_ptr | Pointer to the encrypted data. The buffer size must be ≥ the modulus size. |