PKIFXSECCryptoSymmetricKey.h
Go to the documentation of this file.00001
00010 #if !defined(__PKIFXSECCRYPTOSYMMETRICKEY_H__)
00011 #define __PKIFXSECCRYPTOSYMMETRICKEY_H__
00012
00013 #include "pkif.h"
00014 #include "PKIFXSECProviderDll.h"
00015
00016 #include <xsec/enc/XSECCryptoSymmetricKey.hpp>
00017 #include <xsec/utils/XSECSafeBuffer.hpp>
00018
00019 class PKIFXSECCryptoKeyRaw;
00020 struct PKIFXSECCryptoSymmetricKeyImpl;
00021
00027 class PKIFXSECCryptoSymmetricKey : public XSECCryptoSymmetricKey
00028 {
00029 public:
00030 PKIFXSECCryptoSymmetricKey();
00031 PKIFXSECCryptoSymmetricKey(IPKIFCryptoRawOperations * raw);
00032 virtual ~PKIFXSECCryptoSymmetricKey();
00033
00034 virtual void setKey(const unsigned char * inBuf, unsigned int inLength);
00035 virtual unsigned int getKey(safeBuffer &outBuf);
00036
00037 CPKIFKeyMaterialPtr getPKIFKeyMaterial();
00038 void setPKIFKeyMaterial(CPKIFKeyMaterialPtr & km);
00039
00040 virtual XSECCryptoKey * clone() const;
00041 virtual const XMLCh * getProviderName() const;
00042
00043 virtual XSECCryptoSymmetricKey::SymmetricKeyType getSymmetricKeyType() const;
00044 virtual void setSymmetricType(XSECCryptoSymmetricKey::SymmetricKeyType type);
00045 virtual bool decryptInit(bool doPad = true, SymmetricKeyMode mode = MODE_CBC,
00046 const unsigned char * iv = NULL);
00047 virtual unsigned int decrypt(const unsigned char * inBuf, unsigned char * plainBuf,
00048 unsigned int inLength, unsigned int maxOutLength);
00049 virtual unsigned int decryptFinish(unsigned char * plainBuf, unsigned int maxOutLength);
00050 virtual bool encryptInit(bool doPad = true, SymmetricKeyMode mode = MODE_CBC,
00051 const unsigned char * iv = NULL);
00052 virtual unsigned int encrypt(const unsigned char * inBuf, unsigned char * cipherBuf,
00053 unsigned int inLength, unsigned int maxOutLength);
00054 virtual unsigned int encryptFinish(unsigned char * plainBuf, unsigned int maxOutLength);
00055
00056 protected:
00057 PKIFXSECCryptoKeyRaw * m_rawKey;
00058 PKIFXSECCryptoSymmetricKeyImpl * m_impl;
00059 };
00060
00061 #endif
00062