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 #ifndef NET_CERT_X509_UTIL_H_ | 5 #ifndef NET_CERT_X509_UTIL_H_ |
6 #define NET_CERT_X509_UTIL_H_ | 6 #define NET_CERT_X509_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/strings/string_piece.h" | |
11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
12 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
13 | 14 |
15 namespace base { | |
16 class DictionaryValue; | |
17 } | |
18 | |
14 namespace crypto { | 19 namespace crypto { |
15 class ECPrivateKey; | 20 class ECPrivateKey; |
16 class RSAPrivateKey; | 21 class RSAPrivateKey; |
17 } | 22 } |
18 | 23 |
19 namespace net { | 24 namespace net { |
20 | 25 |
21 class X509Certificate; | 26 class X509Certificate; |
22 | 27 |
23 namespace x509_util { | 28 namespace x509_util { |
(...skipping 14 matching lines...) Expand all Loading... | |
38 // See Internet Draft draft-balfanz-tls-obc-00 for more details: | 43 // See Internet Draft draft-balfanz-tls-obc-00 for more details: |
39 // http://tools.ietf.org/html/draft-balfanz-tls-obc-00 | 44 // http://tools.ietf.org/html/draft-balfanz-tls-obc-00 |
40 NET_EXPORT_PRIVATE bool CreateDomainBoundCertEC( | 45 NET_EXPORT_PRIVATE bool CreateDomainBoundCertEC( |
41 crypto::ECPrivateKey* key, | 46 crypto::ECPrivateKey* key, |
42 const std::string& domain, | 47 const std::string& domain, |
43 uint32 serial_number, | 48 uint32 serial_number, |
44 base::Time not_valid_before, | 49 base::Time not_valid_before, |
45 base::Time not_valid_after, | 50 base::Time not_valid_after, |
46 std::string* der_cert); | 51 std::string* der_cert); |
47 | 52 |
53 // Converts a subject public key info from DER to JWK. | |
54 // See http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-13 for | |
55 // the output format. | |
56 NET_EXPORT_PRIVATE bool ConvertSPKIFromDERToJWK( | |
57 base::StringPiece spki, | |
Ryan Sleevi
2013/08/02 23:08:43
"const base::StringPiece&" [Yes, I realize there i
| |
58 base::DictionaryValue* public_key_jwk); | |
59 | |
48 // Create a self-signed certificate containing the public key in |key|. | 60 // Create a self-signed certificate containing the public key in |key|. |
49 // Subject, serial number and validity period are given as parameters. | 61 // Subject, serial number and validity period are given as parameters. |
50 // The certificate is signed by the private key in |key|. The hashing | 62 // The certificate is signed by the private key in |key|. The hashing |
51 // algorithm for the signature is SHA-1. | 63 // algorithm for the signature is SHA-1. |
52 // | 64 // |
53 // |subject| is a distinguished name defined in RFC4514. | 65 // |subject| is a distinguished name defined in RFC4514. |
54 // | 66 // |
55 // An example: | 67 // An example: |
56 // CN=Michael Wong,O=FooBar Corporation,DC=foobar,DC=com | 68 // CN=Michael Wong,O=FooBar Corporation,DC=foobar,DC=com |
57 // | 69 // |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 | 102 |
91 private: | 103 private: |
92 base::Time now_; | 104 base::Time now_; |
93 }; | 105 }; |
94 | 106 |
95 } // namespace x509_util | 107 } // namespace x509_util |
96 | 108 |
97 } // namespace net | 109 } // namespace net |
98 | 110 |
99 #endif // NET_CERT_X509_UTIL_H_ | 111 #endif // NET_CERT_X509_UTIL_H_ |
OLD | NEW |