rsa.h
1 
30 WOLFSSL_API int wc_InitRsaKey(RsaKey* key, void* heap);
31 
52 WOLFSSL_API int wc_FreeRsaKey(RsaKey* key);
53 
125 WOLFSSL_API int wc_RsaPublicEncrypt(const byte* in, word32 inLen, byte* out,
126  word32 outLen, RsaKey* key, WC_RNG* rng);
127 
149 WOLFSSL_API int wc_RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out,
150  RsaKey* key);
151 
183 WOLFSSL_API int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out,
184  word32 outLen, RsaKey* key);
185 
216 WOLFSSL_API int wc_RsaSSL_Sign(const byte* in, word32 inLen, byte* out,
217  word32 outLen, RsaKey* key, WC_RNG* rng);
218 
254 WOLFSSL_API int wc_RsaSSL_VerifyInline(byte* in, word32 inLen, byte** out,
255  RsaKey* key);
256 
286 WOLFSSL_API int wc_RsaSSL_Verify(const byte* in, word32 inLen, byte* out,
287  word32 outLen, RsaKey* key);
288 
308 WOLFSSL_API int wc_RsaEncryptSize(RsaKey* key);
309 
351 WOLFSSL_API int wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
352  RsaKey*, word32);
353 
400 WOLFSSL_API int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx,
401  RsaKey*, word32);
402 
445 WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz,
446  const byte* e, word32 eSz, RsaKey* key);
447 
486 WOLFSSL_API int wc_RsaKeyToDer(RsaKey*, byte* output, word32 inLen);
487 
529 WOLFSSL_API int wc_RsaPublicEncrypt_ex(const byte* in, word32 inLen, byte* out,
530  word32 outLen, RsaKey* key, WC_RNG* rng, int type,
531  enum wc_HashType hash, int mgf, byte* label, word32 lableSz);
532 
582 WOLFSSL_API int wc_RsaPrivateDecrypt_ex(const byte* in, word32 inLen,
583  byte* out, word32 outLen, RsaKey* key, int type,
584  enum wc_HashType hash, int mgf, byte* label, word32 lableSz);
585 
640 WOLFSSL_API int wc_RsaPrivateDecryptInline_ex(byte* in, word32 inLen,
641  byte** out, RsaKey* key, int type, enum wc_HashType hash,
642  int mgf, byte* label, word32 lableSz);
643 
686 WOLFSSL_API int wc_RsaFlattenPublicKey(RsaKey*, byte*, word32*, byte*,
687  word32*);
688 
722 WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey*, byte* output, word32 inLen);
723 
793 WOLFSSL_API int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng);
794 
838 WOLFSSL_API int wc_RsaSetNonBlock(RsaKey* key, RsaNb* nb);
839 
870 WOLFSSL_API int wc_RsaSetNonBlockTime(RsaKey* key, word32 maxBlockUs,
871  word32 cpuMHz);
WOLFSSL_API int wc_RsaEncryptSize(RsaKey *key)
Returns the encryption size for the provided key structure.
Definition: rsa.c:3540
WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte *n, word32 nSz, const byte *e, word32 eSz, RsaKey *key)
This function decodes the raw elements of an RSA public key, taking in the public modulus (n) and exp...
Definition: asn.c:4340
WOLFSSL_API int wc_FreeRsaKey(RsaKey *key)
This function frees a provided RsaKey struct using mp_clear.
Definition: rsa.c:512
WOLFSSL_API int wc_RsaSetNonBlock(RsaKey *key, RsaNb *nb)
This function sets the non-blocking RSA context. When a RsaNb context is set it enables fast math bas...
Definition: rsa.c:4172
WOLFSSL_API int wc_RsaPublicEncrypt(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key, WC_RNG *rng)
This function encrypts a message from in and stores the result in out. It requires an initialized pub...
Definition: rsa.c:3027
WOLFSSL_API int wc_RsaPrivateDecrypt_ex(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key, int type, enum wc_HashType hash, int mgf, byte *label, word32 lableSz)
This function uses RSA to decrypt a message and gives the option of what padding type.
Definition: rsa.c:3097
WOLFSSL_API int wc_RsaSSL_VerifyInline(byte *in, word32 inLen, byte **out, RsaKey *key)
Used to verify that the message was signed by RSA key. The output uses the same byte array as the inp...
Definition: rsa.c:3116
WOLFSSL_API int wc_RsaPrivateKeyDecode(const byte *input, word32 *inOutIdx, RsaKey *, word32)
This function parses a DER-formatted RSA private key, extracts the private key and stores it in the g...
Definition: asn.c:2567
Definition: rsa.h:144
WOLFSSL_API int wc_RsaPublicKeyDecode(const byte *input, word32 *inOutIdx, RsaKey *, word32)
This function parses a DER-formatted RSA public key, extracts the public key and stores it in the giv...
Definition: asn.c:4321
WOLFSSL_API int wc_RsaPublicEncrypt_ex(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key, WC_RNG *rng, int type, enum wc_HashType hash, int mgf, byte *label, word32 lableSz)
This function performs RSA encrypt while allowing the choice of which padding to use.
Definition: rsa.c:3037
WOLFSSL_API int wc_RsaKeyToDer(RsaKey *, byte *output, word32 inLen)
This function converts an RsaKey key to DER format. The result is written to output and it returns th...
Definition: asn.c:11179
WOLFSSL_API int wc_RsaFlattenPublicKey(RsaKey *, byte *, word32 *, byte *, word32 *)
Flattens the RsaKey structure into individual elements (e, n) used for the RSA algorithm.
Definition: rsa.c:3562
WOLFSSL_API int wc_RsaPrivateDecrypt(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key)
This functions provides private RSA decryption.
Definition: rsa.c:3082
WOLFSSL_API int wc_RsaSSL_Sign(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key, WC_RNG *rng)
Signs the provided array with the private key.
Definition: rsa.c:3481
WOLFSSL_API int wc_RsaPrivateDecryptInline_ex(byte *in, word32 inLen, byte **out, RsaKey *key, int type, enum wc_HashType hash, int mgf, byte *label, word32 lableSz)
This function uses RSA to decrypt a message inline and gives the option of what padding type...
Definition: rsa.c:3065
WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey *, byte *output, word32 inLen)
Convert Rsa Public key to DER format. Writes to output, and returns count of bytes written...
Definition: asn.c:11254
WOLFSSL_API int wc_RsaSSL_Verify(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key)
Used to verify that the message was signed by key.
Definition: rsa.c:3131
WOLFSSL_API int wc_InitRsaKey(RsaKey *key, void *heap)
This function initializes a provided RsaKey struct. It also takes in a heap identifier, for use with user defined memory overrides (see XMALLOC, XFREE, XREALLOC).
Definition: rsa.c:333
Definition: random.h:153
WOLFSSL_API int wc_MakeRsaKey(RsaKey *key, int size, long e, WC_RNG *rng)
This function generates a RSA private key of length size (in bits) and given exponent (e)...
Definition: rsa.c:3886
WOLFSSL_API int wc_RsaSetNonBlockTime(RsaKey *key, word32 maxBlockUs, word32 cpuMHz)
This function configures the maximum amount of blocking time in microseconds. It uses a pre-computed ...
Definition: rsa.c:4187
Definition: user_rsa.h:60
WOLFSSL_API int wc_RsaPrivateDecryptInline(byte *in, word32 inLen, byte **out, RsaKey *key)
This functions is utilized by the wc_RsaPrivateDecrypt function for decrypting.
Definition: rsa.c:3050