ScvpResponderEntryDlg.cpp

Go to the documentation of this file.
00001 
00009 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && defined(PKIFRESOURCES_ALLOW_GCC_PRAGMA)
00010     #pragma implementation "ScvpResponderEntryDlg.cpp"
00011 #endif
00012 
00013 //Pick up PKIF windows SDK configuration macros instead of WX's 
00014 #include "PKIFdll.h"
00015 // For compilers that support precompilation, includes "wx/wx.h".
00016 #include "wx/wxprec.h"
00017 
00018 #ifdef __BORLANDC__
00019     #pragma hdrstop
00020 #endif
00021 
00022 #include "ScvpResponderEntryDlg.h"
00023 #ifdef __INCLUDE_SCVP_SUPPORT__
00024 #include "PKIFSCVP.h"
00025 #endif
00026 #include "ExtractInfoFromCertDlg.h"
00027 #include "CredentialSelectorDlg.h"
00028 #include "EvidenceRecordVerifierDlg.h"
00029 #include "ResourceUtils.h"
00030 #include "PkiEnvironmentDefinitionNotebook.h"
00031 #include "PathSettingsNotebook.h"
00032 #include "PKIFCMS.h"
00033 
00034 #include <sstream>
00035 #include <iomanip>
00036 
00037 using namespace boost;
00038 using namespace std;
00039 
00040 //implemented in OcspResponderEntryDlg.cpp
00041 void DisplayCertificateDetails(const CPKIFCertificatePtr& cert, wxTextCtrl* tcSubjectName, wxTextCtrl* tcSkid);
00042 
00043 //Using the global OIDs from PKIFSCVP won't work with delayed loading, so we'll keep our own copies
00044 CPKIFOIDPtr g_id_swb_pkc_best_cert_path2
00045     (new CPKIFOID(CPKIFStringPtr(new std::string("1.3.6.1.5.5.7.18.1"))));//id_swb_pkc_best_cert_path
00046 CPKIFOIDPtr g_id_swb_pkc_revocation_info2
00047     (new CPKIFOID(CPKIFStringPtr(new std::string("1.3.6.1.5.5.7.18.2"))));//id_swb_pkc_revocation_info
00048 CPKIFOIDPtr g_id_swb_pkc_cert2
00049     (new CPKIFOID(CPKIFStringPtr(new std::string("1.3.6.1.5.5.7.18.10"))));//id_swb_pkc_cert
00050 CPKIFOIDPtr g_idSwbPartialCertPath2
00051     (new CPKIFOID(CPKIFStringPtr(new std::string("1.3.6.1.5.5.7.18.15"))));
00052 
00053 CPKIFOIDPtr g_idSwbErsPkcCert2
00054     (new CPKIFOID(CPKIFStringPtr(new std::string("1.3.6.1.5.5.7.18.16"))));
00055 CPKIFOIDPtr g_idSwbErsPartialCertPath2
00056     (new CPKIFOID(CPKIFStringPtr(new std::string("1.3.6.1.5.5.7.18.18"))));
00057 CPKIFOIDPtr g_idSwbErsRevocationInfo2
00058     (new CPKIFOID(CPKIFStringPtr(new std::string("1.3.6.1.5.5.7.18.19"))));
00059 
00060 CPKIFOIDPtr g_id_ct_scvp_valPolResponse2
00061     (new CPKIFOID(CPKIFStringPtr(new std::string("1.2.840.113549.1.9.16.1.13"))));//id-ct-scvp-valPolResponse
00062 
00063 // WDR: class implementations
00064 
00065 //----------------------------------------------------------------------------
00066 // CScvpResponderEntryDlg
00067 //----------------------------------------------------------------------------
00068 
00069 // WDR: event table for CScvpResponderEntryDlg
00070 
00071 BEGIN_EVENT_TABLE(CScvpResponderEntryDlg,wxDialog)
00072     //General events
00073     EVT_INIT_DIALOG( CScvpResponderEntryDlg::OnInitDialog )
00074 
00075     //Want backs group box events
00076     //NONE
00077 
00078     //Validation policy group box events
00079     EVT_BUTTON( ID_BUTTON_GET_VAL_POL, CScvpResponderEntryDlg::OnLoadNow )
00080 
00081     //SCVP request signing credential group box events
00082     EVT_BUTTON( ID_BUTTON_CLEAR_CRED_SCVP, CScvpResponderEntryDlg::OnClearCredential )
00083     EVT_BUTTON( ID_BUTTON_SELECT_CRED_SCVP, CScvpResponderEntryDlg::OnSelectCredential )
00084     
00085     //Acceptable namespaces group box events
00086     EVT_BUTTON( ID_BUTTON_ADD_NAMESPACE_SCVP, CScvpResponderEntryDlg::OnAddNamespace )
00087     EVT_BUTTON( ID_BUTTON_REMOVE_NAMESPACE_SCVP, CScvpResponderEntryDlg::OnRemoveNamespace )
00088 
00089     //Settings for SCVP response verification group box events
00090     EVT_BUTTON( ID_BUTTON_SCVP_RESPONSE_PATH, CScvpResponderEntryDlg::OnScvpResponsePath )
00091     EVT_BUTTON( ID_BUTTON_SCVP_RESPONSE_MEDS, CScvpResponderEntryDlg::OnScvpResponseMeds )
00092     EVT_CHECKBOX( ID_CHECKBOX_SCVP_RESPONSE_MEDS, CScvpResponderEntryDlg::OnCheckScvpResponseMeds )
00093     EVT_CHECKBOX( ID_CHECKBOX_SCVP_RESPONSE_PATH, CScvpResponderEntryDlg::OnCheckScvpResponsePath )
00094 
00095     //Custom validation policy group box events
00096     EVT_CHECKBOX( ID_CHECKBOX_VAL_POL_PATH, CScvpResponderEntryDlg::OnCheckValPolPath )
00097     EVT_BUTTON( ID_BUTTON_VAL_POL_PATH, CScvpResponderEntryDlg::OnValPolPath )
00098 
00099     //OK and CANCEL button events
00100     EVT_BUTTON( wxID_OK, CScvpResponderEntryDlg::OnOk )
00101     EVT_BUTTON( wxID_CANCEL, CScvpResponderEntryDlg::OnCancel )
00102     EVT_BUTTON( ID_BUTTON_CONFIGURE_ER_VERIFIER, CScvpResponderEntryDlg::OnClickConfigureErVerifier )
00103 
00104     
00105     //SCVP SCVP DPD only event
00106     EVT_CHECKBOX( ID_CHECK_SCVP_DPD_ONLY, CScvpResponderEntryDlg::OnClickSCVPDPDOnly )
00107 END_EVENT_TABLE()
00115 CScvpResponderEntryDlg::CScvpResponderEntryDlg( wxWindow *parent, wxWindowID id, const wxString &title,
00116     const wxPoint &position, const wxSize& size, long style ) :
00117     wxDialog( parent, id, title, position, size, style )
00118 {
00119     m_bDpdOnly = false;
00120     m_bGenerateNonce = false;
00121     m_bRequireNonceMatch = false;
00122     m_bRequireSignedDPD = false;
00123     m_bFetchValPol = false;
00124 
00125     // WDR: dialog function ScvpResponderEntryDlg for CScvpResponderEntryDlg
00126     ScvpResponderEntryDlg( this, TRUE ); 
00127 }
00135 CScvpResponderEntryDlg::~CScvpResponderEntryDlg()
00136 {
00137 }
00145 const char* MakeTimePurty(
00147     CPKIFTimePtr& t,
00149     std::string& s)
00150 {
00151     std::ostringstream oss;
00152     switch(t->month())
00153     {
00154     case 1:
00155         oss << "January";
00156         break;
00157     case 2:
00158         oss << "February";
00159         break;
00160     case 3:
00161         oss << "March";
00162         break;
00163     case 4:
00164         oss << "April";
00165         break;
00166     case 5:
00167         oss << "May";
00168         break;
00169     case 6:
00170         oss << "June";
00171         break;
00172     case 7:
00173         oss << "July";
00174         break;
00175     case 8:
00176         oss << "August";
00177         break;
00178     case 9:
00179         oss << "September";
00180         break;
00181     case 10:
00182         oss << "October";
00183         break;
00184     case 11:
00185         oss << "November";
00186         break;
00187     case 12:
00188         oss << "December";
00189         break;
00190     }
00191 
00192     oss << " " << t->dayOfMonth() << ", " << t->year() << " " <<
00193         std::setw(2) << std::setfill('0') << t->hours() << ":" <<
00194         std::setw(2) << std::setfill('0') << t->minutes() << ":" <<
00195         std::setw(2) << std::setfill('0')<< t->seconds() << ends;
00196     s = oss.str();
00197     return s.c_str();
00198 }
00206 void CScvpResponderEntryDlg::DisplayValPolTime()
00207 {
00208 #ifdef __INCLUDE_SCVP_SUPPORT__
00209     if(!m_valPol)
00210         return;
00211 
00212     try
00213     {
00214         CPKIFOIDPtr contentType = m_valPol->GetContentType();
00215         if(!contentType || (*g_signedData != *contentType))
00216             throw CPKIFException(TOOLKIT_SCVP_SUBCOMPONENT, COMMON_INVALID_INPUT, "Unexpected ValPol contents.  SignedData not present.");
00217 
00218         CPKIFBufferPtr content = m_valPol->GetContent();
00219 
00220         CPKIFSignedData sd;
00221         sd.Decode(content);
00222 
00223         CPKIFEncapsulatedContentInfoPtr ecip = sd.GetEncapsulatedContent();
00224         CPKIFOIDPtr ecipOid = ecip->GetOID();
00225         if(!ecipOid || (*g_id_ct_scvp_valPolResponse2 != *ecipOid))
00226             throw CPKIFException(TOOLKIT_SCVP_SUBCOMPONENT, COMMON_INVALID_INPUT, "Unexpected ValPol contents.  ValPolRepsonse not present.");
00227 
00228         CPKIFBufferPtr ecipBuf = ecip->GetContent();
00229         CPKIFValPolResponsePtr vp(new CPKIFValPolResponse);
00230         vp->Decode(ecipBuf);
00231 
00232         CPKIFTimePtr thisUpdate = vp->GetThisUpdate();
00233         CPKIFTimePtr nextUpdate = vp->GetNextUpdate();
00234 
00235         ostringstream oss;
00236         std::string strref;
00237         if(!nextUpdate)
00238             oss << "Current policy valid since " << MakeTimePurty(thisUpdate, strref) << ends;
00239         else
00240             oss << "Current policy valid until " << MakeTimePurty(nextUpdate, strref) << ends;
00241 
00242         wxStaticText* text = GetTextValpolStatus();
00243         wxString label(oss.str().c_str(),wxConvUTF8);
00244         text->SetLabel(label);
00245 
00246         wxComboBox* cbValPols = GetComboBoxValpol();
00247         cbValPols->Clear();
00248         CPKIFOIDListPtr valPols;
00249         vp->GetValidationPolicies(valPols);
00250         if(valPols)
00251         {
00252             CPKIFOIDList::iterator pos = valPols->begin();
00253             CPKIFOIDList::iterator end = valPols->end();
00254             for(; pos != end; ++pos)
00255             {
00256                 cbValPols->Append((*pos)->ToString());
00257             }
00258         }
00259     }
00260     catch(...)
00261     {
00262     }   
00263 #endif
00264 }
00272 void CScvpResponderEntryDlg::ClearMembers()
00273 {
00274     m_url = wxEmptyString;
00275     m_bDpdOnly = false;
00276     m_bGenerateNonce = false;
00277     m_bRequireNonceMatch = false;
00278     m_bRequireSignedDPD = false;
00279 
00280     //Want backs group box
00281     CPKIFOIDListPtr emptyWBs;
00282     m_wantBacks = emptyWBs;
00283 
00284     //Validation policy group box
00285     CPKIFContentInfoPtr emptyVP;
00286     m_valPol = emptyVP;
00287     m_bFetchValPol = false;
00288 
00289     //SCVP request signing credential group box
00290     CPKIFCredentialPtr emptyCred;
00291     m_cred = emptyCred;
00292 
00293     IPKIFMediatorPtr emptyMeds;
00294     m_medsForCreds = emptyMeds;
00295 
00296     //Acceptable namespaces group box
00297     CPKIFGeneralSubtreeList emptyNames;
00298     m_rndList = emptyNames;
00299 
00300     //Settings for SCVP response verification group box
00301     m_scvpResponseMeds = emptyMeds;
00302 
00303     CPKIFPathSettingsPtr emptyPath;
00304     m_scvpResponsePath = emptyPath;
00305 
00306     //Custom validation policy group box
00307     m_valPolPath = emptyPath;
00308 }
00309 
00310 // WDR: handler implementations for CScvpResponderEntryDlg
00311 
00312 //**********************************************************************************************
00313 //  Dialog events
00314 //**********************************************************************************************
00322 bool CScvpResponderEntryDlg::Validate()
00323 {
00324     return TRUE;
00325 }
00333 bool CScvpResponderEntryDlg::TransferDataToWindow()
00334 {
00335     return TRUE;
00336 }
00344 bool CScvpResponderEntryDlg::TransferDataFromWindow()
00345 {
00346     return TRUE;
00347 }
00348 
00349 //**********************************************************************************************
00350 //  Button-related events
00351 //**********************************************************************************************
00359 void CScvpResponderEntryDlg::OnOk(wxCommandEvent &event)
00360 {
00361     wxTextCtrl* tc = GetTextUrlScvp();
00362     wxASSERT(tc);
00363     wxString url = tc->GetValue();
00364     if(url.IsEmpty())
00365     {
00366         wxMessageBox(wxT("You must specify at least a URI or click Cancel to dismiss this dialog."));
00367         return;
00368     }
00369 
00370     m_url = url;
00371 
00372     event.Skip();
00373 }
00381 void CScvpResponderEntryDlg::OnCancel(wxCommandEvent &event)
00382 {
00383     event.Skip();
00384 }
00393 void CScvpResponderEntryDlg::OnLoadNow( wxCommandEvent &event )
00394 {
00395 #ifdef __INCLUDE_SCVP_SUPPORT__
00396     CPKIFValPolRequestPtr vr(new CPKIFValPolRequest);
00397     vr->SetGenerateNonce(true);
00398 
00399     CPKIFBufferPtr encVR = vr->Encode();
00400 
00401     CPKIFOIDPtr id_ct_scvp_valPolRequest
00402         (new CPKIFOID(CPKIFStringPtr(new std::string("1.2.840.113549.1.9.16.1.12"))));//id-ct-scvp-valPolRequest
00403 
00404     CPKIFContentInfo ci;
00405     ci.SetContent(encVR);
00406     ci.SetContentType(id_ct_scvp_valPolRequest);
00407 
00408     CPKIFBufferPtr resp;
00409     CPKIFBufferPtr encReq = ci.Encode();
00410     if(PostRequestURL(encReq, resp, GetTextUrlScvp()->GetValue().mb_str(), PKIF_SCVP_VAL_POL)) 
00411     {
00412         try
00413         {
00414             const unsigned char* xxx = resp->GetBuffer();
00415             int xxxlen = resp->GetLength();
00416 
00417             CPKIFContentInfoPtr ci(new CPKIFContentInfo);
00418             ci->Decode(xxx, xxxlen);
00419             m_valPol = ci;
00420             DisplayValPolTime();
00421         }
00422         catch(...)
00423         {
00424         }
00425     }
00426 #endif
00427 }
00435 void CScvpResponderEntryDlg::OnScvpResponseMeds( wxCommandEvent &event )
00436 {
00437     CPKIFPkiEnvironmentDefinitionNotebook pedn(NULL,-1,wxT("PKI Environment Definition for SCVP Response Processing"),
00438         wxDefaultPosition,wxDefaultSize, wxDEFAULT_DIALOG_STYLE, false);
00439     pedn.SetInitialMediator(m_scvpResponseMeds);
00440     pedn.Center();
00441     wxButton * okButton = (wxButton *)pedn.FindWindow(wxID_OK);
00442     if(okButton) okButton->SetLabel(wxT("Save"));
00443     if(wxID_OK == pedn.ShowModal())
00444     {
00445         m_scvpResponseMeds = pedn.GetMediator();
00446     }
00447 }
00455 void CScvpResponderEntryDlg::OnScvpResponsePath( wxCommandEvent &event )
00456 {
00457     CPKIFPathSettingsNotebook psn(NULL,-1,wxT("Path Validation Settings for SCVP Response Processing"),wxDefaultPosition,wxDefaultSize,
00458         wxDEFAULT_DIALOG_STYLE);
00459     psn.SetInitialPathSettings(m_scvpResponsePath);
00460     psn.Center();
00461     wxButton * okButton = (wxButton *)psn.FindWindow(wxID_OK);
00462     if(okButton) okButton->SetLabel(wxT("Save"));
00463     if(wxID_OK == psn.ShowModal())
00464     {
00465         m_scvpResponsePath = psn.GetPathSettings();
00466     }
00467 }
00475 void CScvpResponderEntryDlg::OnValPolPath( wxCommandEvent &event )
00476 {
00477     CPKIFPathSettingsNotebook psn(NULL,-1,wxT("Path Validation Settings for Custom Validation Policy"),wxDefaultPosition,wxDefaultSize,
00478         wxDEFAULT_DIALOG_STYLE);
00479     psn.SetInitialPathSettings(m_valPolPath);
00480     psn.Center();
00481     wxButton * okButton = (wxButton *)psn.FindWindow(wxID_OK);
00482     if(okButton) okButton->SetLabel(wxT("Save"));
00483     if(wxID_OK == psn.ShowModal())
00484     {
00485         m_valPolPath = psn.GetPathSettings();
00486     }
00487 }
00496 void CScvpResponderEntryDlg::OnCheckValPolPath( wxCommandEvent &event )
00497 {
00498     if(GetCheckboxValPolMeds()->GetValue())
00499     {
00500         GetValPolMeds()->Enable();
00501     }
00502     else
00503     {
00504         GetValPolMeds()->Enable(false);
00505     }
00506 }
00515 void CScvpResponderEntryDlg::OnCheckScvpResponsePath( wxCommandEvent &event )
00516 {
00517     if(GetCheckboxScvpResponsePath()->GetValue())
00518     {
00519         GetScvpResponsePath()->Enable();
00520     }
00521     else
00522     {
00523         GetScvpResponsePath()->Enable(false);
00524     }
00525 }
00534 void CScvpResponderEntryDlg::OnCheckScvpResponseMeds( wxCommandEvent &event )
00535 {
00536     if(GetCheckboxScvpResponseMeds()->GetValue())
00537     {
00538         GetScvpResponseMeds()->Enable();
00539     }
00540     else
00541     {
00542         GetScvpResponseMeds()->Enable(false);
00543     }
00544 }
00552 void CScvpResponderEntryDlg::OnRemoveNamespace( wxCommandEvent &event )
00553 {
00554     wxListBox* lb = GetListboxNamespacesScvp();
00555     wxASSERT(lb);
00556     int sel = lb->GetSelection();
00557     string selection;
00558     if(wxNOT_FOUND != sel)
00559     {
00560         selection = lb->GetStringSelection().mb_str();
00561         lb->Delete(sel);
00562     }
00563 
00564     CPKIFGeneralSubtreeList::iterator pos;
00565     CPKIFGeneralSubtreeList::iterator end = m_rndList.end();
00566     for(pos = m_rndList.begin(); pos != end; ++pos)
00567     {
00568         string str1 = (*pos)->GetBase()->directoryName()->ToString();
00569         if(strcmp(str1.c_str(), selection.c_str()) == 0 )
00570         {
00571             m_rndList.erase(pos);
00572             break;
00573         }
00574     }
00575 }
00583 void CScvpResponderEntryDlg::OnAddNamespace( wxCommandEvent &event )
00584 {
00585     static wxString filter = wxT("Certificate files (*.cer, *.der, *.crt)|*.cer;*.der;*.crt|All files (*.*)|*.*");
00586     wxString certLocation = wxFileSelector(wxT("Select Certificate File"), 0, 0, 0, filter);//wxT("CRT files (*.crt)|*.crt|DER files (*.der)|*.der|CER files (*.cer)|*.cer"));
00587     if(certLocation != wxT(""))
00588     {
00589         try {
00590             CExtractInfoFromCertDialog dlg((wxWindow *) this, -1 , wxT("Extract Info From Certificate"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, certLocation);
00591             dlg.Centre();
00592             if(wxID_OK == dlg.ShowModal())
00593             {   
00594                 CPKIFGeneralSubtreePtr ns = dlg.GetNamespace();
00595 
00596                 m_rndList.push_back(ns);
00597                 wxString wxNS(ns->GetBase()->directoryName()->ToString(),wxConvUTF8);
00598                 GetListboxNamespacesScvp()->InsertItems(1, &wxNS, 0);
00599             }
00600         }catch(CPKIFException &){
00601             wxMessageBox(wxT("Unable to decode certificate."),wxT("Error"),wxICON_ERROR|wxOK);
00602         }
00603     }
00604 }
00612 void CScvpResponderEntryDlg::OnClearCredential( wxCommandEvent &event )
00613 {
00614     CPKIFCredentialPtr emptyCred;
00615     m_cred = emptyCred;
00616 
00617     GetTextSignersNameScvp()->Clear();
00618     GetTextSignersSkidScvp()->Clear();
00619 }
00627 void CScvpResponderEntryDlg::OnSelectCredential( wxCommandEvent &event )
00628 {
00629     CPKIFCredentialSelectorDlg dlg(this, -1, wxT("Select a credential"));
00630     dlg.SetMediator(m_medsForCreds);
00631     if(wxID_OK == dlg.ShowModal())
00632     {
00633         m_cred = dlg.GetSelectedCredential();
00634         DisplayCertificateDetails(m_cred->GetCertificate(), GetTextSignersNameScvp(), GetTextSignersSkidScvp());
00635     }
00636 }
00637 
00648 void CScvpResponderEntryDlg::SetInitialScvpClient(IPKIFScvpClientPtr& scvp)
00649 {
00650 #ifdef __INCLUDE_SCVP_SUPPORT__
00651     if(scvp)
00652     {
00653         //*********************************************************************************************
00654         //SCVP responder location information group box
00655         //*********************************************************************************************
00656         const char* url = scvp->GetResponderUrl();
00657         if(url)
00658         {
00659             wxString wxURLString(url,wxConvUTF8);
00660             m_url = wxURLString;
00661         }
00662         else
00663         {
00664             m_url = wxEmptyString;
00665         }
00666 
00667         CPKIFScvpPathBuildPtr dpd = dynamic_pointer_cast<CPKIFScvpPathBuild, IPKIFScvpClient>(scvp);
00668         if(dpd)
00669         {
00670             m_bDpdOnly = true;
00671             if(dpd->GetUseValidPkcPathCertCheck())
00672             {
00673                 GetResponderValidatedDpd()->SetValue(true);
00674             }
00675             else
00676             {
00677                 GetClientValidatedDpd()->SetValue(true);
00678             }
00679 
00680         }
00681         else
00682             m_bDpdOnly = false;
00683 
00684         //we do not distinguish between including a nonce and requiring a nonce.
00685         m_bGenerateNonce = scvp->GetRequireNonceMatch();
00686         m_bRequireNonceMatch = m_bGenerateNonce;
00687 
00688         m_bRequireSignedDPD = scvp->GetRequireSignedDPD();
00689 
00690         //*********************************************************************************************
00691         //Want backs group box
00692         //*********************************************************************************************
00693         m_wantBacks = scvp->GetWantBacks();
00694 
00695         //*********************************************************************************************
00696         //Evidence record verifier group box
00697         //*********************************************************************************************
00698         m_erv = scvp->GetEvidenceRecordVerifier();
00699 
00700         //*********************************************************************************************
00701         //Validation policy group box
00702         //*********************************************************************************************
00703         m_valPol = scvp->GetValPol();
00704         m_bFetchValPol = scvp->GetFetchValPolWhenLoading();
00705 
00706         //*********************************************************************************************
00707         //SCVP request signing credential group box
00708         //*********************************************************************************************
00709         m_cred = scvp->GetSigningCredential();
00710 
00711         //*********************************************************************************************
00712         //Acceptable namespaces group box
00713         //*********************************************************************************************
00714         m_rndList = scvp->GetNamespaces();
00715 
00716         //*********************************************************************************************
00717         //Settings for SCVP response verification group box
00718         //*********************************************************************************************
00719         m_scvpResponseMeds = scvp->GetMediator();
00720         m_scvpResponsePath = scvp->GetPathSettings();
00721 
00722         //*********************************************************************************************
00723         //Custom validation policy group box
00724         //*********************************************************************************************
00725         m_valPolPath = scvp->GetPathSettingsForValPol();
00726     }
00727     else
00728 #endif
00729     {
00730         ClearMembers();
00731     }
00732 }
00740 void CScvpResponderEntryDlg::OnClickConfigureErVerifier( wxCommandEvent &event )
00741 {
00742     #ifdef __INCLUDE_SCVP_SUPPORT__
00743     CEvidenceRecordVerifierDlg dlg(this, -1, wxT("Configure your evidence record verifier"));
00744     dlg.SetInitialEvidenceRecordVerifier(m_erv);
00745     if(dlg.ShowModal())
00746     {
00747         m_erv = dlg.GetEvidenceRecordVerifier();
00748     }
00749     #endif
00750 }
00758 void CScvpResponderEntryDlg::OnClickSCVPDPDOnly( wxCommandEvent &event )
00759 {
00760     if(GetCheckScvpDpdOnly()->GetValue())
00761     {
00762         GetClientValidatedDpd()->Enable();
00763         GetResponderValidatedDpd()->Enable();
00764     }
00765     else
00766     {
00767         GetClientValidatedDpd()->Enable(false);
00768         GetResponderValidatedDpd()->Enable(false);
00769     }
00770 }
00771 //**********************************************************************************************
00772 //  Sow and reap
00773 //**********************************************************************************************
00774 
00784 void CScvpResponderEntryDlg::OnInitDialog(wxInitDialogEvent& event)
00785 {
00786     //*********************************************************************************************
00787     //SCVP responder location information group box
00788     //*********************************************************************************************
00789     if(!m_url.IsEmpty())
00790         GetTextUrlScvp()->SetValue(m_url);
00791 
00792     GetCheckScvpDpdOnly()->SetValue(m_bDpdOnly);
00793     if(m_bDpdOnly)
00794     {
00795         GetClientValidatedDpd()->Enable();
00796         GetResponderValidatedDpd()->Enable();
00797     }
00798     GetCheckRequireSignedDpd()->SetValue(m_bRequireSignedDPD);
00799     GetCheckRequireNonce()->SetValue(m_bRequireNonceMatch);
00800 
00801     //*********************************************************************************************
00802     //Want backs group box
00803     //*********************************************************************************************
00804     if(m_wantBacks)
00805     {
00806         CPKIFOIDList::iterator wbPos;
00807         CPKIFOIDList::iterator wbEnd = m_wantBacks->end();
00808         for(wbPos = m_wantBacks->begin(); wbPos != wbEnd; ++wbPos)
00809         {
00810             if(*g_id_swb_pkc_best_cert_path2 == *(*wbPos))
00811                 GetCertPathWB()->SetValue(true);
00812             else if(*g_id_swb_pkc_revocation_info2 == *(*wbPos))
00813                 GetRevInfoWB()->SetValue(true);
00814             else if(*g_id_swb_pkc_cert2 == *(*wbPos))
00815                 GetTargetCertWB()->SetValue(true);
00816             else if(*g_idSwbPartialCertPath2 == *(*wbPos))
00817                 GetPartialPathWB()->SetValue(true);
00818             else if(*g_idSwbErsPkcCert2 == *(*wbPos))
00819                 GetErsTargetCertWB()->SetValue(true);
00820             else if(*g_idSwbErsPartialCertPath2 == *(*wbPos))
00821                 GetErsPartialPathWB()->SetValue(true);
00822             else if(*g_idSwbErsRevocationInfo2 == *(*wbPos))
00823                 GetErsRevInfoWB()->SetValue(true);
00824         }
00825     }
00826 
00827     //*********************************************************************************************
00828     //Validation policy group box
00829     //*********************************************************************************************
00830     GetCheckboxFetchValpol()->SetValue(m_bFetchValPol);
00831     if(m_valPol)
00832     {
00833         DisplayValPolTime();
00834     }
00835 
00836     //*********************************************************************************************
00837     //SCVP request signing credential group box
00838     //*********************************************************************************************
00839     if(m_cred != (CPKIFCredential*)NULL)
00840         DisplayCertificateDetails(m_cred->GetCertificate(), GetTextSignersNameScvp(), GetTextSignersSkidScvp());
00841 
00842     //*********************************************************************************************
00843     //Acceptable namespaces group box
00844     //*********************************************************************************************
00845     CPKIFGeneralSubtreeList::iterator pos;
00846     CPKIFGeneralSubtreeList::iterator end = m_rndList.end();
00847     for(pos = m_rndList.begin(); pos != end; ++pos)
00848     {
00849         string str1 = (*pos)->GetBase()->directoryName()->ToString();
00850         wxString wxNS(str1.c_str(),wxConvUTF8);
00851         GetListboxNamespacesScvp()->InsertItems(1, &wxNS, 0);
00852     }
00853 
00854     //*********************************************************************************************
00855     //Settings for SCVP response verification group box
00856     //*********************************************************************************************
00857     if(m_scvpResponseMeds)
00858     {
00859         GetCheckboxScvpResponseMeds()->SetValue(true);
00860         GetScvpResponseMeds()->Enable();
00861     }
00862     else
00863     {
00864         GetCheckboxScvpResponseMeds()->SetValue(false);
00865         GetScvpResponseMeds()->Enable(false);
00866     }
00867 
00868     if(m_scvpResponsePath)
00869     {
00870         GetCheckboxScvpResponsePath()->SetValue(true);
00871         GetScvpResponsePath()->Enable();
00872     }
00873     else
00874     {
00875         GetCheckboxScvpResponsePath()->SetValue(false);
00876         GetScvpResponsePath()->Enable(false);
00877     }
00878 
00879     //*********************************************************************************************
00880     //Custom validation policy group box
00881     //*********************************************************************************************
00882     if(m_valPolPath)
00883     {
00884         GetCheckboxValPolMeds()->SetValue(true);
00885         GetValPolMeds()->Enable();
00886     }
00887     else
00888     {
00889         GetCheckboxValPolMeds()->SetValue(false);
00890         GetValPolMeds()->Enable(false);
00891     }
00892 }
00900 IPKIFScvpClientPtr CScvpResponderEntryDlg::GetScvpClient()
00901 {
00902 #ifdef __INCLUDE_SCVP_SUPPORT__
00903 
00904     IPKIFScvpClientPtr empty;
00905 
00906     //*********************************************************************************************
00907     //SCVP responder location information group box
00908     //*********************************************************************************************
00909     //if we don't have at least the URL, return empty
00910     if(m_url.IsEmpty())
00911         return empty;
00912 
00913     IPKIFScvpClientPtr scvp;
00914     if(GetCheckScvpDpdOnly()->GetValue())
00915     {
00916         CPKIFScvpPathBuildPtr pb(new CPKIFScvpPathBuild);
00917         scvp = dynamic_pointer_cast<IPKIFScvpClient, CPKIFScvpPathBuild>(pb);
00918 
00919         if(GetResponderValidatedDpd()->GetValue())
00920             pb->SetUseValidPkcPathCertCheck(true);
00921     }
00922     else
00923     {
00924         CPKIFScvpPathBuildAndValidatePtr pbav(new CPKIFScvpPathBuildAndValidate);
00925         scvp = dynamic_pointer_cast<IPKIFScvpClient, CPKIFScvpPathBuildAndValidate>(pbav);
00926     }
00927 
00928     scvp->SetResponderUrl(m_url.mb_str());
00929     scvp->SetRequireNonceMatch(GetCheckRequireNonce()->GetValue());
00930     scvp->SetGenerateNonce(GetCheckRequireNonce()->GetValue());
00931     scvp->SetRequireSignedDPD(GetCheckRequireSignedDpd()->GetValue());
00932 
00933     wxString oidVal = GetComboBoxValpol()->GetValue();
00934     if(!oidVal.IsEmpty())
00935     {
00936         CPKIFOIDPtr id_svp_defaultValPolicy(new CPKIFOID("1.3.6.1.5.5.7.19.1"));
00937 
00938         CPKIFOIDPtr tmpOidVal(new CPKIFOID(oidVal.mb_str()));
00939         if(!(*tmpOidVal == *id_svp_defaultValPolicy))
00940         {
00941             scvp->SetValidationPolicy(tmpOidVal);
00942         }
00943     }
00944 
00945     //*********************************************************************************************
00946     //Want backs group box
00947     //*********************************************************************************************
00948     CPKIFOIDListPtr wantBacks(new CPKIFOIDList);
00949     if(GetCertPathWB()->GetValue())
00950         wantBacks->push_back(g_id_swb_pkc_best_cert_path2);
00951     if(GetRevInfoWB()->GetValue())
00952         wantBacks->push_back(g_id_swb_pkc_revocation_info2);
00953     if(GetTargetCertWB()->GetValue())
00954         wantBacks->push_back(g_id_swb_pkc_cert2);
00955     if(GetPartialPathWB()->GetValue())
00956         wantBacks->push_back(g_idSwbPartialCertPath2);
00957     if(GetErsTargetCertWB()->GetValue())
00958         wantBacks->push_back(g_idSwbErsPkcCert2);
00959     if(GetErsPartialPathWB()->GetValue())
00960         wantBacks->push_back(g_idSwbErsPartialCertPath2);
00961     if(GetErsRevInfoWB()->GetValue())
00962         wantBacks->push_back(g_idSwbErsRevocationInfo2);        
00963 
00964     if(!wantBacks->empty())
00965         scvp->SetWantBacks(wantBacks);
00966 
00967     //*********************************************************************************************
00968     //Evidence record verifier group box
00969     //*********************************************************************************************
00970     if(m_erv)
00971         scvp->SetEvidenceRecordVerifier(m_erv);
00972 
00973     //*********************************************************************************************
00974     //Validation policy group box
00975     //*********************************************************************************************
00976     scvp->SetFetchValPolWhenLoading(GetCheckboxFetchValpol()->GetValue());
00977     scvp->SetValPol(m_valPol);
00978 
00979     //*********************************************************************************************
00980     //SCVP request signing credential group box
00981     //*********************************************************************************************
00982     scvp->SetSigningCredential(m_cred);
00983 
00984     //*********************************************************************************************
00985     //Acceptable namespaces group box
00986     //*********************************************************************************************
00987     CPKIFGeneralSubtreeList::iterator namePos;
00988     CPKIFGeneralSubtreeList::iterator nameEnd = m_rndList.end();
00989     for(namePos = m_rndList.begin(); namePos != nameEnd; ++namePos)
00990         scvp->AddNamespace(*namePos);
00991 
00992     //*********************************************************************************************
00993     //Settings for SCVP response verification group box
00994     //*********************************************************************************************
00995     scvp->SetPathSettings(m_scvpResponsePath);
00996     scvp->SetMediator(m_scvpResponseMeds);
00997 
00998     //*********************************************************************************************
00999     //Custom validation policy group box
01000     //*********************************************************************************************
01001     scvp->SetPathSettingsForValPol(m_valPolPath);
01002 
01003     return scvp;
01004 #else
01005     IPKIFScvpClientPtr empty;
01006     return empty;
01007 #endif
01008 }
01009 

Generated on Mon Nov 15 11:15:56 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6