mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-01 01:36:09 +03:00
cert: Handle AIA response in PKCS#7 format
This commit is contained in:
parent
e670624f04
commit
0059164b51
@ -9,6 +9,7 @@
|
|||||||
#include "net/cert/cert_net_fetcher.h"
|
#include "net/cert/cert_net_fetcher.h"
|
||||||
#include "net/cert/internal/cert_errors.h"
|
#include "net/cert/internal/cert_errors.h"
|
||||||
#include "net/cert/pem.h"
|
#include "net/cert/pem.h"
|
||||||
|
#include "net/cert/x509_certificate.h"
|
||||||
#include "net/cert/x509_util.h"
|
#include "net/cert/x509_util.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
@ -113,6 +114,23 @@ bool AiaRequest::AddCompletedFetchToResults(Error error,
|
|||||||
//
|
//
|
||||||
// TODO(mattm): Is supporting CMS message format important?
|
// TODO(mattm): Is supporting CMS message format important?
|
||||||
|
|
||||||
|
// Handles PKCS#7 encoded certificates
|
||||||
|
CertificateList certs = X509Certificate::CreateCertificateListFromBytes(
|
||||||
|
reinterpret_cast<const char*>(fetched_bytes.data()), fetched_bytes.size(),
|
||||||
|
X509Certificate::FORMAT_AUTO);
|
||||||
|
bool certs_ok = false;
|
||||||
|
for (const auto& cert : certs) {
|
||||||
|
auto parsed = ParsedCertificate::Create(
|
||||||
|
bssl::UpRef(cert->cert_buffer()),
|
||||||
|
x509_util::DefaultParseCertificateOptions(), /*errors=*/nullptr);
|
||||||
|
if (parsed) {
|
||||||
|
results->push_back(parsed);
|
||||||
|
certs_ok = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (certs_ok)
|
||||||
|
return true;
|
||||||
|
|
||||||
// TODO(https://crbug.com/870359): Some AIA responses are served as PEM, which
|
// TODO(https://crbug.com/870359): Some AIA responses are served as PEM, which
|
||||||
// is not part of RFC 5280's profile.
|
// is not part of RFC 5280's profile.
|
||||||
return ParseCertFromDer(fetched_bytes.data(), fetched_bytes.size(),
|
return ParseCertFromDer(fetched_bytes.data(), fetched_bytes.size(),
|
||||||
|
Loading…
Reference in New Issue
Block a user