My Project
rsa.h
Go to the documentation of this file.
1 
34 int wc_InitRsaKey(RsaKey* key, void* heap);
35 
84 int wc_InitRsaKey_Id(RsaKey* key, unsigned char* id, int len,
85  void* heap, int devId);
86 
112 int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng);
113 
134 int wc_FreeRsaKey(RsaKey* key);
135 
206 int wc_RsaPublicEncrypt(const byte* in, word32 inLen, byte* out,
207  word32 outLen, RsaKey* key, WC_RNG* rng);
208 
230 int wc_RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out,
231  RsaKey* key);
232 
264 int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out,
265  word32 outLen, RsaKey* key);
266 
297 int wc_RsaSSL_Sign(const byte* in, word32 inLen, byte* out,
298  word32 outLen, RsaKey* key, WC_RNG* rng);
299 
335 int wc_RsaSSL_VerifyInline(byte* in, word32 inLen, byte** out,
336  RsaKey* key);
337 
367 int wc_RsaSSL_Verify(const byte* in, word32 inLen, byte* out,
368  word32 outLen, RsaKey* key);
369 
417 int wc_RsaPSS_Sign(const byte* in, word32 inLen, byte* out,
418  word32 outLen, enum wc_HashType hash, int mgf,
419  RsaKey* key, WC_RNG* rng);
420 
470 int wc_RsaPSS_Verify(byte* in, word32 inLen, byte* out,
471  word32 outLen, enum wc_HashType hash, int mgf,
472  RsaKey* key);
473 
531 int wc_RsaPSS_VerifyInline(byte* in, word32 inLen, byte** out,
532  enum wc_HashType hash, int mgf,
533  RsaKey* key);
599 int wc_RsaPSS_VerifyCheck(byte* in, word32 inLen,
600  byte* out, word32 outLen,
601  const byte* digest, word32 digestLen,
602  enum wc_HashType hash, int mgf,
603  RsaKey* key);
671 int wc_RsaPSS_VerifyCheck_ex(byte* in, word32 inLen,
672  byte* out, word32 outLen,
673  const byte* digest, word32 digestLen,
674  enum wc_HashType hash, int mgf, int saltLen,
675  RsaKey* key);
676 
741 int wc_RsaPSS_VerifyCheckInline(byte* in, word32 inLen, byte** out,
742  const byte* digest, word32 digentLen,
743  enum wc_HashType hash, int mgf,
744  RsaKey* key);
810 int wc_RsaPSS_VerifyCheckInline_ex(byte* in, word32 inLen, byte** out,
811  const byte* digest, word32 digentLen,
812  enum wc_HashType hash, int mgf, int saltLen,
813  RsaKey* key);
814 
875 int wc_RsaPSS_CheckPadding(const byte* in, word32 inLen, byte* sig,
876  word32 sigSz,
877  enum wc_HashType hashType);
940 int wc_RsaPSS_CheckPadding_ex(const byte* in, word32 inLen, byte* sig,
941  word32 sigSz, enum wc_HashType hashType, int saltLen, int bits);
960 int wc_RsaEncryptSize(RsaKey* key);
961 
1003 int wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
1004  RsaKey* key, word32 inSz);
1005 
1052 int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx,
1053  RsaKey* key, word32 inSz);
1054 
1097 int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz,
1098  const byte* e, word32 eSz, RsaKey* key);
1099 
1138 int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen);
1139 
1181 int wc_RsaPublicEncrypt_ex(const byte* in, word32 inLen, byte* out,
1182  word32 outLen, RsaKey* key, WC_RNG* rng, int type,
1183  enum wc_HashType hash, int mgf, byte* label, word32 labelSz);
1184 
1234 int wc_RsaPrivateDecrypt_ex(const byte* in, word32 inLen,
1235  byte* out, word32 outLen, RsaKey* key, int type,
1236  enum wc_HashType hash, int mgf, byte* label, word32 labelSz);
1237 
1292 int wc_RsaPrivateDecryptInline_ex(byte* in, word32 inLen,
1293  byte** out, RsaKey* key, int type, enum wc_HashType hash,
1294  int mgf, byte* label, word32 labelSz);
1295 
1337 int wc_RsaFlattenPublicKey(RsaKey* key, byte* e, word32* eSz, byte* n,
1338  word32* nSz);
1339 
1373 int wc_RsaKeyToPublicDer(RsaKey* key, byte* output, word32 inLen);
1374 
1409 int wc_RsaKeyToPublicDer_ex(RsaKey* key, byte* output, word32 inLen,
1410  int with_header);
1411 
1481 int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng);
1482 
1526 int wc_RsaSetNonBlock(RsaKey* key, RsaNb* nb);
1527 
1558 int wc_RsaSetNonBlockTime(RsaKey* key, word32 maxBlockUs,
1559  word32 cpuMHz);
wc_RsaPrivateDecryptInline_ex
int wc_RsaPrivateDecryptInline_ex(byte *in, word32 inLen, byte **out, RsaKey *key, int type, enum wc_HashType hash, int mgf, byte *label, word32 labelSz)
This function uses RSA to decrypt a message inline and gives the option of what padding type....
wc_RsaPublicEncrypt_ex
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 labelSz)
This function performs RSA encrypt while allowing the choice of which padding to use.
wc_RsaPSS_VerifyCheckInline_ex
int wc_RsaPSS_VerifyCheckInline_ex(byte *in, word32 inLen, byte **out, const byte *digest, word32 digentLen, enum wc_HashType hash, int mgf, int saltLen, RsaKey *key)
Verify the message signed with RSA-PSS. The input buffer is reused for the output buffer....
wc_RsaKeyToDer
int wc_RsaKeyToDer(RsaKey *key, byte *output, word32 inLen)
This function converts an RsaKey key to DER format. The result is written to output and it returns th...
wc_RsaPSS_Sign
int wc_RsaPSS_Sign(const byte *in, word32 inLen, byte *out, word32 outLen, enum wc_HashType hash, int mgf, RsaKey *key, WC_RNG *rng)
Signs the provided array with the private key.
wc_RsaPrivateDecryptInline
int wc_RsaPrivateDecryptInline(byte *in, word32 inLen, byte **out, RsaKey *key)
This functions is utilized by the wc_RsaPrivateDecrypt function for decrypting.
wc_InitRsaKey
int wc_InitRsaKey(RsaKey *key, void *heap)
This function initializes a provided RsaKey struct. It also takes in a heap identifier,...
wc_RsaKeyToPublicDer_ex
int wc_RsaKeyToPublicDer_ex(RsaKey *key, byte *output, word32 inLen, int with_header)
Convert RSA Public key to DER format. Writes to output, and returns count of bytes written....
wc_RsaFlattenPublicKey
int wc_RsaFlattenPublicKey(RsaKey *key, byte *e, word32 *eSz, byte *n, word32 *nSz)
Flattens the RsaKey structure into individual elements (e, n) used for the RSA algorithm.
wc_FreeRsaKey
int wc_FreeRsaKey(RsaKey *key)
This function frees a provided RsaKey struct using mp_clear.
wc_RsaKeyToPublicDer
int wc_RsaKeyToPublicDer(RsaKey *key, byte *output, word32 inLen)
Convert Rsa Public key to DER format. Writes to output, and returns count of bytes written.
wc_RsaPrivateDecrypt
int wc_RsaPrivateDecrypt(const byte *in, word32 inLen, byte *out, word32 outLen, RsaKey *key)
This functions provides private RSA decryption.
wc_RsaSetRNG
int wc_RsaSetRNG(RsaKey *key, WC_RNG *rng)
This function associates RNG with Key. It is needed when WC_RSA_BLINDING is enabled.
wc_RsaPublicKeyDecode
int wc_RsaPublicKeyDecode(const byte *input, word32 *inOutIdx, RsaKey *key, word32 inSz)
This function parses a DER-formatted RSA public key, extracts the public key and stores it in the giv...
wc_RsaPublicKeyDecodeRaw
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...
wc_RsaSetNonBlockTime
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 ...
wc_RsaSSL_Sign
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.
wc_RsaPSS_VerifyCheck_ex
int wc_RsaPSS_VerifyCheck_ex(byte *in, word32 inLen, byte *out, word32 outLen, const byte *digest, word32 digestLen, enum wc_HashType hash, int mgf, int saltLen, RsaKey *key)
Verify the message signed with RSA-PSS. The key has to be associated with RNG by wc_RsaSetRNG when WC...
wc_RsaPublicEncrypt
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...
wc_RsaPrivateKeyDecode
int wc_RsaPrivateKeyDecode(const byte *input, word32 *inOutIdx, RsaKey *key, word32 inSz)
This function parses a DER-formatted RSA private key, extracts the private key and stores it in the g...
wc_RsaPSS_CheckPadding
int wc_RsaPSS_CheckPadding(const byte *in, word32 inLen, byte *sig, word32 sigSz, enum wc_HashType hashType)
Checks the PSS data to ensure that the signature matches. Salt length is equal to hash length....
wc_RsaSSL_VerifyInline
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...
wc_RsaPSS_CheckPadding_ex
int wc_RsaPSS_CheckPadding_ex(const byte *in, word32 inLen, byte *sig, word32 sigSz, enum wc_HashType hashType, int saltLen, int bits)
Checks the PSS data to ensure that the signature matches. Salt length is equal to hash length.
wc_RsaPSS_VerifyCheck
int wc_RsaPSS_VerifyCheck(byte *in, word32 inLen, byte *out, word32 outLen, const byte *digest, word32 digestLen, enum wc_HashType hash, int mgf, RsaKey *key)
Verify the message signed with RSA-PSS. Salt length is equal to hash length. The key has to be associ...
wc_RsaSSL_Verify
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.
wc_RsaPSS_Verify
int wc_RsaPSS_Verify(byte *in, word32 inLen, byte *out, word32 outLen, enum wc_HashType hash, int mgf, RsaKey *key)
Decrypt input signature to verify that the message was signed by key. The key has to be associated wi...
wc_RsaSetNonBlock
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...
wc_InitRsaKey_Id
int wc_InitRsaKey_Id(RsaKey *key, unsigned char *id, int len, void *heap, int devId)
This function initializes a provided RsaKey struct. The id and len are used to identify the key on th...
wc_RsaPrivateDecrypt_ex
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 labelSz)
This function uses RSA to decrypt a message and gives the option of what padding type.
wc_MakeRsaKey
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)....
wc_RsaPSS_VerifyInline
int wc_RsaPSS_VerifyInline(byte *in, word32 inLen, byte **out, enum wc_HashType hash, int mgf, RsaKey *key)
Decrypt input signature to verify that the message was signed by RSA key. The output uses the same by...
wc_RsaPSS_VerifyCheckInline
int wc_RsaPSS_VerifyCheckInline(byte *in, word32 inLen, byte **out, const byte *digest, word32 digentLen, enum wc_HashType hash, int mgf, RsaKey *key)
Verify the message signed with RSA-PSS. The input buffer is reused for the output buffer....
wc_RsaEncryptSize
int wc_RsaEncryptSize(RsaKey *key)
Returns the encryption size for the provided key structure.