00001
00009 #ifndef __SCVPUtils_H__
00010 #define __SCVPUtils_H__
00011
00012 #include "PKIFSCVPDLL.h"
00013 #include "PKIFdll.h"
00014 #include "SCVP.h"
00015 #include "IPKIFScvpClient.h"
00016 #include "PathResults.h"
00017
00018 FD_SMART_PTR(CPKIFValidationPolicy);
00019 FD_SMART_PTR(CPKIFQuery);
00020 FD_SMART_PTR(CPKIFPKCReference);
00021 FD_LIST_PTR(CPKIFOID);
00022 FD_LIST_PTR(CPKIFAlgorithmIdentifier);
00023 FD_LIST_PTR(CPKIFCertReply);
00024 FD_LIST_PTR(CPKIFGeneralName);
00025 FD_SMART_PTR(CPKIFKeyAgreePublicKey);
00026 FD_SMART_PTR(CPKIFCertificatePath);
00027 FD_SMART_PTR(CPKIFBuffer);
00028 FD_SMART_PTR(CPKIFCVRequest);
00029 FD_SMART_PTR(CPKIFCVResponse);
00030 FD_SMART_PTR(CPKIFCertReference);
00031
00032 CPKIFOIDListPtr PopulatePKIFOIDList(DList* list);
00033 void PopulateValidationPolicy(ValidationPolicy*, CPKIFValidationPolicyPtr valPol, OOCTXT& ctxt);
00034 CPKIFAlgorithmIdentifierListPtr PopulatePKIFAlgorithmIdentifierList(DList* list);
00035 void PopulateDListWithASN1OBJID(DList* list, CPKIFOIDListPtr pkifOIDList);
00036 void PopulateDListWithCACX509V3AlgorithmIdentifier(DList* list, CPKIFAlgorithmIdentifierListPtr pkifOIDList);
00037 void PopulateQuery(Query* queryOut, CPKIFQueryPtr query, OOCTXT& ctxt);
00038 void PopulatePKCReference(PKCReference* keyUsageStruct, CPKIFPKCReferencePtr& pkcRef, OOCTXT& ctxt);
00039 void PopulateReplyObjects(ReplyObjects* list, CPKIFCertReplyListPtr& replyObjects, OOCTXT& ctxt);
00040 CPKIFGeneralNameListPtr PopulatePKIFGeneralNameList(DList* list);
00041 void PopulateDListWithCACX509V3GeneralName(DList* list, CPKIFGeneralNameListPtr pkifOIDList);
00042 void PopulateKeyAgreePublicKey(CACX509V3AlgorithmIdentifier* objPubKey, CPKIFAlgorithmIdentifierPtr pubKey);
00043
00044 enum SCVP_SignatureState
00045 {
00046 SS_OK = 0,
00047 SS_SIGNATURE_NOT_VERIFIED = 1,
00048 SS_NOT_SIGNED = 2,
00049 SS_UNSUPPORTED_PAYLOAD = 3,
00050 SS_UNPROTECTED_PAYLOAD = 4,
00051 SS_BAD_RESPONSE_STATUS = 5,
00052 SS_MISSING_NONCE = 6,
00053 SS_NONCE_MISMATCH = 7,
00054 SS_OTHER_ERROR
00055 };
00056
00057 CPKIFQueryPtr MakeQueryForPath(CPKIFCertificatePath& path, CPKIFOIDPtr& certCheck, IPKIFScvpClient* scvpClient);
00058 SCVP_SignatureState VerifyResponseSignature(CPKIFBufferPtr& encResp, IPKIFScvpClient* scvpClient, CPKIFCVRequestPtr& req, bool reqIsDpd, CPKIFCVResponsePtr& parsedResponse);
00059 CPKIFCertReplyPtr GetReplyObject(CPKIFCertReplyListPtr& replyObjects, CPKIFCertificatePtr& targetCert);
00060 bool CertReferenceMatchesCertificate(CPKIFCertReferencePtr& cr, CPKIFCertificatePtr& targetCert);
00061
00062 void CertPathWantBackToResultsAndStores(
00064 CPKIFBufferPtr& certPathWB,
00066 CPKIFBufferPtr& revInfoWB,
00068 CPKIFCertificatePath& path,
00070 IPKIFScvpClient* scvpClient,
00071 CPKIFPathValidationResults& results,
00072 IPKIFColleague* iCol
00073 );
00074
00075 bool CertPathWantBackToResultsAndStoresForDpd(
00077 CPKIFBufferPtr& certPathWB,
00079 CPKIFBufferPtr& revInfoWB,
00081 CPKIFCertificatePath& path,
00083 IPKIFScvpClient* scvpClient,
00084 IPKIFColleague* iCol
00085 );
00086
00087 void StickCrlsFromWantBackInCrlStore(
00089 CPKIFBufferPtr& revInfoWB,
00091 IPKIFScvpClient* scvpClient,
00092 IPKIFColleague* iCol);
00093
00094 void RevInfoWantBackToResults(
00096 CPKIFBufferPtr& encWB,
00098 CPKIFCertificatePath& path);
00099
00100 bool MakeSureReplyChecksAreSuccessfulAndValErrorsAreAbsent(CPKIFCertReplyPtr& replyObject);
00101
00102 void VerifyCertPathWB_ER(
00104 CPKIFBufferPtr& bestCertPathWB,
00106 CPKIFBufferPtr& bestCertPathWB_ER,
00108 CPKIFCertificatePath& path,
00110 IPKIFScvpClient* scvpClient
00111 );
00112
00113 void VerifyPartialPathWB_ER(
00115 CPKIFBufferPtr& partialPathWB,
00117 CPKIFBufferPtr& partialPathWB_ER,
00119 CPKIFCertificatePath& path,
00121 IPKIFScvpClient* scvpClient
00122 );
00123
00124 void VerifyRevInfoWB_ER(
00126 CPKIFBufferPtr& revInfoWB,
00128 CPKIFBufferPtr& revInfoWB_ER,
00130 CPKIFCertificatePath& path,
00132 IPKIFScvpClient* scvpClient
00133 );
00134
00135 void VerifyPKCCertWB_ER(
00137 CPKIFCertificatePtr& pkcCert,
00139 CPKIFBufferPtr& pkcCertWB_ER,
00141 CPKIFCertificatePath& path,
00143 IPKIFScvpClient* scvpClient
00144 );
00145
00146 #endif