PKIFXSECCryptoSymmetricKey Class Reference

#include <PKIFXSECCryptoSymmetricKey.h>

Inheritance diagram for PKIFXSECCryptoSymmetricKey:

Inheritance graph
[legend]
Collaboration diagram for PKIFXSECCryptoSymmetricKey:

Collaboration graph
[legend]

List of all members.


Detailed Description

interface used by the xml security library for symmetric key material and operations

TSP-enforcing: No

Definition at line 27 of file PKIFXSECCryptoSymmetricKey.h.


Public Member Functions

 PKIFXSECCryptoSymmetricKey ()
 PKIFXSECCryptoSymmetricKey (IPKIFCryptoRawOperations *raw)
virtual ~PKIFXSECCryptoSymmetricKey ()
virtual void setKey (const unsigned char *inBuf, unsigned int inLength)
virtual unsigned int getKey (safeBuffer &outBuf)
CPKIFKeyMaterialPtr getPKIFKeyMaterial ()
void setPKIFKeyMaterial (CPKIFKeyMaterialPtr &km)
virtual XSECCryptoKey * clone () const
virtual const XMLCh * getProviderName () const
virtual
XSECCryptoSymmetricKey::SymmetricKeyType 
getSymmetricKeyType () const
virtual void setSymmetricType (XSECCryptoSymmetricKey::SymmetricKeyType type)
virtual bool decryptInit (bool doPad=true, SymmetricKeyMode mode=MODE_CBC, const unsigned char *iv=NULL)
virtual unsigned int decrypt (const unsigned char *inBuf, unsigned char *plainBuf, unsigned int inLength, unsigned int maxOutLength)
virtual unsigned int decryptFinish (unsigned char *plainBuf, unsigned int maxOutLength)
virtual bool encryptInit (bool doPad=true, SymmetricKeyMode mode=MODE_CBC, const unsigned char *iv=NULL)
virtual unsigned int encrypt (const unsigned char *inBuf, unsigned char *cipherBuf, unsigned int inLength, unsigned int maxOutLength)
virtual unsigned int encryptFinish (unsigned char *plainBuf, unsigned int maxOutLength)

Protected Attributes

PKIFXSECCryptoKeyRawm_rawKey
PKIFXSECCryptoSymmetricKeyImpl * m_impl

Constructor & Destructor Documentation

PKIFXSECCryptoSymmetricKey::PKIFXSECCryptoSymmetricKey (  ) 

Interface: External

Construct an empty PKIFXSECCryptoSymmetricKey object

Returns:
None

Definition at line 105 of file PKIFXSECCryptoSymmetricKey.cpp.

References m_impl.

Referenced by clone().

PKIFXSECCryptoSymmetricKey::PKIFXSECCryptoSymmetricKey ( IPKIFCryptoRawOperations raw  ) 

Interface: External

Construct a PKIFXSECCryptoSymmetricKey object with the specified crypto mediator

Returns:
None
Parameters:
raw  [in] pointer to a PKIF crypto mediator to use for cipher operations

Definition at line 120 of file PKIFXSECCryptoSymmetricKey.cpp.

References m_impl.

PKIFXSECCryptoSymmetricKey::~PKIFXSECCryptoSymmetricKey (  )  [virtual]

Interface: External

free any resources used by a PKIFXSECCryptoSymmetricKey object

Returns:
None

Definition at line 137 of file PKIFXSECCryptoSymmetricKey.cpp.

References m_impl, and m_rawKey.


Member Function Documentation

void PKIFXSECCryptoSymmetricKey::setKey ( const unsigned char *  inBuf,
unsigned int  inLength 
) [virtual]

Interface: External

populate the key material from a buffer

Returns:
none
Parameters:
inBuf  [in] buffer containing key material
inLength  [in] length of buffer

Definition at line 174 of file PKIFXSECCryptoSymmetricKey.cpp.

References PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), getPKIFKeyType(), m_impl, m_rawKey, and PKIFXSECCryptoKeyRaw::setKey().

unsigned int PKIFXSECCryptoSymmetricKey::getKey ( safeBuffer &  outBuf  )  [virtual]

Interface: External

copy the key material to a caller-owned buffer

Returns:
number of bytes copied
Parameters:
outBuf  [in] buffer to receive key material

Definition at line 190 of file PKIFXSECCryptoSymmetricKey.cpp.

References PKIFXSECCryptoKeyRaw::getKey(), and m_rawKey.

CPKIFKeyMaterialPtr PKIFXSECCryptoSymmetricKey::getPKIFKeyMaterial (  ) 

Interface: External

Obtain a pointer to the PKIF key material object

n

Returns:
underlying key material object

Definition at line 204 of file PKIFXSECCryptoSymmetricKey.cpp.

References PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), and m_rawKey.

void PKIFXSECCryptoSymmetricKey::setPKIFKeyMaterial ( CPKIFKeyMaterialPtr &  km  ) 

Interface: External

Set the underlying key material object

Returns:
none
Parameters:
km  [in] PKIF key material object to use

Definition at line 216 of file PKIFXSECCryptoSymmetricKey.cpp.

References m_rawKey, and PKIFXSECCryptoKeyRaw::setPKIFKeyMaterial().

Referenced by clone().

XSECCryptoKey * PKIFXSECCryptoSymmetricKey::clone (  )  const [virtual]

Interface: External

called by the xml security library to copy a symmetric key object

Returns:
an XSECCryptoKey object with the same key material but no context

None

Definition at line 158 of file PKIFXSECCryptoSymmetricKey.cpp.

References PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), m_impl, m_rawKey, PKIFXSECCryptoSymmetricKey(), and setPKIFKeyMaterial().

const XMLCh * PKIFXSECCryptoSymmetricKey::getProviderName (  )  const [virtual]

Interface: External

Get the name of the provider

Returns:
Name of the PKIF XML provider

Definition at line 230 of file PKIFXSECCryptoSymmetricKey.cpp.

References PKIFXSECCryptoKeyRaw::getProviderName(), and m_rawKey.

XSECCryptoSymmetricKey::SymmetricKeyType PKIFXSECCryptoSymmetricKey::getSymmetricKeyType (  )  const [virtual]

Interface: External

Get the cipher

Returns:
xmlsec constant for the cipher

Definition at line 242 of file PKIFXSECCryptoSymmetricKey.cpp.

References PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), getXSECKeyType(), and m_rawKey.

void PKIFXSECCryptoSymmetricKey::setSymmetricType ( XSECCryptoSymmetricKey::SymmetricKeyType  type  )  [virtual]

Interface: External

Set the cipher

Returns:
None

Definition at line 255 of file PKIFXSECCryptoSymmetricKey.cpp.

References m_impl.

Referenced by PKIFXSECCrypto::keySymmetric().

bool PKIFXSECCryptoSymmetricKey::decryptInit ( bool  doPad = true,
SymmetricKeyMode  mode = MODE_CBC,
const unsigned char *  iv = NULL 
) [virtual]

Interface: External

initialize a decryption operation

Returns:
true if the operation was successfully initialized
Parameters:
doPad  [in] should the provider pad
mode  [in] cipher mode
iv  [in] a buffer containing the IV if necessary and available. if necessary but not available, the IV will be read from the first block of ciphertext processed

Definition at line 267 of file PKIFXSECCryptoSymmetricKey.cpp.

References CPKIFAlgorithm::BlockSize(), CPKIFAlgorithm::GetAlg(), PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), getPKIFMode(), m_impl, and m_rawKey.

unsigned int PKIFXSECCryptoSymmetricKey::decrypt ( const unsigned char *  inBuf,
unsigned char *  plainBuf,
unsigned int  inLength,
unsigned int  maxOutLength 
) [virtual]

Interface: External

decrypt the contents of a buffer

Returns:
number of bytes copied into the output buffer
Parameters:
inBuf  [in] ciphertext buffer
plainBuf  [out] buffer to receive plaintext
inLength  [in] length of ciphertext buffer
maxOutLength  [in] length of plainBuf in bytes

Definition at line 304 of file PKIFXSECCryptoSymmetricKey.cpp.

References CPKIFAlgorithm::BlockSize(), CPKIFAlgorithm::GetAlg(), PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), m_impl, m_rawKey, and CPKIFAlgorithm::NeedsIV().

unsigned int PKIFXSECCryptoSymmetricKey::decryptFinish ( unsigned char *  plainBuf,
unsigned int  maxOutLength 
) [virtual]

Interface: External

finalize the decryption operation

Returns:
number of bytes copied into the output buffer
Parameters:
plainBuf  [out] buffer to receive plaintext
maxOutLength  [in] length of plainBuf

Definition at line 343 of file PKIFXSECCryptoSymmetricKey.cpp.

References PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), m_impl, and m_rawKey.

bool PKIFXSECCryptoSymmetricKey::encryptInit ( bool  doPad = true,
SymmetricKeyMode  mode = MODE_CBC,
const unsigned char *  iv = NULL 
) [virtual]

Interface: External

initialize an encryption operation

Returns:
true if the operation was successfully initialized
Parameters:
doPad  [in] whether or not to pad if necessary
mode  [in] cipher mode
iv  [in] IV to use. if one is required and iv is NULL, a random IV will be generated

Definition at line 363 of file PKIFXSECCryptoSymmetricKey.cpp.

References CPKIFAlgorithm::BlockSize(), CPKIFAlgorithm::GetAlg(), PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), getPKIFMode(), PKIFXSECCrypto::getRandom(), m_impl, m_rawKey, and CPKIFAlgorithm::NeedsIV().

unsigned int PKIFXSECCryptoSymmetricKey::encrypt ( const unsigned char *  inBuf,
unsigned char *  cipherBuf,
unsigned int  inLength,
unsigned int  maxOutLength 
) [virtual]

Interface: External

decrypt the contents of a buffer

Returns:
number of bytes copied into the output buffer
Parameters:
inBuf  [in] plaintext buffer
cipherBuf  [out] buffer to receive ciphertext
inLength  [in] length of plaintext buffer
maxOutLength  [in] length of ciphertext buffer

Definition at line 406 of file PKIFXSECCryptoSymmetricKey.cpp.

References CPKIFAlgorithm::BlockSize(), CPKIFAlgorithm::GetAlg(), PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), m_impl, m_rawKey, and CPKIFAlgorithm::NeedsIV().

unsigned int PKIFXSECCryptoSymmetricKey::encryptFinish ( unsigned char *  plainBuf,
unsigned int  maxOutLength 
) [virtual]

Interface: External

finalize the encryption operation

Returns:
number of bytes copied into the output buffer
Parameters:
plainBuf  [out] buffer to receive ciphertext (badly named in the original API!)
maxOutLength  [in] size of plainBuf (which receives ciphertext)

Definition at line 446 of file PKIFXSECCryptoSymmetricKey.cpp.

References PKIFXSECCryptoKeyRaw::getPKIFKeyMaterial(), m_impl, and m_rawKey.


Member Data Documentation

PKIFXSECCryptoSymmetricKeyImpl* PKIFXSECCryptoSymmetricKey::m_impl [protected]


The documentation for this class was generated from the following files:

Generated on Mon Nov 15 11:21:07 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6