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

OpenSSLCryptoKeyRSA.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2002-2004 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  * imitations 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.9 2004/02/08 10:22:50 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 
00047 class DSIG_EXPORT OpenSSLCryptoKeyRSA : public XSECCryptoKeyRSA {
00048 
00049 public :
00050 
00053     
00054     OpenSSLCryptoKeyRSA();
00055     virtual ~OpenSSLCryptoKeyRSA();
00056 
00058 
00061 
00069     virtual XSECCryptoKey::KeyType getKeyType();
00070 
00075     virtual const XMLCh * getProviderName() {return DSIGConstants::s_unicodeStrPROVOpenSSL;}
00076 
00081     virtual XSECCryptoKey * clone();
00082 
00084 
00090 
00104     virtual void setOAEPparams(unsigned char * params, unsigned int paramsLen);
00105 
00112     virtual unsigned int getOAEPparamsLen(void);
00113 
00121     virtual const unsigned char * getOAEPparams(void);
00122 
00136     virtual bool verifySHA1PKCS1Base64Signature(const unsigned char * hashBuf, 
00137                                  unsigned int hashLen,
00138                                  const char * base64Signature,
00139                                  unsigned int sigLen);
00140 
00157     virtual unsigned int signSHA1PKCS1Base64Signature(unsigned char * hashBuf,
00158         unsigned int hashLen,
00159         char * base64SignatureBuf,
00160         unsigned int base64SignatureBufLen);
00161 
00177     virtual unsigned int privateDecrypt(const unsigned char * inBuf,
00178                                  unsigned char * plainBuf, 
00179                                  unsigned int inLength,
00180                                  unsigned int maxOutLength,
00181                                  PaddingType padding,
00182                                  hashMethod hm);
00183 
00184 
00200     virtual unsigned int publicEncrypt(const unsigned char * inBuf,
00201                                  unsigned char * cipherBuf, 
00202                                  unsigned int inLength,
00203                                  unsigned int maxOutLength,
00204                                  PaddingType padding,
00205                                  hashMethod hm);
00206 
00213     virtual unsigned int getLength(void);
00214 
00216 
00223 
00233     virtual void loadPublicModulusBase64BigNums(const char * b64, unsigned int len);
00234 
00244     virtual void loadPublicExponentBase64BigNums(const char * b64, unsigned int len);
00245 
00247 
00250 
00260     OpenSSLCryptoKeyRSA(EVP_PKEY *k);
00261 
00263 
00264 private:
00265 
00266     XSECCryptoKey::KeyType          m_keyType;
00267     RSA                             * mp_rsaKey;
00268     unsigned char                   * mp_oaepParams;
00269     unsigned int                    m_oaepParamsLen;
00270 
00271 };
00272 
00273 #endif /* HAVE_OPENSSL */
00274 #endif /* OPENSSLCRYPTOKEYRSA_INCLUDE */

Generated on Sun Mar 14 21:35:28 2004 for XML-Security-C by doxygen 1.3.2