Index: nss/lib/freebl/blapi.h |
=================================================================== |
--- nss/lib/freebl/blapi.h (revision 239365) |
+++ nss/lib/freebl/blapi.h (working copy) |
@@ -108,6 +108,174 @@ |
extern SECStatus RSA_PopulatePrivateKey(RSAPrivateKey *key); |
/******************************************************************** |
+** RSA algorithm |
+*/ |
+ |
+/******************************************************************** |
+** Raw signing/encryption/decryption operations. |
+** |
+** No padding or formatting will be applied. |
+** inputLen MUST be equivalent to the modulus size (in bytes). |
+*/ |
+extern SECStatus |
+RSA_SignRaw(RSAPrivateKey * key, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * input, |
+ unsigned int inputLen); |
+ |
+extern SECStatus |
+RSA_CheckSignRaw(RSAPublicKey * key, |
+ const unsigned char * sig, |
+ unsigned int sigLen, |
+ const unsigned char * hash, |
+ unsigned int hashLen); |
+ |
+extern SECStatus |
+RSA_CheckSignRecoverRaw(RSAPublicKey * key, |
+ unsigned char * data, |
+ unsigned int * dataLen, |
+ unsigned int maxDataLen, |
+ const unsigned char * sig, |
+ unsigned int sigLen); |
+ |
+extern SECStatus |
+RSA_EncryptRaw(RSAPublicKey * key, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * input, |
+ unsigned int inputLen); |
+ |
+extern SECStatus |
+RSA_DecryptRaw(RSAPrivateKey * key, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * input, |
+ unsigned int inputLen); |
+ |
+/******************************************************************** |
+** RSAES-OAEP encryption/decryption, as defined in RFC 3447, Section 7.1. |
+** |
+** Note: Only MGF1 is supported as the mask generation function. It will be |
+** used with maskHashAlg as the inner hash function. |
+** |
+** Unless performing Known Answer Tests, "seed" should be NULL, indicating that |
+** freebl should generate a random value. Otherwise, it should be an octet |
+** string of seedLen bytes, which should be the same size as the output of |
+** hashAlg. |
+*/ |
+extern SECStatus |
+RSA_EncryptOAEP(RSAPublicKey * key, |
+ HASH_HashType hashAlg, |
+ HASH_HashType maskHashAlg, |
+ const unsigned char * label, |
+ unsigned int labelLen, |
+ const unsigned char * seed, |
+ unsigned int seedLen, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * input, |
+ unsigned int inputLen); |
+ |
+extern SECStatus |
+RSA_DecryptOAEP(RSAPrivateKey * key, |
+ HASH_HashType hashAlg, |
+ HASH_HashType maskHashAlg, |
+ const unsigned char * label, |
+ unsigned int labelLen, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * input, |
+ unsigned int inputLen); |
+ |
+/******************************************************************** |
+** RSAES-PKCS1-v1_5 encryption/decryption, as defined in RFC 3447, Section 7.2. |
+*/ |
+extern SECStatus |
+RSA_EncryptBlock(RSAPublicKey * key, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * input, |
+ unsigned int inputLen); |
+ |
+extern SECStatus |
+RSA_DecryptBlock(RSAPrivateKey * key, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * input, |
+ unsigned int inputLen); |
+ |
+/******************************************************************** |
+** RSASSA-PSS signing/verifying, as defined in RFC 3447, Section 8.1. |
+** |
+** Note: Only MGF1 is supported as the mask generation function. It will be |
+** used with maskHashAlg as the inner hash function. |
+** |
+** Unless performing Known Answer Tests, "salt" should be NULL, indicating that |
+** freebl should generate a random value. |
+*/ |
+extern SECStatus |
+RSA_SignPSS(RSAPrivateKey * key, |
+ HASH_HashType hashAlg, |
+ HASH_HashType maskHashAlg, |
+ const unsigned char * salt, |
+ unsigned int saltLen, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * input, |
+ unsigned int inputLen); |
+ |
+extern SECStatus |
+RSA_CheckSignPSS(RSAPublicKey * key, |
+ HASH_HashType hashAlg, |
+ HASH_HashType maskHashAlg, |
+ unsigned int saltLen, |
+ const unsigned char * sig, |
+ unsigned int sigLen, |
+ const unsigned char * hash, |
+ unsigned int hashLen); |
+ |
+/******************************************************************** |
+** RSASSA-PKCS1-v1_5 signing/verifying, as defined in RFC 3447, Section 8.2. |
+** |
+** These functions expect as input to be the raw value to be signed. For most |
+** cases using PKCS1-v1_5, this should be the value of T, the DER-encoded |
+** DigestInfo structure defined in Section 9.2, Step 2. |
+** Note: This can also be used for signatures that use PKCS1-v1_5 padding, such |
+** as the signatures used in SSL/TLS, which sign a raw hash. |
+*/ |
+extern SECStatus |
+RSA_Sign(RSAPrivateKey * key, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * data, |
+ unsigned int dataLen); |
+ |
+extern SECStatus |
+RSA_CheckSign(RSAPublicKey * key, |
+ const unsigned char * sig, |
+ unsigned int sigLen, |
+ const unsigned char * data, |
+ unsigned int dataLen); |
+ |
+extern SECStatus |
+RSA_CheckSignRecover(RSAPublicKey * key, |
+ unsigned char * output, |
+ unsigned int * outputLen, |
+ unsigned int maxOutputLen, |
+ const unsigned char * sig, |
+ unsigned int sigLen); |
+ |
+/******************************************************************** |
** DSA signing algorithm |
*/ |