Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

OpenSSLCryptoKeyRSA.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2002-2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * XSEC
00019  *
00020  * XSECCryptoKeyRSA := RSA Keys
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: OpenSSLCryptoKeyRSA.hpp 450743 2006-09-28 07:51:31Z blautenb $
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 /* HAVE_OPENSSL */
00283 #endif /* OPENSSLCRYPTOKEYRSA_INCLUDE */

Generated on Sun Jan 28 19:37:22 2007 for XML-Security-C by  doxygen 1.4.2