#include <PKIFXSECCryptoSymmetricKey.h>
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 | |
PKIFXSECCryptoKeyRaw * | m_rawKey |
PKIFXSECCryptoSymmetricKeyImpl * | m_impl |
PKIFXSECCryptoSymmetricKey::PKIFXSECCryptoSymmetricKey | ( | ) |
Interface: External
Construct an empty PKIFXSECCryptoSymmetricKey object
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
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
Definition at line 137 of file PKIFXSECCryptoSymmetricKey.cpp.
void PKIFXSECCryptoSymmetricKey::setKey | ( | const unsigned char * | inBuf, | |
unsigned int | inLength | |||
) | [virtual] |
Interface: External
populate the key material from a buffer
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
PKIFXSECCryptoKeyRaw* PKIFXSECCryptoSymmetricKey::m_rawKey [protected] |
Definition at line 57 of file PKIFXSECCryptoSymmetricKey.h.
Referenced by clone(), decrypt(), decryptFinish(), decryptInit(), encrypt(), encryptFinish(), encryptInit(), getKey(), getPKIFKeyMaterial(), getProviderName(), getSymmetricKeyType(), setKey(), setPKIFKeyMaterial(), and ~PKIFXSECCryptoSymmetricKey().
PKIFXSECCryptoSymmetricKeyImpl* PKIFXSECCryptoSymmetricKey::m_impl [protected] |
Definition at line 58 of file PKIFXSECCryptoSymmetricKey.h.
Referenced by clone(), decrypt(), decryptFinish(), decryptInit(), encrypt(), encryptFinish(), encryptInit(), PKIFXSECCryptoSymmetricKey(), setKey(), setSymmetricType(), and ~PKIFXSECCryptoSymmetricKey().