| 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_util_ios.h" | 5 #include "net/cert/x509_util_ios.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <CommonCrypto/CommonDigest.h> | 8 #include <CommonCrypto/CommonDigest.h> |
| 9 #include <nss.h> | 9 #include <nss.h> |
| 10 #include <prtypes.h> | 10 #include <prtypes.h> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 SHA1HashValue sha1; | 93 SHA1HashValue sha1; |
| 94 memset(sha1.data, 0, sizeof(sha1.data)); | 94 memset(sha1.data, 0, sizeof(sha1.data)); |
| 95 CC_SHA1(cert->derCert.data, cert->derCert.len, sha1.data); | 95 CC_SHA1(cert->derCert.data, cert->derCert.len, sha1.data); |
| 96 return sha1; | 96 return sha1; |
| 97 } | 97 } |
| 98 | 98 |
| 99 // NSSCertificate implementation. | 99 // NSSCertificate implementation. |
| 100 | 100 |
| 101 NSSCertificate::NSSCertificate(SecCertificateRef cert_handle) { | 101 NSSCertificate::NSSCertificate(SecCertificateRef cert_handle) { |
| 102 nss_cert_handle_ = CreateNSSCertHandleFromOSHandle(cert_handle); | 102 nss_cert_handle_ = CreateNSSCertHandleFromOSHandle(cert_handle); |
| 103 DLOG_IF(INFO, cert_handle && !nss_cert_handle_) | |
| 104 << "Could not convert SecCertificateRef to CERTCertificate*"; | |
| 105 } | 103 } |
| 106 | 104 |
| 107 NSSCertificate::~NSSCertificate() { | 105 NSSCertificate::~NSSCertificate() { |
| 108 CERT_DestroyCertificate(nss_cert_handle_); | 106 CERT_DestroyCertificate(nss_cert_handle_); |
| 109 } | 107 } |
| 110 | 108 |
| 111 CERTCertificate* NSSCertificate::cert_handle() const { | 109 CERTCertificate* NSSCertificate::cert_handle() const { |
| 112 return nss_cert_handle_; | 110 return nss_cert_handle_; |
| 113 } | 111 } |
| 114 | 112 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 132 CERTCertificate* NSSCertChain::cert_handle() const { | 130 CERTCertificate* NSSCertChain::cert_handle() const { |
| 133 return certs_.empty() ? NULL : certs_.front(); | 131 return certs_.empty() ? NULL : certs_.front(); |
| 134 } | 132 } |
| 135 | 133 |
| 136 const std::vector<CERTCertificate*>& NSSCertChain::cert_chain() const { | 134 const std::vector<CERTCertificate*>& NSSCertChain::cert_chain() const { |
| 137 return certs_; | 135 return certs_; |
| 138 } | 136 } |
| 139 | 137 |
| 140 } // namespace x509_util_ios | 138 } // namespace x509_util_ios |
| 141 } // namespace net | 139 } // namespace net |
| OLD | NEW |