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 369191 2006-01-15 09:14:43Z blautenb $
00025  *
00026  */
00027 
00028 #ifndef WINCAPICRYPTOKEYDSA_INCLUDE
00029 #define WINCAPICRYPTOKEYDSA_INCLUDE
00030 
00031 #include <xsec/enc/XSECCryptoKeyDSA.hpp>
00032 
00033 #if defined (HAVE_WINCAPI)
00034 
00035 #if !defined(_WIN32_WINNT)
00036 #   define _WIN32_WINNT 0x0400
00037 #endif
00038 
00039 #include <wincrypt.h>
00040 
00041 class WinCAPICryptoProvider;
00042 
00054 class DSIG_EXPORT WinCAPICryptoKeyDSA : public XSECCryptoKeyDSA {
00055 
00056 public :
00057 
00060     
00072     WinCAPICryptoKeyDSA(HCRYPTPROV prov);
00073     
00074     virtual ~WinCAPICryptoKeyDSA();
00075 
00088     WinCAPICryptoKeyDSA(HCRYPTPROV prov, HCRYPTKEY k);
00089 
00103     WinCAPICryptoKeyDSA(HCRYPTPROV prov, DWORD keySpec, bool isPrivate);
00104 
00106 
00109 
00117     virtual XSECCryptoKey::KeyType getKeyType();
00118 
00123     virtual const XMLCh * getProviderName() {return DSIGConstants::s_unicodeStrPROVWinCAPI;}
00124     
00129     virtual XSECCryptoKey * clone();
00130 
00132 
00135 
00150     virtual unsigned int signBase64Signature(unsigned char * hashBuf,
00151                         unsigned int hashLen,
00152                         char * base64SignatureBuf,
00153                         unsigned int base64SignatureBufLen);
00154 
00167     virtual bool verifyBase64Signature(unsigned char * hashBuf, 
00168                          unsigned int hashLen,
00169                          char * base64Signature,
00170                          unsigned int sigLen);
00171 
00173 
00181 
00189     virtual void loadPBase64BigNums(const char * b64, unsigned int len);
00190 
00198     virtual void loadQBase64BigNums(const char * b64, unsigned int len);
00199 
00207     virtual void loadGBase64BigNums(const char * b64, unsigned int len);
00208     
00216     virtual void loadYBase64BigNums(const char * b64, unsigned int len);
00217     
00225     virtual void loadJBase64BigNums(const char * b64, unsigned int len);
00226 
00228 
00231 
00240     unsigned int getPBase64BigNums(char * b64, unsigned int len);
00241 
00250     unsigned int getQBase64BigNums(char * b64, unsigned int len);
00251 
00260     unsigned int getGBase64BigNums(char * b64, unsigned int len);
00261 
00270     unsigned int getYBase64BigNums(char * b64, unsigned int len);
00271 
00273 
00274 private:
00275 
00276     HCRYPTPROV                  m_p;
00277     HCRYPTKEY                   m_key;      // For a public key
00278     DWORD                       m_keySpec;  // For a private key
00279 
00280     BYTE                        * mp_P;
00281     BYTE                        * mp_Q;
00282     BYTE                        * mp_G;
00283     BYTE                        * mp_Y;
00284 
00285     unsigned int                m_PLen;
00286     unsigned int                m_QLen;
00287     unsigned int                m_GLen;
00288     unsigned int                m_YLen;
00289 
00290     // Instruct to import from parameters
00291 
00292     void importKey(void);
00293     void loadParamsFromKey(void);
00294 
00295     // No default constructor
00296     WinCAPICryptoKeyDSA();
00297 };
00298 
00299 #endif /* HAVE_WINCAPI */
00300 #endif /* WINCAPICRYPTOKEYDSA_INCLUDE */

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