45 struct cx_rsa_public_key_s {
54 struct cx_rsa_private_key_s {
60 typedef struct cx_rsa_public_key_s cx_rsa_public_key_t;
62 typedef struct cx_rsa_private_key_s cx_rsa_private_key_t;
65 struct cx_rsa_1024_public_key_s {
71 struct cx_rsa_1024_private_key_s {
77 typedef struct cx_rsa_1024_public_key_s cx_rsa_1024_public_key_t;
79 typedef struct cx_rsa_1024_private_key_s cx_rsa_1024_private_key_t;
82 struct cx_rsa_2048_public_key_s {
88 struct cx_rsa_2048_private_key_s {
94 typedef struct cx_rsa_2048_public_key_s cx_rsa_2048_public_key_t;
96 typedef struct cx_rsa_2048_private_key_s cx_rsa_2048_private_key_t;
99 struct cx_rsa_3072_public_key_s {
105 struct cx_rsa_3072_private_key_s {
111 typedef struct cx_rsa_3072_public_key_s cx_rsa_3072_public_key_t;
113 typedef struct cx_rsa_3072_private_key_s cx_rsa_3072_private_key_t;
116 struct cx_rsa_4096_public_key_s {
122 struct cx_rsa_4096_private_key_s {
128 typedef struct cx_rsa_4096_public_key_s cx_rsa_4096_public_key_t;
130 typedef struct cx_rsa_4096_private_key_s cx_rsa_4096_private_key_t;
155 WARN_UNUSED_RESULT cx_err_t cx_rsa_init_public_key_no_throw(
const uint8_t *exponent,
159 cx_rsa_public_key_t *key);
165 DEPRECATED
static inline int cx_rsa_init_public_key(
const unsigned char *exponent,
166 unsigned int exponent_len,
167 const unsigned char *modulus,
168 unsigned int modulus_len,
169 cx_rsa_public_key_t *key)
171 CX_THROW(cx_rsa_init_public_key_no_throw(exponent, exponent_len, modulus, modulus_len, key));
198 WARN_UNUSED_RESULT cx_err_t cx_rsa_init_private_key_no_throw(
const uint8_t *exponent,
202 cx_rsa_private_key_t *key);
208 DEPRECATED
static inline int cx_rsa_init_private_key(
const unsigned char *exponent,
209 unsigned int exponent_len,
210 const unsigned char *modulus,
211 unsigned int modulus_len,
212 cx_rsa_private_key_t *key)
214 CX_THROW(cx_rsa_init_private_key_no_throw(exponent, exponent_len, modulus, modulus_len, key));
252 WARN_UNUSED_RESULT cx_err_t cx_rsa_generate_pair_no_throw(
size_t modulus_len,
253 cx_rsa_public_key_t *public_key,
254 cx_rsa_private_key_t *private_key,
263 DEPRECATED
static inline int cx_rsa_generate_pair(
unsigned int modulus_len,
264 cx_rsa_public_key_t *public_key,
265 cx_rsa_private_key_t *private_key,
266 const unsigned char *pub_exponent,
267 unsigned int exponent_len,
268 const unsigned char *externalPQ)
270 CX_THROW(cx_rsa_generate_pair_no_throw(
271 modulus_len, public_key, private_key, pub_exponent, exponent_len, externalPQ));
314 WARN_UNUSED_RESULT cx_err_t cx_rsa_sign_with_salt_len(
const cx_rsa_private_key_t *key,
361 WARN_UNUSED_RESULT cx_err_t cx_rsa_sign_no_throw(
const cx_rsa_private_key_t *key,
373 DEPRECATED
static inline int cx_rsa_sign(
const cx_rsa_private_key_t *key,
376 const unsigned char *hash,
377 unsigned int hash_len,
379 unsigned int sig_len)
381 CX_THROW(cx_rsa_sign_no_throw(key, mode, hashID, hash, hash_len, sig, sig_len));
418 bool cx_rsa_verify_with_salt_len(
const cx_rsa_public_key_t *key,
462 bool cx_rsa_verify(
const cx_rsa_public_key_t *key,
502 WARN_UNUSED_RESULT cx_err_t cx_rsa_encrypt_no_throw(
const cx_rsa_public_key_t *key,
514 DEPRECATED
static inline int cx_rsa_encrypt(
const cx_rsa_public_key_t *key,
517 const unsigned char *mesg,
518 unsigned int mesg_len,
520 unsigned int enc_len)
522 CX_THROW(cx_rsa_encrypt_no_throw(key, mode, hashID, mesg, mesg_len, enc, enc_len));
558 WARN_UNUSED_RESULT cx_err_t cx_rsa_decrypt_no_throw(
const cx_rsa_private_key_t *key,
570 DEPRECATED
static inline int cx_rsa_decrypt(
const cx_rsa_private_key_t *key,
573 const unsigned char *mesg,
574 unsigned int mesg_len,
576 unsigned int dec_len)
578 size_t dec_len_ = dec_len;
579 CX_THROW(cx_rsa_decrypt_no_throw(key, mode, hashID, mesg, mesg_len, dec, &dec_len_));
SHA-2 (Secure Hash Algorithm 2)
SHA-2 (Secure Hash Algorithm 2)