Elliptic Curve Digital Signature (ECDSA)

nRF5 SDK v15.0.0

Provides elliptic curve cryptography functions for digital signature. More...

Data Structures

union nrf_crypto_ecdsa_sign_context_t
Union holding a context for ECDSA hash sign. More...
union nrf_crypto_ecdsa_verify_context_t
Union holding a context for ECDSA hash verify. More...

Macros

#define NRF_CRYPTO_ECDSA_SIGNATURE_MAX_SIZE (2 * NRF_CRYPTO_ECC_RAW_PRIVATE_KEY_MAX_SIZE )
Maximum size of a signature for all enabled curves.

Typedefs

typedef uint8_t nrf_crypto_ecdsa_signature_t [(2 *NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE)]
Type big enough to hold signature output for any curve type.

Functions

ret_code_t nrf_crypto_ecdsa_sign ( nrf_crypto_ecdsa_sign_context_t *p_context, nrf_crypto_ecc_private_key_t const *p_private_key, uint8_t const *p_hash, size_t hash_size, uint8_t *p_signature, size_t *p_signature_size)
Sign a hash of a message. More...
ret_code_t nrf_crypto_ecdsa_verify ( nrf_crypto_ecdsa_verify_context_t *p_context, nrf_crypto_ecc_public_key_t const *p_public_key, uint8_t const *p_hash, size_t hash_size, uint8_t const *p_signature, size_t signature_size)
Verify a signature using a hash of a message. More...

Detailed Description

Provides elliptic curve cryptography functions for digital signature.

Function Documentation

ret_code_t nrf_crypto_ecdsa_sign ( nrf_crypto_ecdsa_sign_context_t * p_context ,
nrf_crypto_ecc_private_key_t const * p_private_key ,
uint8_t const * p_hash ,
size_t hash_size ,
uint8_t * p_signature ,
size_t * p_signature_size
)

Sign a hash of a message.

Parameters
[in] p_context Pointer to temporary structure holding context information. If it is NULL, necessary data will be allocated with NRF_CRYPTO_ALLOC and freed at the end of the function.
[in] p_private_key Pointer to structure holding a private key.
[in] p_hash Pointer to hash to sign.
[in] hash_size Number of bytes in p_hash.
[out] p_signature Pointer to buffer where digital signature will be put.
[in,out] p_signature_size Maximum number of bytes that p_signature buffer can hold on input and the actual number of bytes used by the data on output. Actual size for selected curve is defined by the preprocessor definitions, e.g. NRF_CRYPTO_ECDSA_SECP256R1_SIGNATURE_SIZE .
ret_code_t nrf_crypto_ecdsa_verify ( nrf_crypto_ecdsa_verify_context_t * p_context ,
nrf_crypto_ecc_public_key_t const * p_public_key ,
uint8_t const * p_hash ,
size_t hash_size ,
uint8_t const * p_signature ,
size_t signature_size
)

Verify a signature using a hash of a message.

Parameters
[in] p_context Pointer to temporary structure holding context information. If it is NULL, necessary data will be allocated with NRF_CRYPTO_ALLOC and freed at the end of the function.
[in] p_public_key Pointer to structure holding a public key.
[in] p_hash Pointer to hash to verify.
[in] hash_size Number of bytes in p_hash.
[in] p_signature Pointer to buffer containing digital signature.
[in,out] signature_size Number of bytes in p_signature.