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

WinCAPICryptoKeyDSA.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  * WinCAPICryptoKeyDSA := DSA Keys
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: WinCAPICryptoKeyDSA.hpp,v 1.6 2004/02/08 10:23:33 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 
00053 class DSIG_EXPORT WinCAPICryptoKeyDSA : public XSECCryptoKeyDSA {
00054 
00055 public :
00056 
00059     
00071     WinCAPICryptoKeyDSA(HCRYPTPROV prov);
00072     
00073     virtual ~WinCAPICryptoKeyDSA();
00074 
00087     WinCAPICryptoKeyDSA(HCRYPTPROV prov, HCRYPTKEY k);
00088 
00102     WinCAPICryptoKeyDSA(HCRYPTPROV prov, DWORD keySpec, bool isPrivate);
00103 
00105 
00108 
00116     virtual XSECCryptoKey::KeyType getKeyType();
00117 
00122     virtual const XMLCh * getProviderName() {return DSIGConstants::s_unicodeStrPROVWinCAPI;}
00123     
00128     virtual XSECCryptoKey * clone();
00129 
00131 
00134 
00149     virtual unsigned int signBase64Signature(unsigned char * hashBuf,
00150                         unsigned int hashLen,
00151                         char * base64SignatureBuf,
00152                         unsigned int base64SignatureBufLen);
00153 
00166     virtual bool verifyBase64Signature(unsigned char * hashBuf, 
00167                          unsigned int hashLen,
00168                          char * base64Signature,
00169                          unsigned int sigLen);
00170 
00172 
00180 
00188     virtual void loadPBase64BigNums(const char * b64, unsigned int len);
00189 
00197     virtual void loadQBase64BigNums(const char * b64, unsigned int len);
00198 
00206     virtual void loadGBase64BigNums(const char * b64, unsigned int len);
00207     
00215     virtual void loadYBase64BigNums(const char * b64, unsigned int len);
00216     
00224     virtual void loadJBase64BigNums(const char * b64, unsigned int len);
00225 
00227 
00230 
00239     unsigned int getPBase64BigNums(char * b64, unsigned int len);
00240 
00249     unsigned int getQBase64BigNums(char * b64, unsigned int len);
00250 
00259     unsigned int getGBase64BigNums(char * b64, unsigned int len);
00260 
00269     unsigned int getYBase64BigNums(char * b64, unsigned int len);
00270 
00272 
00273 private:
00274 
00275     HCRYPTPROV                  m_p;
00276     HCRYPTKEY                   m_key;      // For a public key
00277     DWORD                       m_keySpec;  // For a private key
00278 
00279     BYTE                        * mp_P;
00280     BYTE                        * mp_Q;
00281     BYTE                        * mp_G;
00282     BYTE                        * mp_Y;
00283 
00284     unsigned int                m_PLen;
00285     unsigned int                m_QLen;
00286     unsigned int                m_GLen;
00287     unsigned int                m_YLen;
00288 
00289     // Instruct to import from parameters
00290 
00291     void importKey(void);
00292     void loadParamsFromKey(void);
00293 
00294     // No default constructor
00295     WinCAPICryptoKeyDSA();
00296 };
00297 
00298 #endif /* WINCAPICRYPTOKEYDSA_INCLUDE */

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