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 <openssl/asn1.h> | 7 #include <openssl/asn1.h> |
8 #include <openssl/bytestring.h> | 8 #include <openssl/bytestring.h> |
9 #include <openssl/crypto.h> | 9 #include <openssl/crypto.h> |
10 #include <openssl/obj_mac.h> | 10 #include <openssl/obj_mac.h> |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 // static | 303 // static |
304 X509_STORE* X509Certificate::cert_store() { | 304 X509_STORE* X509Certificate::cert_store() { |
305 return X509InitSingleton::GetInstance()->store(); | 305 return X509InitSingleton::GetInstance()->store(); |
306 } | 306 } |
307 | 307 |
308 // static | 308 // static |
309 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, | 309 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, |
310 std::string* encoded) { | 310 std::string* encoded) { |
311 base::StringPiece der; | 311 base::StringPiece der; |
312 if (!x509_util::GetDER(cert_handle, &der)) | 312 if (!cert_handle || !x509_util::GetDER(cert_handle, &der)) |
313 return false; | 313 return false; |
314 encoded->assign(der.data(), der.length()); | 314 encoded->assign(der.data(), der.length()); |
315 return true; | 315 return true; |
316 } | 316 } |
317 | 317 |
318 // static | 318 // static |
319 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, | 319 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, |
320 X509Certificate::OSCertHandle b) { | 320 X509Certificate::OSCertHandle b) { |
321 DCHECK(a && b); | 321 DCHECK(a && b); |
322 if (a == b) | 322 if (a == b) |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 if (X509_NAME_cmp(issuer, cert_names[n]) == 0) { | 433 if (X509_NAME_cmp(issuer, cert_names[n]) == 0) { |
434 return true; | 434 return true; |
435 } | 435 } |
436 } | 436 } |
437 } | 437 } |
438 | 438 |
439 return false; | 439 return false; |
440 } | 440 } |
441 | 441 |
442 } // namespace net | 442 } // namespace net |
OLD | NEW |