CACCredential.cpp
Go to the documentation of this file.00001
00009 #include "PKIFCredential.h"
00010 #include "ToolkitUtils.h"
00011 #include "components.h"
00012 #include "Certificate.h"
00013 #include "PKIFKeyMaterial.h"
00014 #include "Buffer.h"
00015
00023 CPKIFCredential::CPKIFCredential(void)
00024 {
00025 LOG_STRING_DEBUG("CPKIFCredential::CPKIFCredential(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00026 }
00027
00035 CPKIFCredential::~CPKIFCredential(void)
00036 {
00037 LOG_STRING_DEBUG("CPKIFCredential::~CPKIFCredential(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00038 }
00054 const char* CPKIFCredential::Name() const
00055 {
00056 LOG_STRING_DEBUG("CPKIFCredential::Name", TOOLKIT_CRYPTO_MISC, 0, this);
00057
00058
00059 if(m_name != (std::string*) NULL)
00060 return m_name->c_str();
00061 else
00062 return NULL;
00063 }
00064
00075 const char* CPKIFCredential::ID() const
00076 {
00077 LOG_STRING_DEBUG("CPKIFCredential::ID", TOOLKIT_CRYPTO_MISC, 0, this);
00078
00079
00080 if(m_id != (std::string*) NULL)
00081 return m_id->c_str();
00082 else
00083 return NULL;
00084 }
00085
00097 CPKIFKeyMaterialPtr CPKIFCredential::GetPublicKey() const
00098 {
00099 LOG_STRING_DEBUG("CPKIFCredential::GetPublicKey", TOOLKIT_CRYPTO_MISC, 0, this);
00100
00101 CPKIFKeyMaterialPtr rv;
00102 CPKIFCertificatePtr cert = GetCertificate();
00103 if(!cert) return rv;
00104 CPKIFBufferPtr encCert = cert->Encoded();
00105 rv = CPKIFKeyMaterialPtr(new CPKIFKeyMaterial());
00106 rv->SetCertificate(encCert->GetBuffer(), encCert->GetLength());
00107 return rv;
00108 }