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

WinCAPICryptoProvider Class Reference

#include <WinCAPICryptoProvider.hpp>

Inheritance diagram for WinCAPICryptoProvider:

Inheritance graph
[legend]
Collaboration diagram for WinCAPICryptoProvider:

Collaboration graph
[legend]
List of all members.

Windows CAPI Specific methods

HCRYPTPROV getProviderDSS (void)
 Returns the Crypto Provider being used for DSS.
HCRYPTPROV getProviderRSA (void)
 Returns the Provider being used for RSA functions.
HCRYPTPROV getApacheKeyStore (void)
 Return the internal key store provider.
virtual bool algorithmSupported (XSECCryptoSymmetricKey::SymmetricKeyType alg)
 Determine whether a given algorithm is supported.
virtual bool algorithmSupported (XSECCryptoHash::HashType alg)
 Determine whether a given algorithm is supported.
virtual XSECCryptoSymmetricKeykeySymmetric (XSECCryptoSymmetricKey::SymmetricKeyType alg)
 Return a Symmetric Key implementation object.
virtual unsigned int getRandom (unsigned char *buffer, unsigned int numOctets)
 Obtain some random octets.
static BYTE * b642WinBN (const char *b64, unsigned int b64Len, unsigned int &retLen)
 Translate B64 I2OS integer to a WinCAPI int.
static unsigned char * WinBN2b64 (BYTE *n, DWORD nLen, unsigned int &retLen)
 Translate a WinCAPI int to a B64 I2OS integer .

Public Member Functions

Constructors and Destructors
 WinCAPICryptoProvider (LPCSTR provDSSName=NULL, LPCSTR provRSAName=NULL, DWORD dwFlags=0)
 Create a Windows CAPI interface layer.
virtual ~WinCAPICryptoProvider ()
Hashing (Digest) Functions
virtual XSECCryptoHashhashSHA1 ()
 Return a SHA1 implementation.
virtual XSECCryptoHashhashSHA (int length=160)
 Return a SHA implementation.
virtual XSECCryptoHashhashHMACSHA1 ()
 Return a HMAC SHA1 implementation.
virtual XSECCryptoHashhashHMACSHA (int length=160)
 Return a HMAC SHA(1-512) implementation.
virtual XSECCryptoHashhashMD5 ()
 Return a MD5 implementation.
virtual XSECCryptoHashhashHMACMD5 ()
 Return a HMAC MD5 implementation.
virtual XSECCryptoKeyHMACkeyHMAC (void)
 Return a HMAC key.
Encoding functions
virtual XSECCryptoBase64base64 ()
 Return a Base64 encoder/decoder implementation.
Keys and Certificates
virtual XSECCryptoKeyDSAkeyDSA ()
 Return a DSA key implementation object.
virtual XSECCryptoKeyRSAkeyRSA ()
 Return an RSA key implementation object.
virtual XSECCryptoX509X509 ()
 Return an X509 implementation object.
Information Functions
virtual const XMLCh * getProviderName ()
 Returns a string that identifies the Crypto Provider.

Constructor & Destructor Documentation

WinCAPICryptoProvider::WinCAPICryptoProvider LPCSTR  provDSSName = NULL,
LPCSTR  provRSAName = NULL,
DWORD  dwFlags = 0
 

Create a Windows CAPI interface layer.

Windows CSPs work under a provider model. The user should specify which CSP to use.

Parameters:
provDSSName Name of DSS provider - must be of type PROV_DSS. Will use the default Windows DSS provider if nothing passed in.
provRSAName RSA provider - must be of type PROV_RSA_FULL. Will use the default RSA_FULL provider if nothing passed in
dwFlags If you are running XSEC as service you should specify CRYPT_MACHINE_KEYSET here

virtual WinCAPICryptoProvider::~WinCAPICryptoProvider  )  [virtual]
 


Member Function Documentation

virtual bool WinCAPICryptoProvider::algorithmSupported XSECCryptoHash::HashType  alg  )  [virtual]
 

Determine whether a given algorithm is supported.

A call that can be used to determine whether a given digest algorithm is supported

Implements XSECCryptoProvider.

virtual bool WinCAPICryptoProvider::algorithmSupported XSECCryptoSymmetricKey::SymmetricKeyType  alg  )  [virtual]
 

Determine whether a given algorithm is supported.

A call that can be used to determine whether a given symmetric algorithm is supported

Implements XSECCryptoProvider.

static BYTE* WinCAPICryptoProvider::b642WinBN const char *  b64,
unsigned int  b64Len,
unsigned int &  retLen
[static]
 

Translate B64 I2OS integer to a WinCAPI int.

Decodes a Base64 (ds:CryptoBinary) integer and reverses the order to allow loading into a Windows CAPI function. (CAPI uses Little Endian storage of integers).

Parameters:
b64 Base 64 string
b64Len Length of base64 string
retLen Parameter to hold length of return integer

virtual XSECCryptoBase64* WinCAPICryptoProvider::base64  )  [virtual]
 

Return a Base64 encoder/decoder implementation.

Call used by the library to obtain a Base64 encoder/decoder.

Note:
Windows providers do not implement Base64, so the internal implementation (XSCrypt) is used instead.
Returns:
Pointer to the new Base64 encoder.
See also:
XSCryptCryptoBase64

Implements XSECCryptoProvider.

HCRYPTPROV WinCAPICryptoProvider::getApacheKeyStore void   )  [inline]
 

Return the internal key store provider.

HCRYPTPROV WinCAPICryptoProvider::getProviderDSS void   )  [inline]
 

Returns the Crypto Provider being used for DSS.

virtual const XMLCh* WinCAPICryptoProvider::getProviderName  )  [virtual]
 

Returns a string that identifies the Crypto Provider.

Implements XSECCryptoProvider.

HCRYPTPROV WinCAPICryptoProvider::getProviderRSA void   )  [inline]
 

Returns the Provider being used for RSA functions.

virtual unsigned int WinCAPICryptoProvider::getRandom unsigned char *  buffer,
unsigned int  numOctets
[virtual]
 

Obtain some random octets.

For generation of IVs and the like, the library needs to be able to obtain "random" octets. The library uses this call to the crypto provider to obtain what it needs.

Parameters:
buffer The buffer to place the random data in
numOctets Number of bytes required
Returns:
Number of bytes obtained.

Implements XSECCryptoProvider.

virtual XSECCryptoHash* WinCAPICryptoProvider::hashHMACMD5  )  [virtual]
 

Return a HMAC MD5 implementation.

Call used by the library to obtain a HMAC MD5 object from the provider. The caller will need to set the key in the hash object with an XSECCryptoKeyHMAC using XSECCryptoHash::setKey()

Note:
The use of MD5 is explicitly marked as not recommended in the XML Digital Signature standard due to recent advances in cryptography indicating there may be weaknesses in the algorithm.
Returns:
A pointer to a Hash object that implements HMAC-MD5
See also:
WinCAPICryptoHash

Implements XSECCryptoProvider.

virtual XSECCryptoHash* WinCAPICryptoProvider::hashHMACSHA int  length = 160  )  [virtual]
 

Return a HMAC SHA(1-512) implementation.

Call used by the library to obtain a HMAC SHA object from the provider. The caller will need to set the key in the hash object with an XSECCryptoKeyHMAC using XSECCryptoHash::setKey()

Returns:
A pointer to a Hash object that implements HMAC-SHA1
Parameters:
length Length of hash output (160 = SHA1, 256, 512 etc)
See also:
WinCAPICryptoHash

Implements XSECCryptoProvider.

virtual XSECCryptoHash* WinCAPICryptoProvider::hashHMACSHA1  )  [virtual]
 

Return a HMAC SHA1 implementation.

Call used by the library to obtain a HMAC SHA1 object from the provider. The caller will need to set the key in the hash object with an XSECCryptoKeyHMAC using WinCAPICryptoHash::setKey()

Returns:
A pointer to a Hash object that implements HMAC-SHA1
See also:
WinCAPICryptoHash

Implements XSECCryptoProvider.

virtual XSECCryptoHash* WinCAPICryptoProvider::hashMD5  )  [virtual]
 

Return a MD5 implementation.

Call used by the library to obtain a MD5 object from the WiNCAPI provider.

Returns:
A pointer to a Hash object that implements MD5
See also:
WinCAPICryptoHash

Implements XSECCryptoProvider.

virtual XSECCryptoHash* WinCAPICryptoProvider::hashSHA int  length = 160  )  [virtual]
 

Return a SHA implementation.

Call used by the library to obtain a SHA object from the provider. Size of hash determined by length argument (160 = SHA1)

Returns:
A pointer to a Hash object that implements SHA1
Parameters:
length - length of hash. E.g. 160 for SHA1 or 256 for SHA256
See also:
WinCAPICryptoHash

Implements XSECCryptoProvider.

virtual XSECCryptoHash* WinCAPICryptoProvider::hashSHA1  )  [virtual]
 

Return a SHA1 implementation.

Call used by the library to obtain a SHA1 object from the provider.

Returns:
A pointer to an WinCAPI Hash object that implements SHA1
See also:
WinCAPICryptoHash

Implements XSECCryptoProvider.

virtual XSECCryptoKeyDSA* WinCAPICryptoProvider::keyDSA  )  [virtual]
 

Return a DSA key implementation object.

Call used by the library to obtain a DSA key object.

Returns:
Pointer to the new DSA key
See also:
WinCAPICryptoKeyDSA

Implements XSECCryptoProvider.

virtual XSECCryptoKeyHMAC* WinCAPICryptoProvider::keyHMAC void   )  [virtual]
 

Return a HMAC key.

Sometimes the library needs to create an HMAC key (notably within the XKMS utilities.

This function allows the library to obtain a key that can then have a value set within it.

Implements XSECCryptoProvider.

virtual XSECCryptoKeyRSA* WinCAPICryptoProvider::keyRSA  )  [virtual]
 

Return an RSA key implementation object.

Call used by the library to obtain an WinCAPI RSA key object.

Returns:
Pointer to the new RSA key
See also:
WinCAPICryptoKeyRSA

Implements XSECCryptoProvider.

virtual XSECCryptoSymmetricKey* WinCAPICryptoProvider::keySymmetric XSECCryptoSymmetricKey::SymmetricKeyType  alg  )  [virtual]
 

Return a Symmetric Key implementation object.

Call used by the library to obtain a bulk encryption object.

Returns:
Pointer to the new SymmetricKey object
See also:
XSECCryptoSymmetricKey

Implements XSECCryptoProvider.

static unsigned char* WinCAPICryptoProvider::WinBN2b64 BYTE *  n,
DWORD  nLen,
unsigned int &  retLen
[static]
 

Translate a WinCAPI int to a B64 I2OS integer .

Encodes a Windows integer in I2OSP base64 encoded format.

Parameters:
n Buffer holding the Windows Integer
nLen Length of data in buffer
retLen Parameter to hold length of return integer
Returns:
A pointer to a buffer holding the encoded data (transfers ownership)

virtual XSECCryptoX509* WinCAPICryptoProvider::X509  )  [virtual]
 

Return an X509 implementation object.

Call used by the library to obtain an object that can work with X509 certificates.

Returns:
Pointer to the new X509 object
See also:
WinCAPICryptoX509

Implements XSECCryptoProvider.


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