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

Side by Side Diff: net/cert/x509_util_openssl.cc

Issue 1969293002: Remove net::ParsedCertificate struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « net/cert/internal/verify_certificate_chain.cc ('k') | net/net.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cert/x509_util_openssl.h" 5 #include "net/cert/x509_util_openssl.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <openssl/asn1.h> 8 #include <openssl/asn1.h>
9 #include <openssl/digest.h> 9 #include <openssl/digest.h>
10 #include <openssl/mem.h> 10 #include <openssl/mem.h>
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 bool GetTLSServerEndPointChannelBinding(const X509Certificate& certificate, 311 bool GetTLSServerEndPointChannelBinding(const X509Certificate& certificate,
312 std::string* token) { 312 std::string* token) {
313 static const char kChannelBindingPrefix[] = "tls-server-end-point:"; 313 static const char kChannelBindingPrefix[] = "tls-server-end-point:";
314 314
315 std::string der_encoded_certificate; 315 std::string der_encoded_certificate;
316 if (!X509Certificate::GetDEREncoded(certificate.os_cert_handle(), 316 if (!X509Certificate::GetDEREncoded(certificate.os_cert_handle(),
317 &der_encoded_certificate)) 317 &der_encoded_certificate))
318 return false; 318 return false;
319 319
320 ParsedCertificate parsed_certificate; 320 der::Input tbs_certificate_tlv;
321 if (!ParseCertificate(der::Input(base::StringPiece(der_encoded_certificate)), 321 der::Input signature_algorithm_tlv;
322 &parsed_certificate)) 322 der::BitString signature_value;
323 if (!ParseCertificate(der::Input(&der_encoded_certificate),
324 &tbs_certificate_tlv, &signature_algorithm_tlv,
325 &signature_value))
323 return false; 326 return false;
324 327
325 std::unique_ptr<SignatureAlgorithm> signature_algorithm = 328 std::unique_ptr<SignatureAlgorithm> signature_algorithm =
326 SignatureAlgorithm::CreateFromDer( 329 SignatureAlgorithm::CreateFromDer(signature_algorithm_tlv);
327 parsed_certificate.signature_algorithm_tlv);
328 if (!signature_algorithm) 330 if (!signature_algorithm)
329 return false; 331 return false;
330 332
331 const EVP_MD* digest_evp_md = nullptr; 333 const EVP_MD* digest_evp_md = nullptr;
332 switch (signature_algorithm->digest()) { 334 switch (signature_algorithm->digest()) {
333 case net::DigestAlgorithm::Sha1: 335 case net::DigestAlgorithm::Sha1:
334 case net::DigestAlgorithm::Sha256: 336 case net::DigestAlgorithm::Sha256:
335 digest_evp_md = EVP_sha256(); 337 digest_evp_md = EVP_sha256();
336 break; 338 break;
337 339
(...skipping 17 matching lines...) Expand all
355 357
356 digest.resize(out_size); 358 digest.resize(out_size);
357 token->assign(kChannelBindingPrefix); 359 token->assign(kChannelBindingPrefix);
358 token->append(digest.begin(), digest.end()); 360 token->append(digest.begin(), digest.end());
359 return true; 361 return true;
360 } 362 }
361 363
362 } // namespace x509_util 364 } // namespace x509_util
363 365
364 } // namespace net 366 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/verify_certificate_chain.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698