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

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

Issue 1720653002: Add new functions to handle UPN and email addresses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't squash 10 other commits into the same CL Created 4 years, 9 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
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_certificate.h" 5 #include "net/cert/x509_certificate.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <cryptohi.h> 8 #include <cryptohi.h>
9 #include <keyhi.h> 9 #include <keyhi.h>
10 #include <nss.h> 10 #include <nss.h>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 return result; 115 return result;
116 } 116 }
117 117
118 void X509Certificate::GetSubjectAltName( 118 void X509Certificate::GetSubjectAltName(
119 std::vector<std::string>* dns_names, 119 std::vector<std::string>* dns_names,
120 std::vector<std::string>* ip_addrs) const { 120 std::vector<std::string>* ip_addrs) const {
121 x509_util::GetSubjectAltName(cert_handle_, dns_names, ip_addrs); 121 x509_util::GetSubjectAltName(cert_handle_, dns_names, ip_addrs);
122 } 122 }
123 123
124 void X509Certificate::GetSubjectAltName(SubjectAltNameType type,
125 std::vector<std::string>* names) const {
126 x509_util::GetSubjectAltName(cert_handle_, type, names);
127 }
128
124 bool X509Certificate::IsIssuedByEncoded( 129 bool X509Certificate::IsIssuedByEncoded(
125 const std::vector<std::string>& valid_issuers) { 130 const std::vector<std::string>& valid_issuers) {
126 // Get certificate chain as scoped list of CERTCertificate objects. 131 // Get certificate chain as scoped list of CERTCertificate objects.
127 std::vector<CERTCertificate*> cert_chain; 132 std::vector<CERTCertificate*> cert_chain;
128 cert_chain.push_back(cert_handle_); 133 cert_chain.push_back(cert_handle_);
129 for (size_t n = 0; n < intermediate_ca_certs_.size(); ++n) { 134 for (size_t n = 0; n < intermediate_ca_certs_.size(); ++n) {
130 cert_chain.push_back(intermediate_ca_certs_[n]); 135 cert_chain.push_back(intermediate_ca_certs_[n]);
131 } 136 }
132 // Convert encoded issuers to scoped CERTName* list. 137 // Convert encoded issuers to scoped CERTName* list.
133 std::vector<CERTName*> issuers; 138 std::vector<CERTName*> issuers;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // static 288 // static
284 bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) { 289 bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) {
285 crypto::ScopedSECKEYPublicKey public_key(CERT_ExtractPublicKey(cert_handle)); 290 crypto::ScopedSECKEYPublicKey public_key(CERT_ExtractPublicKey(cert_handle));
286 if (!public_key.get()) 291 if (!public_key.get())
287 return false; 292 return false;
288 return SECSuccess == CERT_VerifySignedDataWithPublicKey( 293 return SECSuccess == CERT_VerifySignedDataWithPublicKey(
289 &cert_handle->signatureWrap, public_key.get(), NULL); 294 &cert_handle->signatureWrap, public_key.get(), NULL);
290 } 295 }
291 296
292 } // namespace net 297 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698