#191 X509Certificate::import() now auto-detects format

This commit is contained in:
Vincent Richard 2018-03-12 20:37:12 +01:00
parent abba40e97d
commit f04190bafa

View File

@ -931,17 +931,7 @@ vmime::shared_ptr <vmime::security::cert::X509Certificate>
vmime::utility::inputStreamAdapter is(certFile);
vmime::shared_ptr <vmime::security::cert::X509Certificate> cert;
// Try DER format
cert = vmime::security::cert::X509Certificate::import
(is, vmime::security::cert::X509Certificate::FORMAT_DER);
if (cert != NULL)
return cert;
// Try PEM format
is.reset();
cert = vmime::security::cert::X509Certificate::import
(is, vmime::security::cert::X509Certificate::FORMAT_PEM);
cert = vmime::security::cert::X509Certificate::import(is);
return cert;
}