OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/net/x509_certificate_model.h" | 5 #include "chrome/common/net/x509_certificate_model.h" |
6 | 6 |
7 #include <openssl/obj_mac.h> | 7 #include <openssl/obj_mac.h> |
8 #include <openssl/sha.h> | 8 #include <openssl/sha.h> |
9 #include <openssl/x509v3.h> | 9 #include <openssl/x509v3.h> |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 const std::string& non_critical_label, | 190 const std::string& non_critical_label, |
191 net::X509Certificate::OSCertHandle cert_handle, | 191 net::X509Certificate::OSCertHandle cert_handle, |
192 Extensions* extensions) { | 192 Extensions* extensions) { |
193 // TODO(bulach): implement me. | 193 // TODO(bulach): implement me. |
194 } | 194 } |
195 | 195 |
196 std::string HashCertSHA256(net::X509Certificate::OSCertHandle cert_handle) { | 196 std::string HashCertSHA256(net::X509Certificate::OSCertHandle cert_handle) { |
197 unsigned char sha256_data[SHA256_DIGEST_LENGTH] = {0}; | 197 unsigned char sha256_data[SHA256_DIGEST_LENGTH] = {0}; |
198 unsigned int sha256_size = sizeof(sha256_data); | 198 unsigned int sha256_size = sizeof(sha256_data); |
199 int ret = X509_digest(cert_handle, EVP_sha256(), sha256_data, &sha256_size); | 199 int ret = X509_digest(cert_handle, EVP_sha256(), sha256_data, &sha256_size); |
200 CHECK(ret); | 200 DCHECK(ret); |
201 CHECK_EQ(sha256_size, sizeof(sha256_data)); | 201 DCHECK_EQ(sha256_size, sizeof(sha256_data)); |
202 return ProcessRawBytes(sha256_data, sha256_size); | 202 return ProcessRawBytes(sha256_data, sha256_size); |
203 } | 203 } |
204 | 204 |
205 std::string HashCertSHA1(net::X509Certificate::OSCertHandle cert_handle) { | 205 std::string HashCertSHA1(net::X509Certificate::OSCertHandle cert_handle) { |
206 unsigned char sha1_data[SHA_DIGEST_LENGTH] = {0}; | 206 unsigned char sha1_data[SHA_DIGEST_LENGTH] = {0}; |
207 unsigned int sha1_size = sizeof(sha1_data); | 207 unsigned int sha1_size = sizeof(sha1_data); |
208 int ret = X509_digest(cert_handle, EVP_sha1(), sha1_data, &sha1_size); | 208 int ret = X509_digest(cert_handle, EVP_sha1(), sha1_data, &sha1_size); |
209 CHECK(ret); | 209 DCHECK(ret); |
210 CHECK_EQ(sha1_size, sizeof(sha1_data)); | 210 DCHECK_EQ(sha1_size, sizeof(sha1_data)); |
211 return ProcessRawBytes(sha1_data, sha1_size); | 211 return ProcessRawBytes(sha1_data, sha1_size); |
212 } | 212 } |
213 | 213 |
214 void GetCertChainFromCert(net::X509Certificate::OSCertHandle cert_handle, | 214 void GetCertChainFromCert(net::X509Certificate::OSCertHandle cert_handle, |
215 net::X509Certificate::OSCertHandles* cert_handles) { | 215 net::X509Certificate::OSCertHandles* cert_handles) { |
216 // TODO(bulach): how to get the chain out of a certificate? | 216 // TODO(bulach): how to get the chain out of a certificate? |
217 cert_handles->push_back(net::X509Certificate::DupOSCertHandle(cert_handle)); | 217 cert_handles->push_back(net::X509Certificate::DupOSCertHandle(cert_handle)); |
218 } | 218 } |
219 | 219 |
220 void DestroyCertChain(net::X509Certificate::OSCertHandles* cert_handles) { | 220 void DestroyCertChain(net::X509Certificate::OSCertHandles* cert_handles) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 std::string ProcessRawBitsSignatureWrap( | 262 std::string ProcessRawBitsSignatureWrap( |
263 net::X509Certificate::OSCertHandle cert_handle) { | 263 net::X509Certificate::OSCertHandle cert_handle) { |
264 // TODO(bulach): implement me. | 264 // TODO(bulach): implement me. |
265 return ""; | 265 return ""; |
266 } | 266 } |
267 | 267 |
268 void RegisterDynamicOids() { | 268 void RegisterDynamicOids() { |
269 } | 269 } |
270 | 270 |
271 } // namespace x509_certificate_model | 271 } // namespace x509_certificate_model |
OLD | NEW |