virtual void verify(vmime::ref<vmime::security::cert::certificateChain> chain) { std::cout<<"\n"<<chain->getCount()<<" certificates in chain\n"; vmime::utility::outputStreamAdapter os(std::cout); for(int i=chain->getCount()-1; i>=0; --i) { vmime::ref<X509Certificate> tmp=chain->getAt(i).dynamicCast<X509Certificate>(); std::cout<<"------------ CERT # "<<chain->getCount()-i<<" ----------------\n"; tmp->write(os, X509Certificate::FORMAT_PEM); } }
void verify(vmime::ref <vmime::security::cert::certificateChain> chain) { try { setX509TrustedCerts(m_trustedCerts); defaultCertificateVerifier::verify(chain); } catch (vmime::exceptions::certificate_verification_exception&) { // Obtain subject's certificate vmime::ref <vmime::security::cert::certificate> cert = chain->getAt(0); // Accept it, and remember user's choice for later if (cert->getType() == "X.509") { m_trustedCerts.push_back(cert.dynamicCast <vmime::security::cert::X509Certificate>()); } } }