nrfxlib API 0.1.0
Loading...
Searching...
No Matches

◆ ocrypto_rsa_init_crt_key()

int ocrypto_rsa_init_crt_key ( ocrypto_rsa_crt_key key,
uint32_t *  key_mem,
const uint8_t *  p,
size_t  p_len,
const uint8_t *  q,
size_t  q_len,
const uint8_t *  dp,
size_t  dp_len,
const uint8_t *  dq,
size_t  dq_len,
const uint8_t *  qinv,
size_t  qi_len 
)

#include <crypto/nrf_oberon/include/ocrypto_rsa_primitives.h>

RSA secret key setup with CRT coefficients.

Parameters
[out]keyThe initialized secret key.
[out]key_memKey memory. Length OCRYPTO_RSA_CRT_KEY_SIZE(bits). Must have same lifetime as key.
pThe 1. RSA prime, unsigned big-endian.
p_lenLength of p.
qThe 2. RSA prime, unsigned big-endian.
q_lenLength of q. Must be same as p_len.
dpThe 1. CRT exponent, dp = d mod (p-1), unsigned big-endian.
dp_lenLength of dp.
dqThe 2. CRT exponent, dq = d mod (q-1), unsigned big-endian.
dq_lenLength of dq.
qinvThe CRT coefficient, qinv = 1/q mod p, unsigned big-endian.
qi_lenLength of qinv.
Return values
-1If the input length is invalid.
0On success.
Remarks
The p, q, dp, dq, and qinv values can be read directly from the corresponding value parts of a DER encoded RSAPrivateKey.