00001
00010 #include "ValPolResponse.h"
00011 #include "components.h"
00012 #include "ToolkitUtils.h"
00013 #include "Buffer.h"
00014 #include "PKIFSCVPErrors.h"
00015 #include "SCVPException.h"
00016 #include "ASN1Helper.h"
00017 #include "SCVP.h"
00018
00019 #include "AlgorithmIdentifier.h"
00020 #include "Buffer.h"
00021 #include "OID.h"
00022 #include "PKIFTime.h"
00023 #include "ValidationPolicy.h"
00024 #include "Name.h"
00025 #include "RevocationInfo.h"
00026 #include "ReplyCheck.h"
00027 #include "ReplyWantBack.h"
00028 #include "private/PKIFSCVPMemoryHelper.h"
00029 #include "KeyAgreePublicKey.h"
00030 #include "PolicyInformation.h"
00031 #include "PKCReference.h"
00032 #include "Certificate.h"
00033 #include "SCVPCertID.h"
00034 #include "KeyUsage.h"
00035 #include "PKIFMessageErrors.h"
00036 #include "KeyAgreePublicKey.h"
00037 #include "private/SCVPUtils.h"
00038
00040
00041 struct CPKIFValPolResponseImpl
00042 {
00043 int m_vpResponseVersion;
00044 int m_maxCVRequestVersion;
00045 int m_maxVPRequestVersion;
00046 int m_serverConfigurationID;
00047 CPKIFTimePtr m_thisUpdate;
00048 CPKIFTimePtr m_nextUpdate;
00049 CPKIFOIDListPtr m_supportedChecks;
00050 CPKIFOIDListPtr m_supportedWantBacks;
00051 CPKIFOIDListPtr m_validationPolicies;
00052 CPKIFOIDListPtr m_validationAlgs;
00053 CPKIFOIDListPtr m_authPolicies;
00054 SCVPResponseTypes m_responseTypes;
00055 CPKIFValidationPolicyPtr m_defaultPolicyValues;
00056 std::bitset<4> m_revocationInfoTypes;
00057 CPKIFAlgorithmIdentifierListPtr m_signatureGeneration;
00058 CPKIFAlgorithmIdentifierListPtr m_signatureVerification;
00059 CPKIFOIDListPtr m_hashAlgorithms;
00060 CPKIFKeyAgreePublicKeyListPtr m_serverPublicKeys;
00061 int m_clockSkew;
00062 CPKIFBufferPtr m_requestNonce;
00063
00064
00065 CPKIFASNWrapper<ValPolResponse>* m_scvpValPolResp;
00066
00067
00068
00069
00070 void ClearAllMembers();
00071 void MakeValPolResp();
00072 void FreeValPolResp();
00073
00074 void CallingAllGets();
00075
00076 CPKIFValPolResponse * m_parent;
00077 };
00078
00086 void CPKIFValPolResponseImpl::CallingAllGets()
00087 {
00088 LOG_STRING_DEBUG("CPKIFCVResponse::CallingAllGets()", TOOLKIT_SCVP_ASN, 0, this);
00089
00090 m_parent->GetRequestNonce();
00091 FreeValPolResp();
00092 }
00093
00101 void CPKIFValPolResponseImpl::MakeValPolResp()
00102 {
00103 LOG_STRING_DEBUG("CPKIFValPolResponseImpl::MakeSCVPR()", TOOLKIT_SCVP_ASN, 0, this);
00104
00105 FreeValPolResp();
00106 m_scvpValPolResp = new CPKIFASNWrapper<ValPolResponse>( BEREncValPolResponse, BERDecValPolResponse );
00107 }
00108
00116 void CPKIFValPolResponseImpl::FreeValPolResp()
00117 {
00118 LOG_STRING_DEBUG("CPKIFValPolResponseImpl::FreeSCVPR()", TOOLKIT_SCVP_ASN, 0, this);
00119 if(NULL != m_scvpValPolResp)
00120 delete m_scvpValPolResp;
00121 m_scvpValPolResp = NULL;
00122 }
00123
00132 void CPKIFValPolResponseImpl::ClearAllMembers()
00133 {
00134 LOG_STRING_DEBUG("CPKIFValPolResponseImpl::ClearAllMembers()", TOOLKIT_SCVP_ASN, 0, this);
00135
00136
00137 CPKIFBufferPtr tmpStr;
00138 m_requestNonce = tmpStr;
00139
00140 m_vpResponseVersion = 0;
00141 m_maxCVRequestVersion = 0;
00142 m_maxVPRequestVersion = 0;
00143 m_serverConfigurationID = 0;
00144
00145
00146 m_clockSkew = 10;
00147
00148 FreeValPolResp();
00149 }
00150
00152
00161 CPKIFValPolResponse::CPKIFValPolResponse() :m_impl(new CPKIFValPolResponseImpl)
00162 {
00163 LOG_STRING_DEBUG("CPKIFValPolResponse::CPKIFValPolResponse()", TOOLKIT_SCVP_ASN, 0, this);
00164
00165 m_impl->m_parent = this;
00166
00167 m_impl->m_vpResponseVersion = 1;
00168 m_impl->m_maxCVRequestVersion = 1;
00169 m_impl->m_maxVPRequestVersion = 1;
00170 m_impl->m_serverConfigurationID = 0;
00171
00172
00173 m_impl->m_clockSkew = 10;
00174
00175
00176 m_impl->m_scvpValPolResp = NULL;
00177 }
00188 CPKIFValPolResponse::CPKIFValPolResponse(
00190 const CPKIFBufferPtr& valPolResponse)
00191 :m_impl (new CPKIFValPolResponseImpl)
00192 {
00193 if(valPolResponse == (CPKIFBuffer*)NULL || 0 == valPolResponse->GetLength())
00194 {
00195 throw CPKIFSCVPException(TOOLKIT_SCVP_ASN, COMMON_INVALID_INPUT);
00196 }
00197
00198 CACASNWRAPPER_CREATE(ValPolResponse, objPDU);
00199 objPDU.Decode(valPolResponse->GetBuffer(), valPolResponse->GetLength());
00200
00201
00202 }
00210 CPKIFValPolResponse::~CPKIFValPolResponse()
00211 {
00212 LOG_STRING_DEBUG("CPKIFValPolResponse::~CPKIFValPolResponse()", TOOLKIT_SCVP_ASN, 0, this);
00213
00214 m_impl->FreeValPolResp();
00215
00216 if (m_impl)
00217 {
00218 delete m_impl;
00219 }
00220 }
00228 int CPKIFValPolResponse::GetVersion() const
00229 {
00230 return m_impl->m_vpResponseVersion;
00231 }
00232
00240 void CPKIFValPolResponse::SetVersion(int v)
00241 {
00242 m_impl->m_vpResponseVersion = v;
00243 }
00251 void CPKIFValPolResponse::SetVpResponseVersion(
00253 int vpResponseVersion)
00254 {
00255 m_impl->m_vpResponseVersion = vpResponseVersion;
00256 }
00264 const int CPKIFValPolResponse::GetVpResponseVersion() const
00265 {
00266 return m_impl->m_vpResponseVersion;
00267 }
00275 void CPKIFValPolResponse::SetMaxCVRequestVersion(
00277 int maxCVRequestVersion)
00278 {
00279 m_impl->m_maxCVRequestVersion = maxCVRequestVersion;
00280 }
00288 const int CPKIFValPolResponse::GetMaxCVRequestVersion() const
00289 {
00290 return m_impl->m_maxCVRequestVersion;
00291 }
00299 void CPKIFValPolResponse::SetMaxVPRequestVersion(
00301 int maxVPRequestVersion)
00302 {
00303 m_impl->m_maxVPRequestVersion = maxVPRequestVersion;
00304 }
00312 const int CPKIFValPolResponse::GetMaxVPRequestVersion() const
00313 {
00314 return m_impl->m_maxVPRequestVersion;
00315 }
00323 void CPKIFValPolResponse::SetServerConfigurationID(
00325 int serverConfigurationID)
00326 {
00327 m_impl->m_serverConfigurationID = serverConfigurationID;
00328 }
00336 const int CPKIFValPolResponse::GetServerConfigurationID() const
00337 {
00338 return m_impl->m_serverConfigurationID;
00339 }
00347 void CPKIFValPolResponse::SetThisUpdate(
00349 const CPKIFTimePtr& thisUpdate)
00350 {
00351 m_impl->m_thisUpdate = thisUpdate;
00352 }
00360 const CPKIFTimePtr CPKIFValPolResponse::GetThisUpdate() const
00361 {
00362 return m_impl->m_thisUpdate;
00363 }
00371 void CPKIFValPolResponse::SetSupportedChecks(
00373 CPKIFOIDListPtr& supportedChecks)
00374 {
00375 m_impl->m_supportedChecks = supportedChecks;
00376 }
00384 void CPKIFValPolResponse::GetSupportedChecks(
00386 CPKIFOIDListPtr& supportedChecks)
00387 {
00388 supportedChecks = m_impl->m_supportedChecks;
00389 }
00397 void CPKIFValPolResponse::SetSupportedWantBacks(
00399 CPKIFOIDListPtr& supportedWantBacks)
00400 {
00401 m_impl->m_supportedWantBacks = supportedWantBacks;
00402 }
00410 void CPKIFValPolResponse::GetSupportedWantBacks(
00412 CPKIFOIDListPtr& supportedWantBacks)
00413 {
00414 supportedWantBacks = m_impl->m_supportedWantBacks;
00415 }
00423 void CPKIFValPolResponse::SetValidationPolicies(
00425 CPKIFOIDListPtr& validationPolicies)
00426 {
00427 m_impl->m_validationPolicies = validationPolicies;
00428 }
00436 void CPKIFValPolResponse::GetValidationPolicies(
00438 CPKIFOIDListPtr& validationPolicies)
00439 {
00440 validationPolicies = m_impl->m_validationPolicies;
00441 }
00449 void CPKIFValPolResponse::SetValidationAlgs(
00451 CPKIFOIDListPtr& validationAlgs)
00452 {
00453 m_impl->m_validationAlgs = validationAlgs;
00454 }
00462 void CPKIFValPolResponse::GetValidationAlgs(
00464 CPKIFOIDListPtr& validationAlgs)
00465 {
00466 validationAlgs = m_impl->m_validationAlgs;
00467 }
00475 void CPKIFValPolResponse::SetAuthPolicies(
00477 CPKIFOIDListPtr& authPolicies)
00478 {
00479 m_impl->m_authPolicies = authPolicies;
00480 }
00488 void CPKIFValPolResponse::GetAuthPolicies(
00490 CPKIFOIDListPtr& authPolicies)
00491 {
00492 authPolicies = m_impl->m_authPolicies;
00493 }
00501 void CPKIFValPolResponse::SetResponseTypes(
00503 SCVPResponseTypes responseTypes)
00504 {
00505 m_impl->m_responseTypes = responseTypes;
00506 }
00514 const SCVPResponseTypes CPKIFValPolResponse::GetResponseTypes() const
00515 {
00516 return m_impl->m_responseTypes;
00517 }
00525 void CPKIFValPolResponse::SetRespValidationPolicy(
00527 CPKIFValidationPolicyPtr& respValidationPolicy)
00528 {
00529 m_impl->m_defaultPolicyValues = respValidationPolicy;
00530 }
00538 const CPKIFValidationPolicyPtr CPKIFValPolResponse::GetRespValidationPolicy() const
00539 {
00540 return m_impl->m_defaultPolicyValues;
00541 }
00549 void CPKIFValPolResponse::SetRevocationInfoTypes(
00551 std::bitset<4> revocationInfoTypes)
00552 {
00553 m_impl->m_revocationInfoTypes = revocationInfoTypes;
00554 }
00562 const std::bitset<4> CPKIFValPolResponse::GetRevocationInfoTypes() const
00563 {
00564 return m_impl->m_revocationInfoTypes;
00565 }
00573 void CPKIFValPolResponse::SetSignatureGeneration(
00575 CPKIFAlgorithmIdentifierListPtr & signatureGeneration)
00576 {
00577 m_impl->m_signatureGeneration = signatureGeneration;
00578 }
00586 void CPKIFValPolResponse::GetSignatureGeneration(
00588 CPKIFAlgorithmIdentifierListPtr & signatureGeneration)
00589 {
00590 signatureGeneration = m_impl->m_signatureGeneration;
00591 }
00599 void CPKIFValPolResponse::SetSignatureVerification(
00601 CPKIFAlgorithmIdentifierListPtr & signatureVerification)
00602 {
00603 m_impl->m_signatureVerification = signatureVerification;
00604 }
00612 void CPKIFValPolResponse::GetSignatureVerification(
00614 CPKIFAlgorithmIdentifierListPtr & signatureVerification)
00615 {
00616 signatureVerification = m_impl->m_signatureVerification;
00617 }
00625 void CPKIFValPolResponse::SetHashAlgorithms(
00627 CPKIFOIDListPtr& hashAlgorithms)
00628 {
00629 m_impl->m_hashAlgorithms = hashAlgorithms;
00630 }
00638 void CPKIFValPolResponse::GetHashAlgorithms(
00640 CPKIFOIDListPtr& hashAlgorithms)
00641 {
00642 hashAlgorithms = m_impl->m_hashAlgorithms;
00643 }
00651 void CPKIFValPolResponse::SetClockSkew(
00653 int clockSkew)
00654 {
00655 m_impl->m_clockSkew = clockSkew;
00656 }
00664 const int CPKIFValPolResponse::GetClockSkew() const
00665 {
00666 return m_impl->m_clockSkew;
00667 }
00668
00669
00677 void CPKIFValPolResponse::SetNextUpdate(
00679 CPKIFTimePtr& nextUpdate)
00680 {
00681 m_impl->m_nextUpdate = nextUpdate;
00682 }
00690 const CPKIFTimePtr CPKIFValPolResponse::GetNextUpdate() const
00691 {
00692 return m_impl->m_nextUpdate;
00693 }
00701 void CPKIFValPolResponse::SetRequestNonce(
00703 CPKIFBufferPtr& requestNonce)
00704 {
00705 m_impl->m_requestNonce = requestNonce;
00706 }
00714 const CPKIFBufferPtr CPKIFValPolResponse::GetRequestNonce() const
00715 {
00716 return m_impl->m_requestNonce;
00717 }
00725 void CPKIFValPolResponse::SetKeyAgreePublicKeys(
00727 CPKIFKeyAgreePublicKeyListPtr& keyAgreePublicKey)
00728 {
00729 m_impl->m_serverPublicKeys = keyAgreePublicKey;
00730 }
00738 void CPKIFValPolResponse::GetKeyAgreePublicKeys(
00740 CPKIFKeyAgreePublicKeyListPtr& keyAgreePublicKey)
00741 {
00742 keyAgreePublicKey = m_impl->m_serverPublicKeys;
00743 }
00744
00755 CPKIFBufferPtr CPKIFValPolResponse::Encode() const
00756 {
00757 LOG_STRING_DEBUG("CPKIFValPolResponse::Encode()", TOOLKIT_SCVP_ASN, 0, this);
00758
00759
00760
00761
00762 PKIFSCVPMemoryHelper mhValPolResponse;
00763 mhValPolResponse.pValPolResponse = new ValPolResponse;
00764 memset(mhValPolResponse.pValPolResponse, 0, sizeof(ValPolResponse));
00765
00766 OOCTXT ctxt;
00767 initContext (&ctxt);
00768
00769
00770 if(0 == m_impl->m_vpResponseVersion )
00771 {
00772 throw CPKIFSCVPException(TOOLKIT_SCVP, SCVP_MISSING_REQUIRED_FIELD, "vpResponseVersion value not specified.");
00773 }
00774 else
00775 {
00776 mhValPolResponse.pValPolResponse->vpResponseVersion = m_impl->m_vpResponseVersion;
00777 }
00778
00779 if(0 == m_impl->m_maxCVRequestVersion )
00780 {
00781 throw CPKIFSCVPException(TOOLKIT_SCVP, SCVP_MISSING_REQUIRED_FIELD, "maxCVRequestVersion value not specified.");
00782 }
00783 else
00784 {
00785 mhValPolResponse.pValPolResponse->maxCVRequestVersion = m_impl->m_maxCVRequestVersion;
00786 }
00787
00788 if(0 == m_impl->m_maxVPRequestVersion)
00789 {
00790 throw CPKIFSCVPException(TOOLKIT_SCVP, SCVP_MISSING_REQUIRED_FIELD, "maxVPRequestVersion value not specified.");
00791 }
00792 else
00793 {
00794 mhValPolResponse.pValPolResponse->maxVPRequestVersion = m_impl->m_maxVPRequestVersion;
00795 }
00796
00797 if(0 == m_impl->m_serverConfigurationID)
00798 {
00799 throw CPKIFSCVPException(TOOLKIT_SCVP, SCVP_MISSING_REQUIRED_FIELD, "serverConfigurationID value not specified.");
00800 }
00801 else
00802 {
00803 mhValPolResponse.pValPolResponse->serverConfigurationID = m_impl->m_serverConfigurationID;
00804 }
00805
00806 if(10 != m_impl->m_clockSkew)
00807 {
00808 mhValPolResponse.pValPolResponse->clockSkew = m_impl->m_clockSkew;
00809 }
00810
00811 if(m_impl->m_thisUpdate != (CPKIFTime*)NULL)
00812 {
00813 mhValPolResponse.pValPolResponse->thisUpdate = m_impl->m_thisUpdate->GetTime();
00814 }
00815 else
00816 {
00817 throw CPKIFSCVPException(TOOLKIT_SCVP, SCVP_MISSING_REQUIRED_FIELD, "thisUpdate value not specified.");
00818 }
00819
00820 if(m_impl->m_nextUpdate != (CPKIFTime*)NULL)
00821 {
00822 mhValPolResponse.pValPolResponse->nextUpdate = m_impl->m_nextUpdate->GetTime();
00823
00824 mhValPolResponse.pValPolResponse->m.nextUpdatePresent = 1;
00825 }
00826
00827 PopulateDListWithASN1OBJID(&mhValPolResponse.pValPolResponse->supportedChecks, m_impl->m_supportedChecks);
00828
00829 PopulateDListWithASN1OBJID(&mhValPolResponse.pValPolResponse->supportedWantBacks, m_impl->m_supportedWantBacks);
00830
00831 PopulateDListWithASN1OBJID(&mhValPolResponse.pValPolResponse->validationPolicies, m_impl->m_validationPolicies);
00832
00833 PopulateDListWithASN1OBJID(&mhValPolResponse.pValPolResponse->validationAlgs, m_impl->m_validationAlgs);
00834
00835 PopulateDListWithASN1OBJID(&mhValPolResponse.pValPolResponse->authPolicies, m_impl->m_authPolicies);
00836
00837 mhValPolResponse.pValPolResponse->responseTypes = m_impl->m_responseTypes;
00838
00839 PopulateValidationPolicy(&mhValPolResponse.pValPolResponse->defaultPolicyValues, m_impl->m_defaultPolicyValues, ctxt);
00840
00841 if(m_impl->m_revocationInfoTypes[FULLCRLS])
00842 {
00843 mhValPolResponse.pValPolResponse->revocationInfoTypes.data[0] |= BitMfullCRLs;
00844 mhValPolResponse.pValPolResponse->revocationInfoTypes.numbits = 1;
00845 }
00846 if(m_impl->m_revocationInfoTypes[DELTACRLS])
00847 {
00848 mhValPolResponse.pValPolResponse->revocationInfoTypes.data[0] |= BitMdeltaCRLs;
00849 mhValPolResponse.pValPolResponse->revocationInfoTypes.numbits = 2;
00850 }
00851 if(m_impl->m_revocationInfoTypes[INDIRECTCRLS])
00852 {
00853 mhValPolResponse.pValPolResponse->revocationInfoTypes.data[0] |= BitMindirectCRLs;
00854 mhValPolResponse.pValPolResponse->revocationInfoTypes.numbits = 3;
00855 }
00856 if(m_impl->m_revocationInfoTypes[OCSPRESPONSES])
00857 {
00858 mhValPolResponse.pValPolResponse->revocationInfoTypes.data[0] |= BitMoCSPResponses;
00859 mhValPolResponse.pValPolResponse->revocationInfoTypes.numbits = 4;
00860 }
00861
00862 PopulateDListWithCACX509V3AlgorithmIdentifier(&mhValPolResponse.pValPolResponse->signatureGeneration, m_impl->m_signatureGeneration);
00863
00864 PopulateDListWithCACX509V3AlgorithmIdentifier(&mhValPolResponse.pValPolResponse->signatureVerification, m_impl->m_signatureVerification);
00865
00866 PopulateDListWithASN1OBJID(&mhValPolResponse.pValPolResponse->hashAlgorithms, m_impl->m_hashAlgorithms);
00867
00868
00869 if(m_impl->m_serverPublicKeys!= (CPKIFKeyAgreePublicKeyList*)NULL && !m_impl->m_serverPublicKeys->empty())
00870 {
00871 DListNode* cur = NULL;
00872
00873 CPKIFKeyAgreePublicKeyList::iterator pos;
00874 CPKIFKeyAgreePublicKeyList::iterator end = m_impl->m_serverPublicKeys->end();
00875 for(pos = m_impl->m_serverPublicKeys->begin(); pos != end; ++pos)
00876 {
00877 if(NULL == cur)
00878 {
00879 NEW_NODE(cur)
00880 }
00881 else
00882 {
00883 NEW_NEXT_AND_ADVANCE(cur)
00884 }
00885 KeyAgreePublicKey* tmpKeyAgreePubKey = new KeyAgreePublicKey;
00886 memset(tmpKeyAgreePubKey, 0, sizeof(KeyAgreePublicKey));
00887
00888 PopulateKeyAgreePublicKey(&tmpKeyAgreePubKey->algorithm, (*pos)->GetAlgorithm());
00889
00890 PopulateKeyAgreePublicKey(&tmpKeyAgreePubKey->macAlgorithm, (*pos)->GetMACAlgorithm());
00891
00892 if((*pos)->GetKDF() != (CPKIFAlgorithmIdentifier*)NULL)
00893 {
00894 PopulateKeyAgreePublicKey(&tmpKeyAgreePubKey->kDF, (*pos)->GetKDF());
00895
00896 tmpKeyAgreePubKey->m.kDFPresent = 1;
00897 }
00898
00899 tmpKeyAgreePubKey->publicKey.data = (*pos)->GetPublicKey()->GetBuffer();
00900 tmpKeyAgreePubKey->publicKey.numbits = (*pos)->GetPublicKey()->GetLength()*8;
00901
00902
00903 cur->data = tmpKeyAgreePubKey;
00904
00905 SET_HEAD_TAIL_INCREMENT(mhValPolResponse.pValPolResponse->serverPublicKeys, cur)
00906 }
00907
00908 mhValPolResponse.pValPolResponse->m.serverPublicKeysPresent = 1;
00909 }
00910
00911 if(m_impl->m_requestNonce != (CPKIFBuffer*)NULL)
00912 {
00913 mhValPolResponse.pValPolResponse->requestNonce.data = m_impl->m_requestNonce->GetBuffer();
00914 mhValPolResponse.pValPolResponse->requestNonce.numocts = m_impl->m_requestNonce->GetLength();
00915 mhValPolResponse.pValPolResponse->m.requestNoncePresent = 1;
00916
00917 }
00918
00919 CACASNWRAPPER_CREATE(ValPolResponse, objPDU);
00920 ASN1OpenType* data1 = objPDU.Encode(mhValPolResponse.pValPolResponse);
00921 CPKIFBufferPtr tmp(new CPKIFBuffer(data1->data, data1->numocts));
00922 delete data1;
00923
00924 freeEncodeBuffer(&ctxt);
00925 memFreeAll(&ctxt);
00926
00927 return tmp;
00928 }
00929
00930
00941 void CPKIFValPolResponse::Decode(CPKIFBufferPtr& encoded) const
00942 {
00943 m_impl->ClearAllMembers();
00944
00945
00946 if(encoded == (CPKIFBuffer*)NULL || 0 == encoded->GetLength())
00947 {
00948 throw CPKIFSCVPException(TOOLKIT_SCVP_ASN, COMMON_INVALID_INPUT);
00949 }
00950
00951 m_impl->MakeValPolResp();
00952
00953 try
00954 {
00955 (*m_impl->m_scvpValPolResp).Decode(encoded->GetBuffer(), encoded->GetLength());
00956
00957
00958 m_impl->m_vpResponseVersion = (*m_impl->m_scvpValPolResp)->vpResponseVersion;
00959
00960
00961 m_impl->m_maxCVRequestVersion = (*m_impl->m_scvpValPolResp)->maxCVRequestVersion;
00962
00963
00964 m_impl->m_maxVPRequestVersion = (*m_impl->m_scvpValPolResp)->maxVPRequestVersion;
00965
00966
00967 m_impl->m_serverConfigurationID = (*m_impl->m_scvpValPolResp)->serverConfigurationID;
00968
00969
00970 CPKIFTimePtr tmpTime(new CPKIFTime((*m_impl->m_scvpValPolResp)->thisUpdate));
00971 m_impl->m_thisUpdate = tmpTime;
00972
00973
00974 if((*m_impl->m_scvpValPolResp)->m.nextUpdatePresent)
00975 {
00976 CPKIFTimePtr tmpTime2(new CPKIFTime((*m_impl->m_scvpValPolResp)->nextUpdate));
00977 m_impl->m_nextUpdate = tmpTime2;
00978 }
00979
00980
00981 m_impl->m_supportedChecks = PopulatePKIFOIDList(&(*m_impl->m_scvpValPolResp)->supportedChecks);
00982
00983
00984 m_impl->m_supportedWantBacks = PopulatePKIFOIDList(&(*m_impl->m_scvpValPolResp)->supportedWantBacks);
00985
00986
00987 m_impl->m_validationPolicies = PopulatePKIFOIDList(&(*m_impl->m_scvpValPolResp)->validationPolicies);
00988
00989
00990 m_impl->m_validationAlgs = PopulatePKIFOIDList(&(*m_impl->m_scvpValPolResp)->validationAlgs);
00991
00992
00993 m_impl->m_authPolicies = PopulatePKIFOIDList(&(*m_impl->m_scvpValPolResp)->authPolicies);
00994
00995
00996 switch((*m_impl->m_scvpValPolResp)->responseTypes)
00997 {
00998 case 0:
00999 m_impl->m_responseTypes = CACHED_ONLY;
01000 case 1:
01001 m_impl->m_responseTypes = NON_CACHED_ONLY;
01002 case 2:
01003 m_impl->m_responseTypes = CACHED_AND_NON_CACHED;
01004 }
01005
01006
01007 CACASNWRAPPER_CREATE(ValidationPolicy, objPDU);
01008 ASN1OpenType* data1 = objPDU.Encode(&(*m_impl->m_scvpValPolResp)->defaultPolicyValues);
01009 CPKIFBufferPtr tmpBuf(new CPKIFBuffer(data1->data, data1->numocts));
01010 CPKIFValidationPolicyPtr tmpValPol(new CPKIFValidationPolicy(tmpBuf));
01011
01012 m_impl->m_defaultPolicyValues = tmpValPol;
01013
01014
01015
01016 if( (*m_impl->m_scvpValPolResp)->revocationInfoTypes.data[0] & BitMfullCRLs )
01017 {
01018 m_impl->m_revocationInfoTypes.set(FULLCRLS);
01019 }
01020 if( (*m_impl->m_scvpValPolResp)->revocationInfoTypes.data[0] & BitMdeltaCRLs )
01021 {
01022 m_impl->m_revocationInfoTypes.set(DELTACRLS);
01023 }
01024 if( (*m_impl->m_scvpValPolResp)->revocationInfoTypes.data[0] & BitMindirectCRLs )
01025 {
01026 m_impl->m_revocationInfoTypes.set(INDIRECTCRLS);
01027 }
01028 if( (*m_impl->m_scvpValPolResp)->revocationInfoTypes.data[0] & BitMoCSPResponses )
01029 {
01030 m_impl->m_revocationInfoTypes.set(OCSPRESPONSES);
01031 }
01032
01033
01034 m_impl->m_signatureGeneration = PopulatePKIFAlgorithmIdentifierList(&(*m_impl->m_scvpValPolResp)->signatureGeneration);
01035
01036
01037 m_impl->m_signatureVerification = PopulatePKIFAlgorithmIdentifierList(&(*m_impl->m_scvpValPolResp)->signatureVerification);
01038
01039
01040
01041
01042 m_impl->m_hashAlgorithms = PopulatePKIFOIDList(&(*m_impl->m_scvpValPolResp)->hashAlgorithms);
01043
01044
01045 if(0 < (*m_impl->m_scvpValPolResp)->m.serverPublicKeysPresent)
01046 {
01047
01048 CPKIFKeyAgreePublicKeyListPtr tmpKeyAgreePublicKeyList(new CPKIFKeyAgreePublicKeyList());
01049 DListNode* cur = (*m_impl->m_scvpValPolResp)->serverPublicKeys.head;
01050 while(NULL != cur)
01051 {
01052 KeyAgreePublicKey* tmp = (KeyAgreePublicKey*)cur->data;
01053
01054 CACASNWRAPPER_CREATE(KeyAgreePublicKey, objPDU);
01055 ASN1OpenType* data1 = objPDU.Encode(tmp);
01056 CPKIFBufferPtr tmpBuf(new CPKIFBuffer(data1->data, data1->numocts));
01057 CPKIFKeyAgreePublicKeyPtr tmpKeyAgreePublicKey(new CPKIFKeyAgreePublicKey(tmpBuf));
01058
01059 tmpKeyAgreePublicKeyList->push_back(tmpKeyAgreePublicKey);
01060
01061 cur = cur->next;
01062
01063 }
01064 m_impl->m_serverPublicKeys = tmpKeyAgreePublicKeyList;
01065
01066 }
01067
01068
01069 if(0 < (*m_impl->m_scvpValPolResp)->m.requestNoncePresent)
01070 {
01071 CPKIFBufferPtr tmpNonce(new CPKIFBuffer((*m_impl->m_scvpValPolResp)->requestNonce.data,
01072 (*m_impl->m_scvpValPolResp)->requestNonce.numocts));
01073
01074 m_impl->m_requestNonce = tmpNonce;
01075 }
01076
01077 if(10 != (*m_impl->m_scvpValPolResp)->clockSkew)
01078 {
01079 m_impl->m_clockSkew = (*m_impl->m_scvpValPolResp)->clockSkew;
01080 }
01081 }
01082 catch(CPKIFException&)
01083 {
01084 throw CPKIFSCVPException(TOOLKIT_SCVP_ASN, MSG_DECODE_FAILED);
01085 }
01086 }