Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CryptoCell RSA Utility APIs
[CryptoCell RSA APIs]
Functions | |
| CIMPORT_C CRYSError_t | CRYS_RSA_Build_PubKey (CRYS_RSAUserPubKey_t *UserPubKey_ptr, uint8_t *Exponent_ptr, uint16_t ExponentSize, uint8_t *Modulus_ptr, uint16_t ModulusSize) |
| Builds a CRYSRSAPubKey_t public key structure with the provided modulus and exponent. | |
| CIMPORT_C CRYSError_t | CRYS_RSA_Build_PrivKey (CRYS_RSAUserPrivKey_t *UserPrivKey_ptr, uint8_t *PrivExponent_ptr, uint16_t PrivExponentSize, uint8_t *PubExponent_ptr, uint16_t PubExponentSize, uint8_t *Modulus_ptr, uint16_t ModulusSize) |
| Builds a CRYSRSAPrivKey_t private key structure with the provided modulus and exponent, marking the key as a non-CRT key. | |
| CIMPORT_C CRYSError_t | CRYS_RSA_Build_PrivKeyCRT (CRYS_RSAUserPrivKey_t *UserPrivKey_ptr, uint8_t *P_ptr, uint16_t PSize, uint8_t *Q_ptr, uint16_t QSize, uint8_t *dP_ptr, uint16_t dPSize, uint8_t *dQ_ptr, uint16_t dQSize, uint8_t *qInv_ptr, uint16_t qInvSize) |
| Builds a CRYSRSAPrivKey_t private key structure with the provided parameters, marking the key as a CRT key. | |
| CIMPORT_C CRYSError_t | CRYS_RSA_Get_PubKey (CRYS_RSAUserPubKey_t *UserPubKey_ptr, uint8_t *Exponent_ptr, uint16_t *ExponentSize_ptr, uint8_t *Modulus_ptr, uint16_t *ModulusSize_ptr) |
| The function gets the e,n public key parameters from the input CRYS_RSAUserPubKey_t structure. The function can also be used to retrieve the modulus and exponent sizes only (Exponent_ptr AND Modulus_ptr must be set to NULL). | |
Function Documentation
| CIMPORT_C CRYSError_t CRYS_RSA_Build_PrivKey | ( | CRYS_RSAUserPrivKey_t * | UserPrivKey_ptr, |
| uint8_t * | PrivExponent_ptr, | ||
| uint16_t | PrivExponentSize, | ||
| uint8_t * | PubExponent_ptr, | ||
| uint16_t | PubExponentSize, | ||
| uint8_t * | Modulus_ptr, | ||
| uint16_t | ModulusSize | ||
| ) |
Builds a CRYSRSAPrivKey_t private key structure with the provided modulus and exponent, marking the key as a non-CRT key.
- Returns:
- CRYS_OK on success.
- A non-zero value from crys_rsa_error.h on failure.
- Parameters:
-
[out] UserPrivKey_ptr Pointer to the public key structure. [in] PrivExponent_ptr Pointer to the private exponent stream of bytes (Big-Endian format). [in] PrivExponentSize The size of the private exponent (in bytes). [in] PubExponent_ptr Pointer to the public exponent stream of bytes (Big-Endian format). [in] PubExponentSize The size of the public exponent (in bytes). [in] Modulus_ptr Pointer to the modulus stream of bytes (Big-Endian format). The most significant bit must be set to '1'. [in] ModulusSize The modulus size in bytes. Supported sizes are 64, 128, 256, 384 and 512.
| CIMPORT_C CRYSError_t CRYS_RSA_Build_PrivKeyCRT | ( | CRYS_RSAUserPrivKey_t * | UserPrivKey_ptr, |
| uint8_t * | P_ptr, | ||
| uint16_t | PSize, | ||
| uint8_t * | Q_ptr, | ||
| uint16_t | QSize, | ||
| uint8_t * | dP_ptr, | ||
| uint16_t | dPSize, | ||
| uint8_t * | dQ_ptr, | ||
| uint16_t | dQSize, | ||
| uint8_t * | qInv_ptr, | ||
| uint16_t | qInvSize | ||
| ) |
Builds a CRYSRSAPrivKey_t private key structure with the provided parameters, marking the key as a CRT key.
- Returns:
- CRYS_OK on success.
- A non-zero value from crys_rsa_error.h on failure.
- Parameters:
-
[out] UserPrivKey_ptr Pointer to the public key structure. [in] P_ptr Pointer to the first factor stream of bytes (Big-Endian format). [in] PSize The size of the first factor (in bytes). [in] Q_ptr Pointer to the second factor stream of bytes (Big-Endian format). [in] QSize The size of the second factor (in bytes). [in] dP_ptr Pointer to the first factor's CRT exponent stream of bytes (Big-Endian format). [in] dPSize The size of the first factor's CRT exponent (in bytes). [in] dQ_ptr Pointer to the second factor's CRT exponent stream of bytes (Big-Endian format). [in] dQSize The size of the second factor's CRT exponent (in bytes). [in] qInv_ptr Pointer to the first CRT coefficient stream of bytes (Big-Endian format). [in] qInvSize The size of the first CRT coefficient (in bytes).
| CIMPORT_C CRYSError_t CRYS_RSA_Build_PubKey | ( | CRYS_RSAUserPubKey_t * | UserPubKey_ptr, |
| uint8_t * | Exponent_ptr, | ||
| uint16_t | ExponentSize, | ||
| uint8_t * | Modulus_ptr, | ||
| uint16_t | ModulusSize | ||
| ) |
Builds a CRYSRSAPubKey_t public key structure with the provided modulus and exponent.
- Returns:
- CRYS_OK on success.
- A non-zero value from crys_rsa_error.h on failure.
- Parameters:
-
[out] UserPubKey_ptr Pointer to the public key structure. [in] Exponent_ptr Pointer to the exponent stream of bytes (Big-Endian format). [in] ExponentSize The size of the exponent (in bytes). [in] Modulus_ptr Pointer to the modulus stream of bytes (Big-Endian format). The most significant bit (MSB) must be set to '1'. [in] ModulusSize The modulus size in bytes. Supported sizes are 64, 128, 256, 384 and 512.
| CIMPORT_C CRYSError_t CRYS_RSA_Get_PubKey | ( | CRYS_RSAUserPubKey_t * | UserPubKey_ptr, |
| uint8_t * | Exponent_ptr, | ||
| uint16_t * | ExponentSize_ptr, | ||
| uint8_t * | Modulus_ptr, | ||
| uint16_t * | ModulusSize_ptr | ||
| ) |
The function gets the e,n public key parameters from the input CRYS_RSAUserPubKey_t structure. The function can also be used to retrieve the modulus and exponent sizes only (Exponent_ptr AND Modulus_ptr must be set to NULL).
- Note:
- All members of input UserPubKey_ptr structure must be initialized.
- Returns:
- CRYS_OK on success.
- A non-zero value from crys_rsa_error.h on failure.
- Parameters:
-
[in] UserPubKey_ptr A pointer to the public key structure. [out] Exponent_ptr A pointer to the exponent stream of bytes (Big-Endian format). [in,out] ExponentSize_ptr the size of the exponent buffer in bytes, it is updated to the actual size of the exponent, in bytes. [out] Modulus_ptr A pointer to the modulus stream of bytes (Big-Endian format). The MS (most significant) bit must be set to '1'. [in,out] ModulusSize_ptr the size of the modulus buffer in bytes, it is updated to the actual size of the modulus, in bytes.
Generated on Tue Aug 9 2022 00:37:29 by
1.7.2