Cryptography library (nrf_crypto).
More...
|
| Cryptographic curves |
| Cryptographic curves that are available to the application. Currently, the nrf_crypto library supports only NIST p-256.
|
|
| Hashing algorithms |
| Hashing algorithms that are available to the application. Currently, the nrf_crypto library supports only SHA-256.
|
|
|
uint32_t | nrf_crypto_init (void) |
| Function for initializing the cryptography library.
|
|
uint32_t | nrf_crypto_public_key_compute (uint32_t curve, nrf_crypto_key_t const *p_sk, nrf_crypto_key_t *p_pk) |
| Function for computing a public key from a private key. More...
|
|
uint32_t | nrf_crypto_shared_secret_compute (uint32_t curve, nrf_crypto_key_t const *p_sk, nrf_crypto_key_t const *p_pk, nrf_crypto_key_t *p_ss) |
| Function for computing a shared secret from a key pair. More...
|
|
uint32_t | nrf_crypto_sign (uint32_t curve, nrf_crypto_key_t const *p_sk, nrf_crypto_key_t const *p_hash, nrf_crypto_key_t *p_sig) |
| Function for signing a hash or a digest using a private key. More...
|
|
uint32_t | nrf_crypto_verify (uint32_t curve, nrf_crypto_key_t const *p_pk, nrf_crypto_key_t const *p_hash, nrf_crypto_key_t const *p_sig) |
| Function for verifying the signature of a hash or a digest using a public key. More...
|
|
uint32_t | nrf_crypto_hash_compute (uint32_t hash_alg, uint8_t const *p_data, uint32_t len, nrf_crypto_key_t *p_hash) |
| Function for computing a hash or a digest from arbitrary data. More...
|
|
Cryptography library (nrf_crypto).
The cryptography library provides functions to compute keys, shared secrets, and hashes, and to sign and verify data using digital signatures.
SVCIs for the nrf_crypto module.
Enumerator |
---|
NRF_CRYPTO_SVCI_INIT |
Initialize the nrf_crypto module.
|
NRF_CRYPTO_SVCI_PUBLIC_KEY_COMPUTE |
Compute a public key from a private key.
|
NRF_CRYPTO_SVCI_SHARED_SECRET_COMPUTE |
Compute a shared secret from a key pair.
|
NRF_CRYPTO_SVCI_SIGN |
Compute a signature from a private key and a hash.
|
NRF_CRYPTO_SVCI_VERIFY |
Verify a signature with a public key and a hash.
|
NRF_CRYPTO_SVCI_HASH_COMPUTE |
Compute a digest from data.
|
uint32_t nrf_crypto_hash_compute |
( |
uint32_t |
hash_alg, |
|
|
uint8_t const * |
p_data, |
|
|
uint32_t |
len, |
|
|
nrf_crypto_key_t * |
p_hash |
|
) |
| |
Function for computing a hash or a digest from arbitrary data.
- Parameters
-
[in] | hash_alg | Hashing algorithm to use (see Hashing algorithms). |
[in] | p_data | Data to be hashed. |
[in] | len | Length of the data to be hashed. |
[out] | p_hash | Hash or digest (see nrf_crypto_key_t). |
- Return values
-
NRF_SUCCESS | If the hash was computed successfully. |
NRF_ERROR_NOT_SUPPORTED | If the selected hashing algorithm is not supported. |
NRF_ERROR_INVALID_ADDR | If any of the provided pointers is invalid. |
NRF_ERROR_INVALID_LENGTH | If the hash is bigger than the size of the provided buffer. |
Function for computing a public key from a private key.
- Parameters
-
- Return values
-
NRF_SUCCESS | If the public key was computed successfully. |
NRF_ERROR_NOT_SUPPORTED | If the selected curve is not supported. |
NRF_ERROR_INVALID_ADDR | If any of the provided pointers is invalid. |
NRF_ERROR_INVALID_LENGTH | If the length of the provided private key is invalid or the public key is bigger than the size of the provided buffer. |
Function for computing a shared secret from a key pair.
- Parameters
-
- Return values
-
NRF_SUCCESS | If the shared secret was computed successfully. |
NRF_ERROR_NOT_SUPPORTED | If the selected curve is not supported. |
NRF_ERROR_INVALID_ADDR | If any of the provided pointers is invalid. |
NRF_ERROR_INVALID_LENGTH | If the length of any of the provided keys is invalid or the shared secret is bigger than the size of the provided buffer. |
Function for signing a hash or a digest using a private key.
- Parameters
-
- Return values
-
NRF_SUCCESS | If the signature was created successfully. |
NRF_ERROR_NOT_SUPPORTED | If the selected curve is not supported. |
NRF_ERROR_INVALID_ADDR | If any of the provided pointers is invalid. |
NRF_ERROR_INVALID_LENGTH | If the length of the provided private key or hash is invalid or the signature is bigger than the size of the provided buffer. |
Function for verifying the signature of a hash or a digest using a public key.
- Parameters
-
- Return values
-
NRF_SUCCESS | If the signature was verified and is valid. |
NRF_ERROR_INVALID_DATA | If the signature did not match the provided hash or digest. |
NRF_ERROR_NOT_SUPPORTED | If the selected curve is not supported. |
NRF_ERROR_INVALID_ADDR | If any of the provided pointers is invalid. |
NRF_ERROR_INVALID_LENGTH | If the length of the provided public key, hash, or signature is invalid. |