+ SSLCertData = SSLCertsInc;
+
+}
+
+void frmSSLCertificate::SetupCertsString(SSLCertCollectionString SSLCertsInc)
+{
+
+ // Grab the certificates, start from the one requested and show.
+
+ lblValidityStatus->Hide();
+
+ std::map<int, struct SSLCertDataString>::iterator SCDIter;
+ SCDIter = SSLCertsInc.SSLCollection.find(StartFrom);
+
+ // Setup the summary tab.
+
+ // Split the subject data down.
+
+ std::map<string, string>::iterator SDIter = SCDIter->second.CertData.find("Subject");
+ std::map<string, string> SubjectData = GetSubjectData(SDIter->second);
+
+ // Get the common name (CN).
+
+ std::map<string, string>::iterator CNiter = SubjectData.find("CN");
+
+ lblCertName->SetLabel(CNiter->second);
+
+ // Split the issuer data down.
+
+ // Attempt to grab the organisation name first then
+ // the common name if it doesn't exist.
+
+ if (SubjectData.find("O") != SubjectData.end()){
+
+ std::map<string, string>::iterator Oiter = SubjectData.find("O");
+ lblIssuedToData->SetLabel(Oiter->second);
+
+ } else {
+
+ lblIssuedToData->SetLabel(CNiter->second);
+
+ }
+
+ // Setup the valid from date.
+
+ std::map<string, string>::iterator Validiter = SCDIter->second.CertData.find("Start date");
+
+ wxDateTime ValidFromDate;
+ ValidFromDate.ParseDate(Validiter->second);
+
+ lblValidFromData->SetLabel(ValidFromDate.FormatDate());
+
+ // Setup the expiry date.
+
+ std::map<string, string>::iterator Expiryiter = SCDIter->second.CertData.find("Expire date");
+
+ wxDateTime ExpiryDate;
+ ExpiryDate.ParseDate(Expiryiter->second);
+
+ lblValidUntilData->SetLabel(ExpiryDate.FormatDate());
+
+ // Setup the detail tab.
+
+ wxListItem ColumnDataName;
+ ColumnDataName.SetId(0);
+ ColumnDataName.SetText(_("Name"));
+ ColumnDataName.SetWidth(115);
+ lstValues->InsertColumn(0, ColumnDataName);
+
+ wxListItem ColumnDataValue;
+ ColumnDataValue.SetId(0);
+ ColumnDataValue.SetText(_("Value"));
+ ColumnDataValue.SetWidth(115);
+ lstValues->InsertColumn(0, ColumnDataValue);
+
+ int SSLIndex = 0;
+
+ for (std::map<string, string>::iterator iter = SCDIter->second.CertData.begin();
+ iter != SCDIter->second.CertData.end(); ++iter){
+
+ // Ignore certificate data.
+
+ if (iter->first == wxT("Cert")){
+
+ continue;
+
+ }
+
+ wxListItem SSLInfo;
+
+ SSLInfo.SetId(0);
+ SSLInfo.SetText(_("Mooo"));
+ SSLIndex = lstValues->InsertItem(SSLInfo);
+
+ lstValues->SetItem(SSLIndex, 0, iter->first);
+ lstValues->SetItem(SSLIndex, 1, iter->second);
+
+ }
+
+ // Setup the hierachy tab.
+
+ wxTreeItemId CertTreeId;
+ wxTreeItemId PrevCertTreeId;
+
+ for (std::map<int, struct SSLCertDataString>::reverse_iterator iter = SSLCertsInc.SSLCollection.rbegin();
+ iter != SSLCertsInc.SSLCollection.rend(); ++iter){
+
+ if (iter->first < StartFrom){
+
+ continue;
+
+ }
+
+ // Get the common name of the certificate. (Fetch subject).
+
+ std::map<string, string>::iterator CSDIter = iter->second.CertData.find("Subject");
+ std::map<string, string> CertSubjectData = GetSubjectData(CSDIter->second);
+
+ // Get the common name (CN).
+
+ std::map<string, string>::iterator CertCNiter = CertSubjectData.find("CN");
+
+ // Add to the hierachy.
+
+ SSLCertItemData *SSLCertID = new SSLCertItemData((iter->first + 1));
+
+ CertTreeId = treHierarchy->AppendItem(PrevCertTreeId, CertCNiter->second, 0, -1, SSLCertID);
+ PrevCertTreeId = CertTreeId;
+
+ }
+
+ treHierarchy->ExpandAll();
+
+ SSLCertDataString = SSLCertsInc;