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

WinCAPICryptoKeyDSA.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  * WinCAPICryptoKeyDSA := DSA Keys
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: WinCAPICryptoKeyDSA.hpp,v 1.9 2005/06/04 11:30:26 blautenb Exp $
00025  *
00026  */
00027 
00028 #ifndef WINCAPICRYPTOKEYDSA_INCLUDE
00029 #define WINCAPICRYPTOKEYDSA_INCLUDE
00030 
00031 #include <xsec/enc/XSECCryptoKeyDSA.hpp>
00032 
00033 #if !defined(_WIN32_WINNT)
00034 #   define _WIN32_WINNT 0x0400
00035 #endif
00036 
00037 #include <wincrypt.h>
00038 
00039 class WinCAPICryptoProvider;
00040 
00052 class DSIG_EXPORT WinCAPICryptoKeyDSA : public XSECCryptoKeyDSA {
00053 
00054 public :
00055 
00058     
00070     WinCAPICryptoKeyDSA(HCRYPTPROV prov);
00071     
00072     virtual ~WinCAPICryptoKeyDSA();
00073 
00086     WinCAPICryptoKeyDSA(HCRYPTPROV prov, HCRYPTKEY k);
00087 
00101     WinCAPICryptoKeyDSA(HCRYPTPROV prov, DWORD keySpec, bool isPrivate);
00102 
00104 
00107 
00115     virtual XSECCryptoKey::KeyType getKeyType();
00116 
00121     virtual const XMLCh * getProviderName() {return DSIGConstants::s_unicodeStrPROVWinCAPI;}
00122     
00127     virtual XSECCryptoKey * clone();
00128 
00130 
00133 
00148     virtual unsigned int signBase64Signature(unsigned char * hashBuf,
00149                         unsigned int hashLen,
00150                         char * base64SignatureBuf,
00151                         unsigned int base64SignatureBufLen);
00152 
00165     virtual bool verifyBase64Signature(unsigned char * hashBuf, 
00166                          unsigned int hashLen,
00167                          char * base64Signature,
00168                          unsigned int sigLen);
00169 
00171 
00179 
00187     virtual void loadPBase64BigNums(const char * b64, unsigned int len);
00188 
00196     virtual void loadQBase64BigNums(const char * b64, unsigned int len);
00197 
00205     virtual void loadGBase64BigNums(const char * b64, unsigned int len);
00206     
00214     virtual void loadYBase64BigNums(const char * b64, unsigned int len);
00215     
00223     virtual void loadJBase64BigNums(const char * b64, unsigned int len);
00224 
00226 
00229 
00238     unsigned int getPBase64BigNums(char * b64, unsigned int len);
00239 
00248     unsigned int getQBase64BigNums(char * b64, unsigned int len);
00249 
00258     unsigned int getGBase64BigNums(char * b64, unsigned int len);
00259 
00268     unsigned int getYBase64BigNums(char * b64, unsigned int len);
00269 
00271 
00272 private:
00273 
00274     HCRYPTPROV                  m_p;
00275     HCRYPTKEY                   m_key;      // For a public key
00276     DWORD                       m_keySpec;  // For a private key
00277 
00278     BYTE                        * mp_P;
00279     BYTE                        * mp_Q;
00280     BYTE                        * mp_G;
00281     BYTE                        * mp_Y;
00282 
00283     unsigned int                m_PLen;
00284     unsigned int                m_QLen;
00285     unsigned int                m_GLen;
00286     unsigned int                m_YLen;
00287 
00288     // Instruct to import from parameters
00289 
00290     void importKey(void);
00291     void loadParamsFromKey(void);
00292 
00293     // No default constructor
00294     WinCAPICryptoKeyDSA();
00295 };
00296 
00297 #endif /* WINCAPICRYPTOKEYDSA_INCLUDE */

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