CACCertStatus.cpp
Go to the documentation of this file.00001
00009 #include "PKIFCertStatus.h"
00010 #include "ToolkitUtils.h"
00011 #include "components.h"
00012 #include "RevocationSource.h"
00013
00014 #include <iterator>
00015
00017 struct CPKIFCertStatusImpl {
00018 int m_nErrorCode;
00019 bool m_bSigVerified;
00020 RevocationStatus m_revStatus;
00021 bool m_bValChecks;
00022 bool m_bIsTrustAnchor;
00023
00024 IPKIFRevSourceInfoPtr m_revSource;
00025 int m_revSourceType;
00026
00027 RevocationSourceList m_rsl;
00028 };
00030
00037 CPKIFCertStatus::CPKIFCertStatus():m_impl(new CPKIFCertStatusImpl)
00038 {
00039 LOG_STRING_DEBUG("CPKIFCertStatus::CPKIFCertStatus()", TOOLKIT_PATH_MISC, 0, this);
00040
00041 m_impl->m_nErrorCode = 0;
00042 m_impl->m_bSigVerified = false;
00043 m_impl->m_revStatus = NOT_CHECKED;
00044 m_impl->m_bValChecks = false;
00045 m_impl->m_bIsTrustAnchor = false;
00046 }
00054 CPKIFCertStatus::~CPKIFCertStatus()
00055 {
00056 LOG_STRING_DEBUG("CPKIFCertStatus::~CPKIFCertStatus()", TOOLKIT_PATH_MISC, 0, this);
00057 delete m_impl;
00058 m_impl = '\0';
00059 }
00068 int CPKIFCertStatus::GetDiagnosticCode() const
00069 {
00070 return m_impl->m_nErrorCode;
00071 }
00072
00081 void CPKIFCertStatus::SetDiagnosticCode(
00083 int errorCode)
00084 {
00085 m_impl->m_nErrorCode = errorCode;
00086 }
00094 bool CPKIFCertStatus::GetSignatureVerified() const
00095 {
00096 return m_impl->m_bSigVerified;
00097 }
00105 void CPKIFCertStatus::SetSignatureVerified(
00107 bool sigVerified)
00108 {
00109 m_impl->m_bSigVerified = sigVerified;
00110 }
00119 RevocationStatus CPKIFCertStatus::GetRevocationStatus() const
00120 {
00121 return m_impl->m_revStatus;
00122 }
00131 void CPKIFCertStatus::SetRevocationStatus(
00133 RevocationStatus revStatus)
00134 {
00135 m_impl->m_revStatus = revStatus;
00136 }
00145 bool CPKIFCertStatus::GetPassedValidationChecks() const
00146 {
00147 return m_impl->m_bValChecks;
00148 }
00157 void CPKIFCertStatus::SetPassedValidationChecks(
00159 bool valChecks)
00160 {
00161 m_impl->m_bValChecks = valChecks;
00162 }
00172 bool CPKIFCertStatus::GetIsTrustAnchor()const
00173 {
00174 return m_impl->m_bIsTrustAnchor;
00175 }
00185 void CPKIFCertStatus::SetIsTrustAnchor(
00187 bool isTrustAnchor)
00188 {
00189 m_impl->m_bIsTrustAnchor = isTrustAnchor;
00190 }
00198 void CPKIFCertStatus::AddRevocationSource(
00200 int revSourceType,
00203 IPKIFRevSourceInfoPtr& revSource,
00206 RevocationStatus status,
00208 int errorCode)
00209 {
00210 LOG_STRING_DEBUG("CPKIFCertStatus::AddRevocationSource", TOOLKIT_PATH_MISC, 0, this);
00211
00212 RevocationSourcePtr rsp(new RevocationSource);
00213 rsp->m_sourceType = revSourceType;
00214 rsp->m_sourceInfo = revSource;
00215 rsp->m_status = status;
00216 rsp->m_errorCode = errorCode;
00217
00218 m_impl->m_rsl.push_back(rsp);
00219 }
00227 void CPKIFCertStatus::GetRevocationSources(
00230 RevocationSourceList& rsl)
00231 {
00232 rsl.clear();
00233 copy(m_impl->m_rsl.begin(), m_impl->m_rsl.end(), back_inserter(rsl));
00234 }
00235