pub unsafe extern "C" fn ocrypto_rsa_init_crt_key(
    key: *mut ocrypto_rsa_crt_key,
    key_mem: *mut u32,
    p: *const u8,
    p_len: usize,
    q: *const u8,
    q_len: usize,
    dp: *const u8,
    dp_len: usize,
    dq: *const u8,
    dq_len: usize,
    qinv: *const u8,
    qi_len: usize
) -> c_int
Expand description

RSA secret key setup with CRT coefficients.

  • key - The initialized secret key.
  • key_mem - Key memory. Length OCRYPTO_RSA_CRT_KEY_SIZE(bits). Must have same lifetime as * key - .
  • p - The 1. RSA prime, unsigned big-endian.
  • p_len - Length of * p - .
  • q - The 2. RSA prime, unsigned big-endian.
  • q_len - Length of * q - . Must be same as * p_len - .
  • dp - The 1. CRT exponent, dp = d mod (p-1), unsigned big-endian.
  • dp_len - Length of * dp - .
  • dq - The 2. CRT exponent, dq = d mod (q-1), unsigned big-endian.
  • dq_len - Length of * dq - .
  • qinv - The CRT coefficient, qinv = 1/q mod p, unsigned big-endian.
  • qi_len - Length of * qinv - .

Returns -1 If the input length is invalid. Returns 0 On success.

@remark The p, q, dp, dq, and qinv values can be read directly from a DER encoded RSAPrivateKey.