OLD | NEW |
1 // Copyright (c) 2010 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 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 std::string HashCertSHA1(net::X509Certificate::OSCertHandle cert_handle) { | 195 std::string HashCertSHA1(net::X509Certificate::OSCertHandle cert_handle) { |
196 unsigned char sha1_data[SHA_DIGEST_LENGTH] = {0}; | 196 unsigned char sha1_data[SHA_DIGEST_LENGTH] = {0}; |
197 unsigned int sha1_size = sizeof(sha1_data); | 197 unsigned int sha1_size = sizeof(sha1_data); |
198 int ret = X509_digest(cert_handle, EVP_sha1(), sha1_data, &sha1_size); | 198 int ret = X509_digest(cert_handle, EVP_sha1(), sha1_data, &sha1_size); |
199 CHECK(ret); | 199 CHECK(ret); |
200 CHECK_EQ(sha1_size, sizeof(sha1_data)); | 200 CHECK_EQ(sha1_size, sizeof(sha1_data)); |
201 return ProcessRawBytes(sha1_data, sha1_size); | 201 return ProcessRawBytes(sha1_data, sha1_size); |
202 } | 202 } |
203 | 203 |
204 void GetCertChainFromCert(net::X509Certificate::OSCertHandle cert_handle, | |
205 net::X509Certificate::OSCertHandles* cert_handles) { | |
206 // TODO(bulach): how to get the chain out of a certificate? | |
207 cert_handles->push_back(net::X509Certificate::DupOSCertHandle(cert_handle)); | |
208 } | |
209 | |
210 void DestroyCertChain(net::X509Certificate::OSCertHandles* cert_handles) { | |
211 for (net::X509Certificate::OSCertHandles::iterator i = cert_handles->begin(); | |
212 i != cert_handles->end(); ++i) | |
213 X509_free(*i); | |
214 cert_handles->clear(); | |
215 } | |
216 | |
217 std::string GetDerString(net::X509Certificate::OSCertHandle cert_handle) { | 204 std::string GetDerString(net::X509Certificate::OSCertHandle cert_handle) { |
218 // TODO(bulach): implement me. | 205 // TODO(bulach): implement me. |
219 return ""; | 206 return ""; |
220 } | 207 } |
221 | 208 |
222 std::string GetCMSString(const net::X509Certificate::OSCertHandles& cert_chain, | 209 std::string GetCMSString(const net::X509Certificate::OSCertHandles& cert_chain, |
223 size_t start, size_t end) { | 210 size_t start, size_t end) { |
224 // TODO(bulach): implement me. | 211 // TODO(bulach): implement me. |
225 return ""; | 212 return ""; |
226 } | 213 } |
(...skipping 25 matching lines...) Expand all Loading... |
252 std::string ProcessRawBitsSignatureWrap( | 239 std::string ProcessRawBitsSignatureWrap( |
253 net::X509Certificate::OSCertHandle cert_handle) { | 240 net::X509Certificate::OSCertHandle cert_handle) { |
254 // TODO(bulach): implement me. | 241 // TODO(bulach): implement me. |
255 return ""; | 242 return ""; |
256 } | 243 } |
257 | 244 |
258 void RegisterDynamicOids() { | 245 void RegisterDynamicOids() { |
259 } | 246 } |
260 | 247 |
261 } // namespace x509_certificate_model | 248 } // namespace x509_certificate_model |
OLD | NEW |