Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: net/cert/cert_verify_proc_ios.cc

Issue 2864133002: Convert iOS to use X509CertificateBytes. (Closed)
Patch Set: static_cast, more unittest Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_string_util_icu_alternatives_ios.mm ('k') | net/cert/cert_verify_proc_ios_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/cert_verify_proc_ios.cc
diff --git a/net/cert/cert_verify_proc_ios.cc b/net/cert/cert_verify_proc_ios.cc
index 527326e6bb86bc18c57d18da3ae9dfae84038978..ebb296014086632190a7868740c2f5dcd18b98d2 100644
--- a/net/cert/cert_verify_proc_ios.cc
+++ b/net/cert/cert_verify_proc_ios.cc
@@ -14,6 +14,8 @@
#include "net/cert/cert_verify_result.h"
#include "net/cert/test_root_certs.h"
#include "net/cert/x509_certificate.h"
+#include "net/cert/x509_util_ios.h"
+#include "net/cert/x509_util_ios_and_mac.h"
#include "net/ssl/openssl_ssl_util.h"
using base::ScopedCFTypeRef;
@@ -115,14 +117,19 @@ void GetCertChainInfo(CFArrayRef cert_chain, CertVerifyResult* verify_result) {
verified_chain.push_back(chain_cert);
}
- std::string der_bytes;
- if (!X509Certificate::GetDEREncoded(chain_cert, &der_bytes)) {
+ base::ScopedCFTypeRef<CFDataRef> der_data(
+ SecCertificateCopyData(chain_cert));
+ if (!der_data) {
verify_result->cert_status |= CERT_STATUS_INVALID;
return;
}
base::StringPiece spki_bytes;
- if (!asn1::ExtractSPKIFromDERCert(der_bytes, &spki_bytes)) {
+ if (!asn1::ExtractSPKIFromDERCert(
+ base::StringPiece(
+ reinterpret_cast<const char*>(CFDataGetBytePtr(der_data)),
+ CFDataGetLength(der_data)),
+ &spki_bytes)) {
verify_result->cert_status |= CERT_STATUS_INVALID;
return;
}
@@ -148,7 +155,8 @@ void GetCertChainInfo(CFArrayRef cert_chain, CertVerifyResult* verify_result) {
}
scoped_refptr<X509Certificate> verified_cert_with_chain =
- X509Certificate::CreateFromHandle(verified_cert, verified_chain);
+ x509_util::CreateX509CertificateFromSecCertificate(verified_cert,
+ verified_chain);
if (verified_cert_with_chain)
verify_result->verified_cert = std::move(verified_cert_with_chain);
else
@@ -248,7 +256,7 @@ int CertVerifyProcIOS::VerifyInternal(
return NetErrorFromOSStatus(status);
ScopedCFTypeRef<CFMutableArrayRef> cert_array(
- cert->CreateOSCertChainForCert());
+ x509_util::CreateSecCertificateArrayForX509Certificate(cert));
ScopedCFTypeRef<SecTrustRef> trust_ref;
SecTrustResultType trust_result = kSecTrustResultDeny;
ScopedCFTypeRef<CFArrayRef> final_chain;
« no previous file with comments | « net/base/net_string_util_icu_alternatives_ios.mm ('k') | net/cert/cert_verify_proc_ios_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698