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,v 1.12 2005/06/04 11:30:26 blautenb Exp $
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 
00135     virtual bool verifySHA1PKCS1Base64Signature(const unsigned char * hashBuf, 
00136                                  unsigned int hashLen,
00137                                  const char * base64Signature,
00138                                  unsigned int sigLen);
00139 
00156     virtual unsigned int signSHA1PKCS1Base64Signature(unsigned char * hashBuf,
00157         unsigned int hashLen,
00158         char * base64SignatureBuf,
00159         unsigned int base64SignatureBufLen);
00160 
00176     virtual unsigned int privateDecrypt(const unsigned char * inBuf,
00177                                  unsigned char * plainBuf, 
00178                                  unsigned int inLength,
00179                                  unsigned int maxOutLength,
00180                                  PaddingType padding,
00181                                  hashMethod hm);
00182 
00183 
00199     virtual unsigned int publicEncrypt(const unsigned char * inBuf,
00200                                  unsigned char * cipherBuf, 
00201                                  unsigned int inLength,
00202                                  unsigned int maxOutLength,
00203                                  PaddingType padding,
00204                                  hashMethod hm);
00205 
00212     virtual unsigned int getLength(void);
00213 
00215 
00222 
00232     virtual void loadPublicModulusBase64BigNums(const char * b64, unsigned int len);
00233 
00243     virtual void loadPublicExponentBase64BigNums(const char * b64, unsigned int len);
00244 
00246 
00249 
00259     OpenSSLCryptoKeyRSA(EVP_PKEY *k);
00260 
00262 
00263 private:
00264 
00265     RSA                             * mp_rsaKey;
00266     unsigned char                   * mp_oaepParams;
00267     unsigned int                    m_oaepParamsLen;
00268 
00269 };
00270 
00271 #endif /* HAVE_OPENSSL */
00272 #endif /* OPENSSLCRYPTOKEYRSA_INCLUDE */

Generated on Sun Jul 3 17:37:26 2005 for XML-Security-C by  doxygen 1.4.2