00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OPENSSLCRYPTOKEYRSA_INCLUDE
00029 #define OPENSSLCRYPTOKEYRSA_INCLUDE
00030
00031 #include <xsec/enc/XSECCryptoKeyRSA.hpp>
00032
00033 #if defined (HAVE_OPENSSL)
00034 #include <openssl/evp.h>
00035
00046 class DSIG_EXPORT OpenSSLCryptoKeyRSA : public XSECCryptoKeyRSA {
00047
00048 public :
00049
00052
00053 OpenSSLCryptoKeyRSA();
00054 virtual ~OpenSSLCryptoKeyRSA();
00055
00057
00060
00068 virtual XSECCryptoKey::KeyType getKeyType();
00069
00074 virtual const XMLCh * getProviderName() {return DSIGConstants::s_unicodeStrPROVOpenSSL;}
00075
00080 virtual XSECCryptoKey * clone();
00081
00083
00089
00103 virtual void setOAEPparams(unsigned char * params, unsigned int paramsLen);
00104
00111 virtual unsigned int getOAEPparamsLen(void);
00112
00120 virtual const unsigned char * getOAEPparams(void);
00121
00137 virtual bool verifySHA1PKCS1Base64Signature(const unsigned char * hashBuf,
00138 unsigned int hashLen,
00139 const char * base64Signature,
00140 unsigned int sigLen,
00141 hashMethod hm);
00142
00160 virtual unsigned int signSHA1PKCS1Base64Signature(unsigned char * hashBuf,
00161 unsigned int hashLen,
00162 char * base64SignatureBuf,
00163 unsigned int base64SignatureBufLen,
00164 hashMethod hm);
00165
00181 virtual unsigned int privateDecrypt(const unsigned char * inBuf,
00182 unsigned char * plainBuf,
00183 unsigned int inLength,
00184 unsigned int maxOutLength,
00185 PaddingType padding,
00186 hashMethod hm);
00187
00188
00204 virtual unsigned int publicEncrypt(const unsigned char * inBuf,
00205 unsigned char * cipherBuf,
00206 unsigned int inLength,
00207 unsigned int maxOutLength,
00208 PaddingType padding,
00209 hashMethod hm);
00210
00217 virtual unsigned int getLength(void);
00218
00220
00227
00237 virtual void loadPublicModulusBase64BigNums(const char * b64, unsigned int len);
00238
00248 virtual void loadPublicExponentBase64BigNums(const char * b64, unsigned int len);
00249
00251
00254
00264 OpenSSLCryptoKeyRSA(EVP_PKEY *k);
00265
00270 RSA * getOpenSSLRSA(void) {return mp_rsaKey;}
00271
00273
00274 private:
00275
00276 RSA * mp_rsaKey;
00277 unsigned char * mp_oaepParams;
00278 unsigned int m_oaepParamsLen;
00279
00280 };
00281
00282 #endif
00283 #endif