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 "net/base/x509_util.h" | 5 #include "net/base/x509_util.h" |
6 #include "net/base/x509_util_openssl.h" | 6 #include "net/base/x509_util_openssl.h" |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
12 #include "net/base/x509_cert_types.h" | 12 #include "net/base/x509_cert_types.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 namespace x509_util { | 16 namespace x509_util { |
17 | 17 |
18 bool CreateOriginBoundCertRSA( | 18 bool CreateOriginBoundCert( |
19 crypto::RSAPrivateKey* key, | 19 crypto::RSAPrivateKey* key, |
20 const std::string& origin, | 20 const std::string& origin, |
21 uint32 serial_number, | 21 uint32 serial_number, |
22 base::TimeDelta valid_duration, | 22 base::TimeDelta valid_duration, |
23 std::string* der_cert) { | 23 std::string* der_cert) { |
24 NOTIMPLEMENTED(); | 24 NOTIMPLEMENTED(); |
25 return false; | 25 return false; |
26 } | 26 } |
27 | 27 |
28 bool CreateOriginBoundCertEC( | |
29 crypto::ECPrivateKey* key, | |
30 const std::string& origin, | |
31 uint32 serial_number, | |
32 base::TimeDelta valid_duration, | |
33 std::string* der_cert) { | |
34 NOTIMPLEMENTED(); | |
35 return false; | |
36 } | |
37 | |
38 bool ParsePrincipalKeyAndValueByIndex(X509_NAME* name, | 28 bool ParsePrincipalKeyAndValueByIndex(X509_NAME* name, |
39 int index, | 29 int index, |
40 std::string* key, | 30 std::string* key, |
41 std::string* value) { | 31 std::string* value) { |
42 X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, index); | 32 X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, index); |
43 if (!entry) | 33 if (!entry) |
44 return false; | 34 return false; |
45 | 35 |
46 if (key) { | 36 if (key) { |
47 ASN1_OBJECT* object = X509_NAME_ENTRY_get_object(entry); | 37 ASN1_OBJECT* object = X509_NAME_ENTRY_get_object(entry); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 x509_time->length); | 76 x509_time->length); |
87 | 77 |
88 CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ? | 78 CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ? |
89 CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME; | 79 CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME; |
90 return ParseCertificateDate(str_date, format, time); | 80 return ParseCertificateDate(str_date, format, time); |
91 } | 81 } |
92 | 82 |
93 } // namespace x509_util | 83 } // namespace x509_util |
94 | 84 |
95 } // namespace net | 85 } // namespace net |
OLD | NEW |