Request.cpp
Go to the documentation of this file.00001
00009 #include "Request.h"
00010 #include "CertID.h"
00011 #include "Buffer.h"
00012
00013 #include "ASN1Helper.h"
00014 #include "OCSP.h"
00015 #include "OCSPException.h"
00016 #include "ToolkitUtils.h"
00017 #include "components.h"
00018 #include "ASN1Helper.h"
00019
00020 #include "PKIFCommonErrors.h"
00021 using namespace std;
00022
00024 struct CPKIFRequestImpl
00025 {
00026 CPKIFCertIDPtr m_certID;
00027 };
00029
00037 CPKIFRequest::CPKIFRequest()
00038 :m_impl (new CPKIFRequestImpl)
00039 {
00040 LOG_STRING_DEBUG("CPKIFRequest::CPKIFRequest()", TOOLKIT_OCSP_ASN, 0, this);
00041 }
00052 CPKIFRequest::CPKIFRequest(
00054 const CPKIFBufferPtr& r)
00055 :m_impl (new CPKIFRequestImpl)
00056 {
00057 LOG_STRING_DEBUG("CPKIFRequest::CPKIFRequest(Request& r)", TOOLKIT_OCSP_ASN, 0, this);
00058
00059 CACASNWRAPPER_CREATE(Request, objPDU);
00060 objPDU.Decode(r->GetBuffer(), r->GetLength());
00061
00062 CACASNWRAPPER_CREATE(CertID, objPDU2);
00063 ASN1OpenType* data1 = objPDU2.Encode(&(objPDU->reqCert));
00064 CPKIFBufferPtr buffPtr;
00065 if(NULL != data1)
00066 {
00067 buffPtr = CPKIFBufferPtr(new CPKIFBuffer(data1->data, data1->numocts));
00068 delete data1;
00069 }
00070
00071 CPKIFCertIDPtr tmpCID(new CPKIFCertID(buffPtr));
00072
00073 m_impl->m_certID = tmpCID;
00074
00075 if(objPDU->m.singleRequestExtensionsPresent)
00076 {
00077
00078 throw CPKIFOCSPException(TOOLKIT_TSP_ASN, COMMON_NOT_IMPLEMENTED, "No support for single request extensions.");
00079 }
00080 }
00088 CPKIFRequest::~CPKIFRequest()
00089 {
00090 LOG_STRING_DEBUG("CPKIFRequest::~CPKIFRequest()", TOOLKIT_OCSP_ASN, 0, this);
00091
00092 delete m_impl;
00093 m_impl = NULL;
00094 }
00102 void CPKIFRequest::SetCertID(
00104 CPKIFCertIDPtr& certID)
00105 {
00106 m_impl->m_certID = certID;
00107 }
00116 CPKIFCertIDPtr CPKIFRequest::GetCertID() const
00117 {
00118 return m_impl->m_certID;
00119 }