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/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
6 | 6 |
7 #define PRArenaPool PLArenaPool // Required by <blapi.h>. | 7 #define PRArenaPool PLArenaPool // Required by <blapi.h>. |
8 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. | 8 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 unsigned int result_len; | 1054 unsigned int result_len; |
1055 SHA1_End(sha1_ctx, sha1.data, &result_len, SHA1_LENGTH); | 1055 SHA1_End(sha1_ctx, sha1.data, &result_len, SHA1_LENGTH); |
1056 SHA1_DestroyContext(sha1_ctx, PR_TRUE); | 1056 SHA1_DestroyContext(sha1_ctx, PR_TRUE); |
1057 | 1057 |
1058 return sha1; | 1058 return sha1; |
1059 } | 1059 } |
1060 | 1060 |
1061 // static | 1061 // static |
1062 X509Certificate::OSCertHandle | 1062 X509Certificate::OSCertHandle |
1063 X509Certificate::ReadOSCertHandleFromPickle(const Pickle& pickle, | 1063 X509Certificate::ReadOSCertHandleFromPickle(const Pickle& pickle, |
1064 void** pickle_iter) { | 1064 PickleIterator* pickle_iter) { |
1065 const char* data; | 1065 const char* data; |
1066 int length; | 1066 int length; |
1067 if (!pickle.ReadData(pickle_iter, &data, &length)) | 1067 if (!pickle.ReadData(pickle_iter, &data, &length)) |
1068 return NULL; | 1068 return NULL; |
1069 | 1069 |
1070 OSCertHandle cert_handle = NULL; | 1070 OSCertHandle cert_handle = NULL; |
1071 if (!CertAddSerializedElementToStore( | 1071 if (!CertAddSerializedElementToStore( |
1072 NULL, reinterpret_cast<const BYTE*>(data), length, | 1072 NULL, reinterpret_cast<const BYTE*>(data), length, |
1073 CERT_STORE_ADD_USE_EXISTING, 0, CERT_STORE_CERTIFICATE_CONTEXT_FLAG, | 1073 CERT_STORE_ADD_USE_EXISTING, 0, CERT_STORE_CERTIFICATE_CONTEXT_FLAG, |
1074 NULL, reinterpret_cast<const void **>(&cert_handle))) { | 1074 NULL, reinterpret_cast<const void **>(&cert_handle))) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 *type = kPublicKeyTypeECDH; | 1128 *type = kPublicKeyTypeECDH; |
1129 break; | 1129 break; |
1130 default: | 1130 default: |
1131 *type = kPublicKeyTypeUnknown; | 1131 *type = kPublicKeyTypeUnknown; |
1132 *size_bits = 0; | 1132 *size_bits = 0; |
1133 break; | 1133 break; |
1134 } | 1134 } |
1135 } | 1135 } |
1136 | 1136 |
1137 } // namespace net | 1137 } // namespace net |
OLD | NEW |