Lines Matching refs:RSA
10 * apply to all code found in this distribution, be it the RC4, RSA,
72 /* rsa.h contains functions for handling encryption and signature using RSA. */
77 /* RSA_new returns a new, empty RSA object or NULL on error. */
78 OPENSSL_EXPORT RSA *RSA_new(void);
81 OPENSSL_EXPORT RSA *RSA_new_method(const ENGINE *engine);
83 /* RSA_free decrements the reference count of |rsa| and frees it if the
85 OPENSSL_EXPORT void RSA_free(RSA *rsa);
87 /* RSA_up_ref increments the reference count of |rsa|. */
88 OPENSSL_EXPORT int RSA_up_ref(RSA *rsa);
93 /* RSA_generate_key_ex generates a new RSA key where the modulus has size
101 OPENSSL_EXPORT int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e,
105 * generate an RSA private key with more than two primes. */
106 OPENSSL_EXPORT int RSA_generate_multi_prime_key(RSA *rsa, int bits,
120 /* RSA_encrypt encrypts |in_len| bytes from |in| to the public key from |rsa|
129 OPENSSL_EXPORT int RSA_encrypt(RSA *rsa, size_t *out_len, uint8_t *out,
134 * |rsa| and writes, at most, |max_out| bytes of plaintext to |out|. The
146 * on the RSA Encryption Standard PKCS #1", Daniel Bleichenbacher, Advances in
148 OPENSSL_EXPORT int RSA_decrypt(RSA *rsa, size_t *out_len, uint8_t *out,
153 * |rsa| and writes the encrypted data to |to|. The |to| buffer must have at
162 uint8_t *to, RSA *rsa, int padding);
165 * |rsa| and writes the plaintext to |to|. The |to| buffer must have at least
175 uint8_t *to, RSA *rsa, int padding);
180 /* RSA_sign signs |in_len| bytes of digest from |in| with |rsa| using
181 * RSASSA-PKCS1-v1_5. It writes, at most, |RSA_size(rsa)| bytes to |out|. On
192 unsigned int *out_len, RSA *rsa);
194 /* RSA_sign_raw signs |in_len| bytes from |in| with the public key from |rsa|
203 OPENSSL_EXPORT int RSA_sign_raw(RSA *rsa, size_t *out_len, uint8_t *out,
208 * RSASSA-PKCS1-v1_5 signature of |msg_len| bytes at |msg| by |rsa|.
219 const uint8_t *sig, size_t sig_len, RSA *rsa);
222 * public key from |rsa| and writes, at most, |max_out| bytes of plaintext to
231 OPENSSL_EXPORT int RSA_verify_raw(RSA *rsa, size_t *out_len, uint8_t *out,
236 * |rsa| and writes the encrypted data to |to|. The |to| buffer must have at
246 uint8_t *to, RSA *rsa, int padding);
249 * public key in |rsa| and writes the plaintext to |to|. The |to| buffer must
259 uint8_t *to, RSA *rsa, int padding);
265 * of a signature or encrypted value using |rsa|. */
266 OPENSSL_EXPORT unsigned RSA_size(const RSA *rsa);
268 /* RSA_is_opaque returns one if |rsa| is opaque and doesn't expose its key
270 OPENSSL_EXPORT int RSA_is_opaque(const RSA *rsa);
272 /* RSA_supports_digest returns one if |rsa| supports signing digests
274 OPENSSL_EXPORT int RSA_supports_digest(const RSA *rsa, const EVP_MD *md);
276 /* RSAPublicKey_dup allocates a fresh |RSA| and copies the public key from
277 * |rsa| into it. It returns the fresh |RSA| object, or NULL on error. */
278 OPENSSL_EXPORT RSA *RSAPublicKey_dup(const RSA *rsa);
280 /* RSAPrivateKey_dup allocates a fresh |RSA| and copies the private key from
281 * |rsa| into it. It returns the fresh |RSA| object, or NULL on error. */
282 OPENSSL_EXPORT RSA *RSAPrivateKey_dup(const RSA *rsa);
284 /* RSA_check_key performs basic validatity tests on |rsa|. It returns one if
287 OPENSSL_EXPORT int RSA_check_key(const RSA *rsa);
289 /* RSA_recover_crt_params uses |rsa->n|, |rsa->d| and |rsa->e| in order to
291 * values are set in the |p|, |q|, |dmp1|, |dmq1| and |iqmp| members of |rsa|,
294 OPENSSL_EXPORT int RSA_recover_crt_params(RSA *rsa);
298 * exactly |RSA_size(rsa)| bytes of data. The |mgf1Hash| argument specifies the
305 OPENSSL_EXPORT int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const uint8_t *mHash,
311 * where |mHash| is a digest produced by |Hash|. |RSA_size(rsa)| bytes of
319 OPENSSL_EXPORT int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, uint8_t *EM,
337 * from |cbs| and advances |cbs|. It returns a newly-allocated |RSA| or NULL on
339 OPENSSL_EXPORT RSA *RSA_parse_public_key(CBS *cbs);
343 OPENSSL_EXPORT RSA *RSA_parse_public_key_buggy(CBS *cbs);
346 * (RFC 3447). It returns a newly-allocated |RSA| or NULL on error. */
347 OPENSSL_EXPORT RSA *RSA_public_key_from_bytes(const uint8_t *in, size_t in_len);
349 /* RSA_marshal_public_key marshals |rsa| as a DER-encoded RSAPublicKey structure
352 OPENSSL_EXPORT int RSA_marshal_public_key(CBB *cbb, const RSA *rsa);
354 /* RSA_public_key_to_bytes marshals |rsa| as a DER-encoded RSAPublicKey
359 const RSA *rsa);
362 * from |cbs| and advances |cbs|. It returns a newly-allocated |RSA| or NULL on
364 OPENSSL_EXPORT RSA *RSA_parse_private_key(CBS *cbs);
367 * structure (RFC 3447). It returns a newly-allocated |RSA| or NULL on error. */
368 OPENSSL_EXPORT RSA *RSA_private_key_from_bytes(const uint8_t *in,
371 /* RSA_marshal_private_key marshals |rsa| as a DER-encoded RSAPrivateKey
374 OPENSSL_EXPORT int RSA_marshal_private_key(CBB *cbb, const RSA *rsa);
376 /* RSA_private_key_to_bytes marshals |rsa| as a DER-encoded RSAPrivateKey
381 size_t *out_len, const RSA *rsa);
392 OPENSSL_EXPORT int RSA_set_ex_data(RSA *r, int idx, void *arg);
393 OPENSSL_EXPORT void *RSA_get_ex_data(const RSA *r, int idx);
424 /* RSA public exponent values. */
433 OPENSSL_EXPORT int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
436 * should use instead. It returns NULL on error, or a newly-allocated |RSA| on
439 OPENSSL_EXPORT RSA *RSA_generate_key(int bits, unsigned long e, void *callback,
442 /* d2i_RSAPublicKey parses an ASN.1, DER-encoded, RSA public key from |len|
445 * written directly into |*out|, otherwise a fresh |RSA| is allocated. On
448 OPENSSL_EXPORT RSA *d2i_RSAPublicKey(RSA **out, const uint8_t **inp, long len);
454 OPENSSL_EXPORT int i2d_RSAPublicKey(const RSA *in, uint8_t **outp);
456 /* d2i_RSAPrivateKey parses an ASN.1, DER-encoded, RSA private key from |len|
459 * written directly into |*out|, otherwise a fresh |RSA| is allocated. On
462 OPENSSL_EXPORT RSA *d2i_RSAPrivateKey(RSA **out, const uint8_t **inp, long len);
468 OPENSSL_EXPORT int i2d_RSAPrivateKey(const RSA *in, uint8_t **outp);
485 int (*init)(RSA *rsa);
486 int (*finish)(RSA *rsa);
488 /* size returns the size of the RSA modulus in bytes. */
489 size_t (*size)(const RSA *rsa);
492 uint8_t *sigret, unsigned int *siglen, const RSA *rsa);
495 const uint8_t *sigbuf, unsigned int siglen, const RSA *rsa);
499 int (*encrypt)(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out,
501 int (*sign_raw)(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out,
504 int (*decrypt)(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out,
506 int (*verify_raw)(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out,
510 * d'th power of it, modulo the RSA modulus and writes the result as a
512 * |len| is always equal to |RSA_size(rsa)|. If the result of the transform
518 * RSA decrypt and sign operations will call this, thus an ENGINE might wish
521 int (*private_transform)(RSA *rsa, uint8_t *out, const uint8_t *in,
524 int (*mod_exp)(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
532 int (*keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
534 int (*multi_prime_keygen)(RSA *rsa, int bits, int num_primes, BIGNUM *e,
537 /* supports_digest returns one if |rsa| supports digests of type
539 int (*supports_digest)(const RSA *rsa, const EVP_MD *md);
561 /* be careful using this if the RSA structure is shared */