00001 00009 #ifndef __PKIFKEYMATERIAL_H__ 00010 #define __PKIFKEYMATERIAL_H__ 00011 00012 #include "PKIFdll.h" 00013 #include "PKIFCryptoConstants.h" 00014 00015 FD_SMART_PTR(CPKIFSubjectPublicKeyInfo); 00016 FD_SMART_PTR(CPKIFAlgorithmIdentifier); 00017 FD_SMART_PTR(CPKIFKeyMaterial); 00025 class CAC_API CPKIFKeyMaterial 00026 { 00027 public: 00028 CPKIFKeyMaterial(void); 00029 virtual ~CPKIFKeyMaterial(void); 00030 00031 bool ContainsSymmetricKeyMaterial() const; 00032 bool ContainsCertificate() const; 00033 00034 //added during non-cert TA support mods 00035 bool ContainsPublicKeyMaterial() const; 00036 void SetSubjectPublicKeyInfo(const CPKIFSubjectPublicKeyInfoPtr& spki); 00037 CPKIFSubjectPublicKeyInfoPtr GetSubjectPublicKeyInfo() const; 00038 //end added during non-cert TA support mods 00039 00040 void SetCertificate(const unsigned char* cert, int certLen); 00041 void GetCertificate(unsigned char* cert, int* certLen) const; 00042 const unsigned char* GetCertificate() const; 00043 int GetCertificateLength() const; 00044 void SetWorkingParameters(CPKIFAlgorithmIdentifierPtr& algID); 00045 CPKIFAlgorithmIdentifierPtr GetWorkingParameters() const; 00046 00047 //eliminated unused function 8/26/2004 00048 //void SetPublicKey(const CPKIFOID& alg, unsigned char* bitStr, int bitStrLen); 00049 00050 void SetIV(const unsigned char* key, int keyLen); 00051 void GetIV(unsigned char* key, int* keyLen) const; 00052 const unsigned char* GetIV() const; 00053 00054 void SetMode(PKIFCRYPTO::SYMKEY_MODE mode); 00055 PKIFCRYPTO::SYMKEY_MODE GetMode()const; 00056 00057 void SetSymmetricKey(const unsigned char* key, int keyLen); 00058 void GetSymmetricKey(unsigned char* key, int* keyLen, PKIFCRYPTO::SYMKEY_ALG* alg) const; 00059 const unsigned char* GetSymmetricKey() const; 00060 int GetSymmetricKeyLength() const; 00061 PKIFCRYPTO::SYMKEY_ALG GetSymmetricKeyAlgorithm() const; 00062 void SetSymmetricKeyAlgorithm(PKIFCRYPTO::SYMKEY_ALG alg); 00063 00064 static CPKIFKeyMaterialPtr CreateWithSymmetricKey(const CPKIFKeyMaterialPtr & km); 00065 00066 private: 00068 CPKIFKeyMaterial(const CPKIFKeyMaterial& copy); 00070 CPKIFKeyMaterial& operator=(const CPKIFKeyMaterial& rhs); //added 4/6/2004 00071 00072 struct CPKIFKeyMaterialImpl *m_impl; 00073 00074 00075 }; 00076 DECLARE_SMART_POINTERS(CPKIFKeyMaterial); 00077 00078 #endif