| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Creates an NSS certificate handle from |data|, which is |length| bytes in | 24 // Creates an NSS certificate handle from |data|, which is |length| bytes in |
| 25 // size. | 25 // size. |
| 26 CERTCertificate* CreateNSSCertHandleFromBytes(const char* data, | 26 CERTCertificate* CreateNSSCertHandleFromBytes(const char* data, |
| 27 int length) { | 27 int length) { |
| 28 if (length < 0) | 28 if (length < 0) |
| 29 return NULL; | 29 return NULL; |
| 30 | 30 |
| 31 LOG(ERROR) << "HIIIIIIIIIIIIIIIIIIIIIIIIIII"; |
| 31 crypto::EnsureNSSInit(); | 32 crypto::EnsureNSSInit(); |
| 32 | 33 |
| 33 if (!NSS_IsInitialized()) | 34 if (!NSS_IsInitialized()) |
| 34 return NULL; | 35 return NULL; |
| 35 | 36 |
| 36 SECItem der_cert; | 37 SECItem der_cert; |
| 37 der_cert.data = reinterpret_cast<unsigned char*>(const_cast<char*>(data)); | 38 der_cert.data = reinterpret_cast<unsigned char*>(const_cast<char*>(data)); |
| 38 der_cert.len = length; | 39 der_cert.len = length; |
| 39 der_cert.type = siDERCertBuffer; | 40 der_cert.type = siDERCertBuffer; |
| 40 | 41 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 CERTCertificate* NSSCertChain::cert_handle() const { | 133 CERTCertificate* NSSCertChain::cert_handle() const { |
| 133 return certs_.empty() ? NULL : certs_.front(); | 134 return certs_.empty() ? NULL : certs_.front(); |
| 134 } | 135 } |
| 135 | 136 |
| 136 const std::vector<CERTCertificate*>& NSSCertChain::cert_chain() const { | 137 const std::vector<CERTCertificate*>& NSSCertChain::cert_chain() const { |
| 137 return certs_; | 138 return certs_; |
| 138 } | 139 } |
| 139 | 140 |
| 140 } // namespace x509_util_ios | 141 } // namespace x509_util_ios |
| 141 } // namespace net | 142 } // namespace net |
| OLD | NEW |