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/time.h" | 11 #include "base/time/time.h" |
12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
13 #include "net/cert/x509_certificate.h" | 13 #include "net/cert/x509_certificate.h" |
14 | 14 |
15 class PickleIterator; | 15 class PickleIterator; |
16 | 16 |
17 typedef struct CERTCertificateStr CERTCertificate; | 17 typedef struct CERTCertificateStr CERTCertificate; |
18 typedef struct CERTNameStr CERTName; | 18 typedef struct CERTNameStr CERTName; |
19 typedef struct PK11SlotInfoStr PK11SlotInfo; | 19 typedef struct PK11SlotInfoStr PK11SlotInfo; |
20 typedef struct PLArenaPool PLArenaPool; | 20 typedef struct PLArenaPool PLArenaPool; |
21 typedef struct SECItemStr SECItem; | 21 typedef struct SECItemStr SECItem; |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 namespace x509_util { | 25 namespace x509_util { |
26 | 26 |
27 #if defined(USE_NSS) || defined(OS_IOS) | 27 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
28 // Parses the Principal attribute from |name| and outputs the result in | 28 // Parses the Principal attribute from |name| and outputs the result in |
29 // |principal|. | 29 // |principal|. |
30 void ParsePrincipal(CERTName* name, | 30 void ParsePrincipal(CERTName* name, |
31 CertPrincipal* principal); | 31 CertPrincipal* principal); |
32 | 32 |
33 // Parses the date from |der_date| and outputs the result in |result|. | 33 // Parses the date from |der_date| and outputs the result in |result|. |
34 void ParseDate(const SECItem* der_date, base::Time* result); | 34 void ParseDate(const SECItem* der_date, base::Time* result); |
35 | 35 |
36 // Parses the serial number from |certificate|. | 36 // Parses the serial number from |certificate|. |
37 std::string ParseSerialNumber(const CERTCertificate* certificate); | 37 std::string ParseSerialNumber(const CERTCertificate* certificate); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Generates a unique nickname for |slot|, returning |nickname| if it is | 83 // Generates a unique nickname for |slot|, returning |nickname| if it is |
84 // already unique. | 84 // already unique. |
85 // | 85 // |
86 // Note: The nickname returned will NOT include the token name, thus the | 86 // Note: The nickname returned will NOT include the token name, thus the |
87 // token name must be prepended if calling an NSS function that expects | 87 // token name must be prepended if calling an NSS function that expects |
88 // <token>:<nickname>. | 88 // <token>:<nickname>. |
89 // TODO(gspencer): Internationalize this: it's wrong to hard-code English. | 89 // TODO(gspencer): Internationalize this: it's wrong to hard-code English. |
90 std::string GetUniqueNicknameForSlot(const std::string& nickname, | 90 std::string GetUniqueNicknameForSlot(const std::string& nickname, |
91 const SECItem* subject, | 91 const SECItem* subject, |
92 PK11SlotInfo* slot); | 92 PK11SlotInfo* slot); |
93 #endif // defined(USE_NSS) || defined(OS_IOS) | 93 #endif // defined(USE_NSS_CERTS) || defined(OS_IOS) |
94 | 94 |
95 } // namespace x509_util | 95 } // namespace x509_util |
96 | 96 |
97 } // namespace net | 97 } // namespace net |
98 | 98 |
99 #endif // NET_CERT_X509_UTIL_NSS_H_ | 99 #endif // NET_CERT_X509_UTIL_NSS_H_ |
OLD | NEW |