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 #ifndef NET_CERT_X509_UTIL_NSS_H_ | 5 #ifndef NET_CERT_X509_UTIL_NSS_H_ |
6 #define NET_CERT_X509_UTIL_NSS_H_ | 6 #define NET_CERT_X509_UTIL_NSS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "net/cert/x509_certificate.h" | 12 #include "net/cert/x509_certificate.h" |
wtc
2013/04/27 17:24:30
Nit: it would be good to include "net/base/net_exp
dkrahn
2013/04/29 21:34:56
Done.
| |
13 | 13 |
14 class PickleIterator; | 14 class PickleIterator; |
15 | 15 |
16 typedef struct CERTCertificateStr CERTCertificate; | 16 typedef struct CERTCertificateStr CERTCertificate; |
17 typedef struct CERTNameStr CERTName; | 17 typedef struct CERTNameStr CERTName; |
18 typedef struct PLArenaPool PLArenaPool; | 18 typedef struct PLArenaPool PLArenaPool; |
19 typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey; | 19 typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey; |
20 typedef struct SECItemStr SECItem; | 20 typedef struct SECItemStr SECItem; |
21 typedef struct SECKEYPublicKeyStr SECKEYPublicKey; | 21 typedef struct SECKEYPublicKeyStr SECKEYPublicKey; |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 namespace x509_util { | 25 namespace x509_util { |
26 | 26 |
27 // Creates a self-signed certificate containing |public_key|. Subject, serial | 27 // Creates a self-signed certificate containing |public_key|. Subject, serial |
28 // number and validity period are given as parameters. The certificate is | 28 // number and validity period are given as parameters. The certificate is |
29 // signed by |private_key|. The hashing algorithm for the signature is SHA-1. | 29 // signed by |private_key|. The hashing algorithm for the signature is SHA-1. |
30 // |subject| is a distinguished name defined in RFC4514. | 30 // |subject| is a distinguished name defined in RFC4514. |
31 CERTCertificate* CreateSelfSignedCert( | 31 NET_EXPORT_PRIVATE CERTCertificate* CreateSelfSignedCert( |
32 SECKEYPublicKey* public_key, | 32 SECKEYPublicKey* public_key, |
33 SECKEYPrivateKey* private_key, | 33 SECKEYPrivateKey* private_key, |
34 const std::string& subject, | 34 const std::string& subject, |
35 uint32 serial_number, | 35 uint32 serial_number, |
36 base::Time not_valid_before, | 36 base::Time not_valid_before, |
37 base::Time not_valid_after); | 37 base::Time not_valid_after); |
38 | 38 |
39 #if defined(USE_NSS) || defined(OS_IOS) | 39 #if defined(USE_NSS) || defined(OS_IOS) |
40 // Parses the Principal attribute from |name| and outputs the result in | 40 // Parses the Principal attribute from |name| and outputs the result in |
41 // |principal|. | 41 // |principal|. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 bool IsCertificateIssuedBy(const std::vector<CERTCertificate*>& cert_chain, | 92 bool IsCertificateIssuedBy(const std::vector<CERTCertificate*>& cert_chain, |
93 const std::vector<CERTName*>& valid_issuers); | 93 const std::vector<CERTName*>& valid_issuers); |
94 | 94 |
95 #endif // defined(USE_NSS) || defined(OS_IOS) | 95 #endif // defined(USE_NSS) || defined(OS_IOS) |
96 | 96 |
97 } // namespace x509_util | 97 } // namespace x509_util |
98 | 98 |
99 } // namespace net | 99 } // namespace net |
100 | 100 |
101 #endif // NET_CERT_X509_UTIL_NSS_H_ | 101 #endif // NET_CERT_X509_UTIL_NSS_H_ |
OLD | NEW |