00001
00010 #include "CVRequest.h"
00011
00012 #include "ASN1Helper.h"
00013 #include "AlgorithmIdentifier.h"
00014 #include "Buffer.h"
00015 #include "OID.h"
00016 #include "Query.h"
00017 #include "ResponseFlags.h"
00018 #include "PKIFTime.h"
00019 #include "Certificate.h"
00020 #include "ValidationPolicy.h"
00021 #include "KeyUsage.h"
00022 #include "PKCReference.h"
00023 #include "GeneralName.h"
00024 #include "Name.h"
00025 #include "RevocationInfo.h"
00026 #include "CRL.h"
00027 #include "SCVPCertID.h"
00028 #include "CertReferences.h"
00029 #include "PKIFMessageErrors.h"
00030 #include "ACReference.h"
00031 #include "PKIFSCVPErrors.h"
00032 #include "PKIFX509Extensions2.h"
00033 #include "SCVP.h"
00034 #include "ToolkitUtils.h"
00035 #include "IPKIFCryptoMisc.h"
00036 #include "PKIFCryptUtils.h"
00037 #include "X509Extension.h"
00038 #include "SCVPException.h"
00039 #include "PolicyInformation.h"
00040 #include "private/PKIFSCVPMemoryHelper.h"
00041 #include "private/SCVPUtils.h"
00042
00044
00045 struct CPKIFCVRequestImpl
00046 {
00047 CPKIFCVRequest *m_parent;
00048
00049
00050 void populateExtensionsVector();
00051
00052
00053 bool m_bGenerateNonce;
00054 void GenerateNonce() const;
00055 IPKIFMediatorPtr m_mediator;
00056
00057
00058 int m_version;
00059 CPKIFBufferPtr m_nonce;
00060 CPKIFOIDPtr m_hashAlgorithm;
00061 CPKIFAlgorithmIdentifierPtr m_sigAlgorithm;
00062 CPKIFGeneralNamePtr m_requestorName;
00063 CPKIFGeneralNamePtr m_responderName;
00064 CPKIFGeneralNameListPtr m_requestorRef;
00065 CPKIFQueryPtr m_query;
00066 CPKIFStringPtr m_requestorText;
00067 std::vector<CPKIFX509ExtensionPtr> m_exts;
00068
00069
00070 CPKIFASNWrapper<CVRequest>* m_scvpr;
00071
00072 void ClearAllMembers();
00073 void MakeSCVPR();
00074 void FreeSCVPR();
00075
00076
00077 void CallingAllGets();
00078
00079 CPKIFCVRequest * m_this;
00080 };
00081
00089 void CPKIFCVRequestImpl::CallingAllGets()
00090 {
00091 LOG_STRING_DEBUG("CPKIFCVRequest::CallingAllGets()", TOOLKIT_SCVP_ASN, 0, this);
00092
00093
00094 m_parent->GetVersion();
00095 m_parent->GetNonce();
00096 populateExtensionsVector();
00097 FreeSCVPR();
00098 }
00099
00107 void CPKIFCVRequestImpl::MakeSCVPR()
00108 {
00109 LOG_STRING_DEBUG("CPKIFCVRequest::MakeSCVPR()", TOOLKIT_SCVP_ASN, 0, this);
00110
00111 FreeSCVPR();
00112 m_scvpr = new CPKIFASNWrapper<CVRequest>( BEREncCVRequest, BERDecCVRequest );
00113 }
00121 void CPKIFCVRequestImpl::FreeSCVPR()
00122 {
00123 LOG_STRING_DEBUG("CPKIFCVRequest::FreeSCVPR()", TOOLKIT_SCVP_ASN, 0, this);
00124 if(NULL != m_scvpr)
00125 delete m_scvpr;
00126 m_scvpr = NULL;
00127 }
00128
00137 void CPKIFCVRequestImpl::ClearAllMembers()
00138 {
00139 LOG_STRING_DEBUG("CPKIFCVRequest::ClearAllMembers()", TOOLKIT_SCVP_ASN, 0, this);
00140
00141 m_version = 1;
00142 m_bGenerateNonce = false;
00143
00144 IPKIFMediatorPtr tmp;
00145 m_mediator = tmp;
00146
00147 CPKIFBufferPtr tmpNonce;
00148 m_nonce = tmpNonce;
00149
00150 CPKIFOIDPtr tmpHashAlg;
00151 m_hashAlgorithm = tmpHashAlg;
00152
00153 CPKIFAlgorithmIdentifierPtr tmpSigAlg;
00154 m_sigAlgorithm = tmpSigAlg;
00155
00156 CPKIFGeneralNamePtr tmpResuestorName;
00157 m_requestorName = tmpResuestorName;
00158
00159 CPKIFGeneralNamePtr tmpResponderName;
00160 m_responderName = tmpResponderName;
00161
00162 CPKIFGeneralNameListPtr tmpRequestorRef;
00163 m_requestorRef = tmpRequestorRef;
00164
00165 CPKIFQueryPtr tmpQuery;
00166 m_query = tmpQuery;
00167
00168 CPKIFStringPtr tmpStr;
00169 m_requestorText = tmpStr;
00170
00171 FreeSCVPR();
00172 }
00173
00181 void CPKIFCVRequestImpl::GenerateNonce() const
00182 {
00183 LOG_STRING_DEBUG("CPKIFCVRequest::GenerateNonce()", TOOLKIT_SCVP_ASN, 0, this);
00184
00185 IPKIFCryptoMisc* iMisc = NULL;
00186 if(NULL != m_mediator)
00187 iMisc = m_mediator->GetMediator<IPKIFCryptoMisc>();
00188
00189 unsigned char buf[20];
00190 memset(buf, 0, 20);
00191
00192 if(NULL != iMisc)
00193 {
00194
00195 iMisc->GenRandom(buf, 20);
00196 }
00197 else
00198 {
00199
00200
00201 IPKIFCryptoMisc *raw = GetPlatformCryptoMisc();
00202 raw->GenRandom(buf, 20);
00203 }
00204
00205
00206
00207 const unsigned char* bufEnd = buf + 20;
00208 unsigned char* bufP = buf;
00209 int nonZeroLen = 20;
00210 while(*bufP == 0x00)
00211 {
00212 ++bufP;
00213 --nonZeroLen;
00214 }
00215 CPKIFBufferPtr tmpNonce(new CPKIFBuffer(bufP, nonZeroLen));
00216
00217 CPKIFCVRequestImpl* nonConst = const_cast<CPKIFCVRequestImpl*>(this);
00218 nonConst->m_nonce = tmpNonce;
00219 }
00220
00231 void CPKIFCVRequestImpl::populateExtensionsVector()
00232 {
00233 LOG_STRING_DEBUG("CPKIFCVRequest::populateExtensionsVector()", TOOLKIT_SCVP_ASN, 0, this);
00234
00235 if(NULL == m_scvpr || NULL == m_scvpr->data())
00236 return;
00237
00238
00239 if(!m_exts.empty())
00240 return;
00241
00242
00243 if(0 == (*m_scvpr)->m.requestExtensionsPresent)
00244 {
00245 m_exts.clear();
00246 return;
00247 }
00248
00249
00250
00251 CPKIFX509ExtensionMediator2 * mediator = CPKIFX509ExtensionMediator2::GetInstance();
00252
00253 m_this->IPKIFHasExtensions::GetExtensions (mediator, m_exts);
00254 }
00255
00256
00257
00259
00268 void CPKIFCVRequest::GetExtensionByOID(
00270 const CPKIFOID& oid,
00272 CPKIFX509ExtensionPtr& ref)
00273 {
00274 if(m_impl->m_exts.empty() && 0 != (*m_impl->m_scvpr)->m.requestExtensionsPresent)
00275 m_impl->populateExtensionsVector();
00276
00277 std::vector<CPKIFX509ExtensionPtr>::iterator pos;
00278 std::vector<CPKIFX509ExtensionPtr>::iterator end = m_impl->m_exts.end();
00279 for(pos = m_impl->m_exts.begin(); pos != end; ++pos)
00280 {
00281 if(oid == (*pos)->oid())
00282 {
00283 ref = *pos;
00284 return;
00285 }
00286 }
00287 }
00288
00297 CPKIFCVRequest::CPKIFCVRequest()
00298 :m_impl(new CPKIFCVRequestImpl)
00299 {
00300 LOG_STRING_DEBUG("CPKIFCVRequest::CPKIFCVRequest()", TOOLKIT_SCVP_ASN, 0, this);
00301
00302 m_impl->m_parent = this;
00303 m_impl->m_version = 1;
00304 m_impl->m_bGenerateNonce = false;
00305
00306 m_impl->m_scvpr = NULL;
00307
00308 m_impl->m_this = this;
00309 }
00317 CPKIFCVRequest::~CPKIFCVRequest()
00318 {
00319 LOG_STRING_DEBUG("CPKIFCVRequest::~CPKIFCVRequest()", TOOLKIT_SCVP_ASN, 0, this);
00320
00321 m_impl->FreeSCVPR();
00322
00323 if (m_impl)
00324 {
00325 delete m_impl;
00326 }
00327 }
00328
00336 int CPKIFCVRequest::GetVersion() const
00337 {
00338 return m_impl->m_version;
00339 }
00340
00348 void CPKIFCVRequest::SetVersion(int v)
00349 {
00350 m_impl->m_version = v;
00351 }
00352
00360 void CPKIFCVRequest::GetEncodedExtensions (
00362 CPKIFBufferPtr& buf)
00363 {
00364 try
00365 {
00366 if ((*m_impl->m_scvpr)->m.requestExtensionsPresent)
00367 {
00368 CACASNWRAPPER_CREATE(CACX509V3Extensions, extsWrapper);
00369 ASN1OpenType *data = extsWrapper.Encode (&(*m_impl->m_scvpr)->requestExtensions);
00370 CPKIFBufferPtr tmp(new CPKIFBuffer(data->data, data->numocts));
00371 buf = tmp;
00372 delete data;
00373 return;
00374 }
00375 }
00376 catch (... )
00377 {
00378
00379 }
00380
00381 CPKIFBufferPtr nullExt;
00382 buf = nullExt;
00383 }
00384
00393 bool CPKIFCVRequest::ExtensionsPresent() const
00394 {
00395 LOG_STRING_DEBUG("CPKIFCVRequest::ExtensionsPresent()", TOOLKIT_SCVP_ASN, 0, this);
00396
00397 if(NULL != m_impl->m_scvpr && (*m_impl->m_scvpr)->m.requestExtensionsPresent)
00398 return true;
00399 else
00400 return false;
00401 }
00402
00410 void CPKIFCVRequest::SetNonce(
00413 CPKIFBufferPtr& nonce)
00414 {
00415 LOG_STRING_DEBUG("CPKIFCVRequest::SetNonce(CPKIFStringPtr& nonce)", TOOLKIT_SCVP_ASN, 0, this);
00416
00417 m_impl->CallingAllGets();
00418 m_impl->m_nonce = nonce;
00419 }
00427 const CPKIFBufferPtr CPKIFCVRequest::GetNonce() const
00428 {
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440 if(m_impl->m_nonce == NULL)
00441 {
00442 CPKIFBufferPtr t;
00443 return t;
00444 }
00445 else
00446 return m_impl->m_nonce;
00447 }
00455 void CPKIFCVRequest::SetGenerateNonce(
00457 bool generateNonce)
00458 {
00459 LOG_STRING_DEBUG("CPKIFCVRequest::SetGenerateNonce(bool generateNonce, IPKIFMediatorPtr m)", TOOLKIT_SCVP_ASN, 0, this);
00460
00461 m_impl->CallingAllGets();
00462 m_impl->m_bGenerateNonce = generateNonce;
00463 }
00464
00474 void CPKIFCVRequest::SetGenerateNonce(
00476 bool generateNonce,
00478 IPKIFMediatorPtr& m)
00479 {
00480 LOG_STRING_DEBUG("CPKIFCVRequest::SetGenerateNonce(bool generateNonce, IPKIFMediatorPtr m)", TOOLKIT_SCVP_ASN, 0, this);
00481
00482 m_impl->CallingAllGets();
00483 m_impl->m_bGenerateNonce = generateNonce;
00484 m_impl->m_mediator = m;
00485 }
00493 bool CPKIFCVRequest::GetGenerateNonce() const
00494 {
00495 return m_impl->m_bGenerateNonce;
00496 }
00497
00505 void CPKIFCVRequest::SetHashAlgorithm(
00508 CPKIFOIDPtr& hashAlgorithm)
00509 {
00510 m_impl->m_hashAlgorithm = hashAlgorithm;
00511 }
00512
00520 const CPKIFOIDPtr CPKIFCVRequest::GetHashAlgorithm() const
00521 {
00522 return m_impl->m_hashAlgorithm;
00523 }
00524
00532 void CPKIFCVRequest::SetSigAlgorithm(
00535 CPKIFAlgorithmIdentifierPtr& sigAlgorithm)
00536 {
00537 m_impl->m_sigAlgorithm = sigAlgorithm;
00538 }
00539
00547 const CPKIFAlgorithmIdentifierPtr CPKIFCVRequest::GetSigAlgorithm() const
00548 {
00549 return m_impl->m_sigAlgorithm;
00550 }
00551
00559 void CPKIFCVRequest::SetRequestorName(
00562 CPKIFGeneralNamePtr& requestorName)
00563 {
00564 m_impl->m_requestorName = requestorName;
00565 }
00573 const CPKIFGeneralNamePtr CPKIFCVRequest::GetRequestorName() const
00574 {
00575 return m_impl->m_requestorName;
00576 }
00577
00585 void CPKIFCVRequest::SetResponderName(
00588 CPKIFGeneralNamePtr& responderName)
00589 {
00590 m_impl->m_responderName = responderName;
00591 }
00599 const CPKIFGeneralNamePtr CPKIFCVRequest::GetResponderName() const
00600 {
00601 return m_impl->m_responderName;
00602 }
00603
00611 void CPKIFCVRequest::SetRequestorRef(
00614 CPKIFGeneralNameListPtr& requestorRef)
00615 {
00616 m_impl->m_requestorRef = requestorRef;
00617 }
00625 void CPKIFCVRequest::GetRequestorRef(
00628 CPKIFGeneralNameListPtr& requestorRef) const
00629 {
00630 requestorRef = m_impl->m_requestorRef;
00631 }
00632
00640 void CPKIFCVRequest::SetRequestorText(
00643 CPKIFStringPtr& requestorText)
00644 {
00645 m_impl->m_requestorText = requestorText;
00646 }
00654 const CPKIFStringPtr CPKIFCVRequest::GetRequestorText() const
00655 {
00656 return m_impl->m_requestorText;
00657 }
00665 void CPKIFCVRequest::SetQuery(
00667 CPKIFQueryPtr& query)
00668 {
00669 m_impl->m_query = query;
00670 }
00678 const CPKIFQueryPtr CPKIFCVRequest::GetQuery() const
00679 {
00680 return m_impl->m_query;
00681 }
00682
00694 CPKIFBufferPtr CPKIFCVRequest::Encode() const
00695 {
00696 LOG_STRING_DEBUG("CPKIFCVRequest::Encode()", TOOLKIT_SCVP_ASN, 0, this);
00697
00698
00699
00700
00701 PKIFSCVPMemoryHelper mhSCVPRequest;
00702 mhSCVPRequest.pRequest = new CVRequest;
00703 memset(mhSCVPRequest.pRequest, 0, sizeof(CVRequest));
00704
00705
00706 mhSCVPRequest.pRequest->cvRequestVersion = m_impl->m_version;
00707
00708 OOCTXT ctxt;
00709 initContext (&ctxt);
00710
00711
00712 PopulateQuery(&mhSCVPRequest.pRequest->query, m_impl->m_query, ctxt);
00713
00714
00715 CPKIFGeneralNameListPtr requestorRef;
00716 GetRequestorRef(requestorRef);
00717 if(requestorRef != (CPKIFGeneralNameList*)NULL && !requestorRef->empty())
00718 {
00719 DListNode* curName = NULL;
00720
00721 CPKIFGeneralNameList::iterator namePos;
00722 CPKIFGeneralNameList::iterator nameEnd = requestorRef->end();
00723 for(namePos = requestorRef->begin(); namePos != nameEnd; ++namePos)
00724 {
00725 if(NULL == curName)
00726 {
00727 NEW_NODE(curName)
00728 }
00729 else
00730 {
00731 NEW_NEXT_AND_ADVANCE(curName)
00732 }
00733
00734 CACX509V3GeneralName* tmpName= new CACX509V3GeneralName;
00735 memset(tmpName, 0, sizeof(CACX509V3GeneralName));
00736
00737
00738 CopyGeneralName((*tmpName), (*namePos));
00739
00740 curName->data = tmpName;
00741
00742 SET_HEAD_TAIL_INCREMENT(mhSCVPRequest.pRequest->requestorRef, curName)
00743 }
00744 mhSCVPRequest.pRequest->m.requestorRefPresent = 1;
00745
00746 }
00747
00748
00749 if(m_impl->m_bGenerateNonce)
00750 {
00751 m_impl->GenerateNonce();
00752 }
00753
00754 const CPKIFBufferPtr nonce = GetNonce();
00755 if(nonce != (CPKIFBuffer*)NULL)
00756 {
00757 mhSCVPRequest.pRequest->requestNonce.data = nonce->GetBuffer();
00758 mhSCVPRequest.pRequest->requestNonce.numocts = nonce->GetLength();
00759 mhSCVPRequest.pRequest->m.requestNoncePresent = 1;
00760
00761 }
00762
00763
00764 CPKIFGeneralNamePtr requestorName = GetRequestorName();
00765 if(requestorName != (CPKIFGeneralName*)NULL)
00766 {
00767 mhSCVPRequest.pRequest->m.requestorNamePresent = 1;
00768 CopyGeneralName(mhSCVPRequest.pRequest->requestorName, requestorName);
00769 }
00770
00771
00772 CPKIFGeneralNamePtr responderName = GetResponderName();
00773 if(responderName != (CPKIFGeneralName*)NULL)
00774 {
00775 mhSCVPRequest.pRequest->m.responderNamePresent = 1;
00776 CopyGeneralName(mhSCVPRequest.pRequest->responderName, responderName);
00777 }
00778
00779
00780 if(!m_impl->m_exts.empty())
00781 {
00782 throw CPKIFSCVPException(TOOLKIT_SCVP_ASN, COMMON_NOT_IMPLEMENTED, "There is currently no support for including extensions in a CPKIFCVRequest");
00783 }
00784
00785
00786 const CPKIFAlgorithmIdentifierPtr sigAlgorithm = GetSigAlgorithm();
00787 if(sigAlgorithm != (CPKIFAlgorithmIdentifier*)NULL)
00788 {
00789 CPKIFStringPtr str(new std::string(sigAlgorithm->oid()->ToString()));
00790 ASN1OBJID* tmpOid = ConvertStringToASN1OBJID(str);
00791 CopyOID(&mhSCVPRequest.pRequest->signatureAlg.algorithm, tmpOid);
00792
00793 if(NULL != tmpOid)
00794 delete tmpOid;
00795
00796 if(sigAlgorithm->hasParameters())
00797 {
00798 mhSCVPRequest.pRequest->signatureAlg.m.parametersPresent = 1;
00799
00800 mhSCVPRequest.pRequest->signatureAlg.parameters.data = sigAlgorithm->parameters()->GetBuffer();
00801 mhSCVPRequest.pRequest->signatureAlg.parameters.numocts = sigAlgorithm->parameters()->GetLength();
00802 }
00803
00804 mhSCVPRequest.pRequest->m.signatureAlgPresent = 1;
00805 }
00806
00807
00808 const CPKIFOIDPtr hashAlgorithm = GetHashAlgorithm();
00809 if(hashAlgorithm != (CPKIFAlgorithmIdentifier*)NULL)
00810 {
00811 CPKIFStringPtr str(new std::string(hashAlgorithm->ToString()));
00812 ASN1OBJID* tmpOid = ConvertStringToASN1OBJID(str);
00813 CopyOID(&mhSCVPRequest.pRequest->hashAlg, tmpOid);
00814
00815 if(NULL != tmpOid)
00816 delete tmpOid;
00817
00818 mhSCVPRequest.pRequest->m.hashAlgPresent = 1;
00819 }
00820
00821
00822 const CPKIFStringPtr text = GetRequestorText();
00823 if(text != NULL)
00824 {
00825 mhSCVPRequest.pRequest->requestorText = strdup(text->c_str());
00826 mhSCVPRequest.pRequest->m.requestorTextPresent = 1;
00827 }
00828
00829 CACASNWRAPPER_CREATE(CVRequest, objPDU);
00830 ASN1OpenType* data1 = objPDU.Encode(mhSCVPRequest.pRequest);
00831 CPKIFBufferPtr tmp(new CPKIFBuffer(data1->data, data1->numocts));
00832 delete data1;
00833
00834 freeEncodeBuffer(&ctxt);
00835 memFreeAll(&ctxt);
00836
00837 return tmp;
00838 }
00839
00850 void CPKIFCVRequest::Decode(
00852 CPKIFBufferPtr& msg)
00853 {
00854 m_impl->ClearAllMembers();
00855
00856
00857 if(msg == (CPKIFBuffer*)NULL || 0 == msg->GetLength())
00858 {
00859 throw CPKIFSCVPException(TOOLKIT_SCVP_ASN, COMMON_INVALID_INPUT);
00860 }
00861
00862 m_impl->MakeSCVPR();
00863
00864 try
00865 {
00866
00867 const unsigned char* tmpP = msg->GetBuffer();
00868 (*m_impl->m_scvpr).Decode(msg->GetBuffer(), msg->GetLength());
00869
00870 m_impl->m_version = (*m_impl->m_scvpr)->cvRequestVersion;
00871
00872
00873 CACASNWRAPPER_CREATE(Query, objPDU);
00874 ASN1OpenType* data1 = objPDU.Encode(&(*m_impl->m_scvpr)->query);
00875 CPKIFBufferPtr tmp(new CPKIFBuffer(data1->data, data1->numocts));
00876 if(data1 != NULL)
00877 delete data1;
00878 CPKIFQueryPtr tmpQuery(new CPKIFQuery(tmp));
00879
00880 m_impl->m_query = tmpQuery;
00881
00882 if(0 < (*m_impl->m_scvpr)->m.requestNoncePresent)
00883 {
00884 CPKIFBufferPtr tmpNonce(new CPKIFBuffer((*m_impl->m_scvpr)->requestNonce.data, (*m_impl->m_scvpr)->requestNonce.numocts));
00885
00886 m_impl->m_nonce = tmpNonce;
00887 }
00888
00889 if(0 < (*m_impl->m_scvpr)->m.requestorNamePresent)
00890 {
00891 CACASNWRAPPER_CREATE(CACX509V3GeneralName, objPDU);
00892 ASN1OpenType* data1 = objPDU.Encode(&(*m_impl->m_scvpr)->requestorName);
00893 CPKIFBufferPtr tmp(new CPKIFBuffer(data1->data, data1->numocts));
00894 CPKIFGeneralNamePtr tmpName(new CPKIFGeneralName(tmp));
00895 m_impl->m_requestorName = tmpName;
00896 if(NULL != data1)
00897 delete data1;
00898 }
00899
00900
00901 if(0 < (*m_impl->m_scvpr)->m.responderNamePresent)
00902 {
00903 CACASNWRAPPER_CREATE(CACX509V3GeneralName, objPDU);
00904 ASN1OpenType* data1 = objPDU.Encode(&(*m_impl->m_scvpr)->responderName);
00905 CPKIFBufferPtr tmp(new CPKIFBuffer(data1->data, data1->numocts));
00906 CPKIFGeneralNamePtr tmpName(new CPKIFGeneralName(tmp));
00907 m_impl->m_responderName = tmpName;
00908 if(NULL != data1)
00909 delete data1;
00910 }
00911
00912 if(0 < (*m_impl->m_scvpr)->m.signatureAlgPresent)
00913 {
00914 CPKIFOIDPtr algOID(new CPKIFOID((*m_impl->m_scvpr)->signatureAlg.algorithm.subid,
00915 (*m_impl->m_scvpr)->signatureAlg.algorithm.numids));
00916
00917 CPKIFBufferPtr algParams;
00918 if((*m_impl->m_scvpr)->signatureAlg.m.parametersPresent == 1)
00919 {
00920 CPKIFBufferPtr tmpAlgParams(new CPKIFBuffer((*m_impl->m_scvpr)->signatureAlg.parameters.data,
00921 (*m_impl->m_scvpr)->signatureAlg.parameters.numocts));
00922
00923 algParams = tmpAlgParams;
00924 }
00925 CPKIFAlgorithmIdentifierPtr sigAlg(new CPKIFAlgorithmIdentifier(algOID, algParams));
00926
00927 m_impl->m_sigAlgorithm = sigAlg;
00928 }
00929
00930 if(0 < (*m_impl->m_scvpr)->m.hashAlgPresent)
00931 {
00932 CPKIFOIDPtr hashAlgOID(new CPKIFOID((*m_impl->m_scvpr)->hashAlg.subid,
00933 (*m_impl->m_scvpr)->hashAlg.numids));
00934
00935 m_impl->m_hashAlgorithm = hashAlgOID;
00936 }
00937
00938 if(0 < (*m_impl->m_scvpr)->m.requestorTextPresent)
00939 {
00940 CPKIFStringPtr tmpRequestorTest(new std::string((*m_impl->m_scvpr)->requestorText));
00941
00942 m_impl->m_requestorText = tmpRequestorTest;
00943 }
00944
00945 if(0 < (*m_impl->m_scvpr)->m.requestorRefPresent)
00946 {
00947 CPKIFGeneralNameListPtr tmpRequestorRef(new CPKIFGeneralNameList());
00948 DListNode* cur = (*m_impl->m_scvpr)->requestorRef.head;
00949 while(NULL != cur)
00950 {
00951 CACX509V3GeneralName* tmp = (CACX509V3GeneralName*)cur->data;
00952 CACASNWRAPPER_CREATE(CACX509V3GeneralName, objPDU);
00953 ASN1OpenType* data1 = objPDU.Encode(tmp);
00954 CPKIFBufferPtr tmpBuf(new CPKIFBuffer(data1->data, data1->numocts));
00955 CPKIFGeneralNamePtr tmpName(new CPKIFGeneralName(tmpBuf));
00956
00957 if(NULL != data1)
00958 delete data1;
00959
00960 tmpRequestorRef->push_back(tmpName);
00961
00962 cur = cur->next;
00963 }
00964 m_impl->m_requestorRef = tmpRequestorRef;
00965
00966 }
00967
00968 m_impl->populateExtensionsVector();
00969
00970 }
00971 catch(CPKIFException&)
00972 {
00973 throw CPKIFSCVPException(TOOLKIT_SCVP_ASN, MSG_DECODE_FAILED);
00974 }
00975
00976 }
00977
00985 bool CPKIFCVRequest::AreThereAnyUnprocessedCriticalExtensions()
00986 {
00987 LOG_STRING_DEBUG("CPKIFCVRequest::AreThereAnyUnprocessedCriticalExtensions()", TOOLKIT_OCSP_ASN, 0, this);
00988
00989 std::vector<CPKIFX509ExtensionPtr>::iterator pos;
00990 std::vector<CPKIFX509ExtensionPtr>::iterator end = m_impl->m_exts.end();
00991 for(pos = m_impl->m_exts.begin(); pos != end; ++pos)
00992 {
00993 if((*pos)->isCritical())
00994 return true;
00995 }
00996
00997 return false;
00998 }