OLD | NEW |
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 arena.get(), | 134 arena.get(), |
135 &issuers)) { | 135 &issuers)) { |
136 return false; | 136 return false; |
137 } | 137 } |
138 return x509_util::IsCertificateIssuedBy(cert_chain, issuers); | 138 return x509_util::IsCertificateIssuedBy(cert_chain, issuers); |
139 } | 139 } |
140 | 140 |
141 // static | 141 // static |
142 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, | 142 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, |
143 std::string* encoded) { | 143 std::string* encoded) { |
144 if (!cert_handle->derCert.len) | 144 if (!cert_handle || !cert_handle->derCert.len) |
145 return false; | 145 return false; |
146 encoded->assign(reinterpret_cast<char*>(cert_handle->derCert.data), | 146 encoded->assign(reinterpret_cast<char*>(cert_handle->derCert.data), |
147 cert_handle->derCert.len); | 147 cert_handle->derCert.len); |
148 return true; | 148 return true; |
149 } | 149 } |
150 | 150 |
151 // static | 151 // static |
152 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, | 152 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, |
153 X509Certificate::OSCertHandle b) { | 153 X509Certificate::OSCertHandle b) { |
154 DCHECK(a && b); | 154 DCHECK(a && b); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 // static | 262 // static |
263 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle, | 263 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle, |
264 size_t* size_bits, | 264 size_t* size_bits, |
265 PublicKeyType* type) { | 265 PublicKeyType* type) { |
266 x509_util::GetPublicKeyInfo(cert_handle, size_bits, type); | 266 x509_util::GetPublicKeyInfo(cert_handle, size_bits, type); |
267 } | 267 } |
268 | 268 |
269 } // namespace net | 269 } // namespace net |
OLD | NEW |