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

WinCAPICryptoKeyDSA Class Reference
[Windows Crypto API Interface]

#include <WinCAPICryptoKeyDSA.hpp>

Inheritance diagram for WinCAPICryptoKeyDSA:

Inheritance graph
[legend]
Collaboration diagram for WinCAPICryptoKeyDSA:

Collaboration graph
[legend]
List of all members.

Detailed Description

WinCAPI implementation class for DSA keys.

The library uses classes derived from this to process DSA keys.


Public Member Functions

Constructors and Destructors
 WinCAPICryptoKeyDSA (HCRYPTPROV prov)
 Ctor for DSA keys.
virtual ~WinCAPICryptoKeyDSA ()
 WinCAPICryptoKeyDSA (HCRYPTPROV prov, HCRYPTKEY k)
 WinCAPI Specific constructor for public keys.
 WinCAPICryptoKeyDSA (HCRYPTPROV prov, DWORD keySpec, bool isPrivate)
 WinCAPI Specific constructor for private keys.
Required Key Interface methods
virtual XSECCryptoKey::KeyType getKeyType ()
 Return the type of this key.
virtual const XMLCh * getProviderName ()
 Return the WiNCAPI string identifier.
virtual XSECCryptoKeyclone ()
 Replicate key.
Required DSA methods
virtual unsigned int signBase64Signature (unsigned char *hashBuf, unsigned int hashLen, char *base64SignatureBuf, unsigned int base64SignatureBufLen)
 Create a signature.
virtual bool verifyBase64Signature (unsigned char *hashBuf, unsigned int hashLen, char *base64Signature, unsigned int sigLen)
 Verify a signature.
Optional Interface methods
Have been fully implemented in the WinCAPI interface to allow interop testing to occur.

virtual void loadPBase64BigNums (const char *b64, unsigned int len)
 Load P.
virtual void loadQBase64BigNums (const char *b64, unsigned int len)
 Load Q.
virtual void loadGBase64BigNums (const char *b64, unsigned int len)
 Load G.
virtual void loadYBase64BigNums (const char *b64, unsigned int len)
 Load Y.
virtual void loadJBase64BigNums (const char *b64, unsigned int len)
 Load J.
WinCAPI Specific functions
unsigned int getPBase64BigNums (char *b64, unsigned int len)
 Retrieve P.
unsigned int getQBase64BigNums (char *b64, unsigned int len)
 Retrieve Q.
unsigned int getGBase64BigNums (char *b64, unsigned int len)
 Retrieve G.
unsigned int getYBase64BigNums (char *b64, unsigned int len)
 Retrieve Y.


Constructor & Destructor Documentation

WinCAPICryptoKeyDSA::WinCAPICryptoKeyDSA HCRYPTPROV  prov  ) 
 

Ctor for DSA keys.

This constructor should be used for public keys that are going to be loaded later via P, Q etc.

Parameters:
prov A handle to the provider (and key store) that will be used to hold the key being built (Obviously a provider type that supports DSS, such as DSS_PROV)

virtual WinCAPICryptoKeyDSA::~WinCAPICryptoKeyDSA  )  [virtual]
 

WinCAPICryptoKeyDSA::WinCAPICryptoKeyDSA HCRYPTPROV  prov,
HCRYPTKEY  k
 

WinCAPI Specific constructor for public keys.

Create a DSA key for use in XSEC from an existing public HCRYPTKEY

Parameters:
prov A handle to the CSP to be used for operations under this key.
k The key to use
Note:
k is owned by the library. When the wrapper WinCAPICryptoKeyDSA is deleted, k will be destroyed using CryptDestroyKey(). Note also that prov will not be released.

WinCAPICryptoKeyDSA::WinCAPICryptoKeyDSA HCRYPTPROV  prov,
DWORD  keySpec,
bool  isPrivate
 

WinCAPI Specific constructor for private keys.

Create a DSA key for use in XSEC from a passed in handle to a provider and associated key store

Parameters:
prov A handle to the CSP to be used and read for the key.
keySpec The Key to use (AT_SIGNATURE or AT_KEYEXCHANGE)
isPrivate Should be true. In future, may be able to define public keys this way as well.
Note:
The prov will not be released on close.


Member Function Documentation

virtual XSECCryptoKey* WinCAPICryptoKeyDSA::clone  )  [virtual]
 

Replicate key.

Implements XSECCryptoKeyDSA.

unsigned int WinCAPICryptoKeyDSA::getGBase64BigNums char *  b64,
unsigned int  len
 

Retrieve G.

Parameters:
b64 Buffer to place ds:CryptoBinary encoded G parameter in
len Max amount of data to be placed in buffer
Returns:
The number of bytes placed in the buffer

virtual XSECCryptoKey::KeyType WinCAPICryptoKeyDSA::getKeyType  )  [virtual]
 

Return the type of this key.

Allows the caller (and library) to determine whether this is a public key, private key or a key pair

Reimplemented from XSECCryptoKeyDSA.

unsigned int WinCAPICryptoKeyDSA::getPBase64BigNums char *  b64,
unsigned int  len
 

Retrieve P.

Parameters:
b64 Buffer to place ds:CryptoBinary encoded P parameter in
len Max amount of data to be placed in buffer
Returns:
The number of bytes placed in the buffer

virtual const XMLCh* WinCAPICryptoKeyDSA::getProviderName  )  [inline, virtual]
 

Return the WiNCAPI string identifier.

Implements XSECCryptoKey.

unsigned int WinCAPICryptoKeyDSA::getQBase64BigNums char *  b64,
unsigned int  len
 

Retrieve Q.

Parameters:
b64 Buffer to place ds:CryptoBinary encoded Q parameter in
len Max amount of data to be placed in buffer
Returns:
The number of bytes placed in the buffer

unsigned int WinCAPICryptoKeyDSA::getYBase64BigNums char *  b64,
unsigned int  len
 

Retrieve Y.

Parameters:
b64 Buffer to place ds:CryptoBinary encoded Y parameter in
len Max amount of data to be placed in buffer
Returns:
The number of bytes placed in the buffer

virtual void WinCAPICryptoKeyDSA::loadGBase64BigNums const char *  b64,
unsigned int  len
[virtual]
 

Load G.

Parameters:
b64 Base64 encoded parameter - read from XML document
len Length of the encoded string

Implements XSECCryptoKeyDSA.

virtual void WinCAPICryptoKeyDSA::loadJBase64BigNums const char *  b64,
unsigned int  len
[virtual]
 

Load J.

Parameters:
b64 Base64 encoded parameter - read from XML document
len Length of the encoded string

Implements XSECCryptoKeyDSA.

virtual void WinCAPICryptoKeyDSA::loadPBase64BigNums const char *  b64,
unsigned int  len
[virtual]
 

Load P.

Parameters:
b64 Base64 encoded parameter - read from XML document
len Length of the encoded string

Implements XSECCryptoKeyDSA.

virtual void WinCAPICryptoKeyDSA::loadQBase64BigNums const char *  b64,
unsigned int  len
[virtual]
 

Load Q.

Parameters:
b64 Base64 encoded parameter - read from XML document
len Length of the encoded string

Implements XSECCryptoKeyDSA.

virtual void WinCAPICryptoKeyDSA::loadYBase64BigNums const char *  b64,
unsigned int  len
[virtual]
 

Load Y.

Parameters:
b64 Base64 encoded parameter - read from XML document
len Length of the encoded string

Implements XSECCryptoKeyDSA.

virtual unsigned int WinCAPICryptoKeyDSA::signBase64Signature unsigned char *  hashBuf,
unsigned int  hashLen,
char *  base64SignatureBuf,
unsigned int  base64SignatureBufLen
[virtual]
 

Create a signature.

Sign the buffer using the internal private key. Will throw a DSAError if the key is not set, or is not a private key.

Parameters:
hashBuf Buffer containing the pre-calculated (binary) digest
hashLen Number of bytes of hash in the hashBuf
base64SignatureBuf Buffer to place the base64 encoded result in.
base64SignatureBufLen Implementations need to ensure they do not write more bytes than this into the buffer

Implements XSECCryptoKeyDSA.

virtual bool WinCAPICryptoKeyDSA::verifyBase64Signature unsigned char *  hashBuf,
unsigned int  hashLen,
char *  base64Signature,
unsigned int  sigLen
[virtual]
 

Verify a signature.

The library will call this function to validate a signature

Parameters:
hashBuf Buffer containing the pre-calculated (binary) digest
hashLen Length of the data in the digest buffer
base64Signature Buffer containing the Base64 encoded signature
sigLen Length of the data in the signature buffer
Returns:
true if the signature was valid, false otherwise

Implements XSECCryptoKeyDSA.


The documentation for this class was generated from the following file:
Generated on Sun Jul 3 17:43:35 2005 for XML-Security-C by  doxygen 1.4.2