OLD | NEW |
| (Empty) |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROMEOS_NETWORK_CERTIFICATE_HELPER_H_ | |
6 #define CHROMEOS_NETWORK_CERTIFICATE_HELPER_H_ | |
7 | |
8 #include <cert.h> | |
9 #include <string> | |
10 | |
11 #include "net/cert/cert_type.h" | |
12 #include "net/cert/x509_certificate.h" | |
13 | |
14 namespace chromeos { | |
15 namespace certificate { | |
16 | |
17 // Selected functions from chrome/common/net/x509_certificate_model.cc | |
18 | |
19 // Decodes the certificate type from |cert|. | |
20 net::CertType GetCertType(net::X509Certificate::OSCertHandle cert_handle); | |
21 | |
22 // Extracts the token name from |cert|->slot if it exists or returns an empty | |
23 // string. | |
24 std::string GetCertTokenName(net::X509Certificate::OSCertHandle cert_handle); | |
25 | |
26 // Returns the common name for |cert_handle|->issuer or |alternative_text| if | |
27 // the common name is missing or empty. | |
28 std::string GetIssuerCommonName(net::X509Certificate::OSCertHandle cert_handle, | |
29 const std::string& alternative_text); | |
30 | |
31 // Returns the common name for |cert_handle|->subject converted to unicode, | |
32 // or |cert_handle|->nickname if the subject name is unavailable or empty. | |
33 // NOTE: Unlike x509_certificate_model::GetCertNameOrNickname in src/chrome, | |
34 // the raw unformated name or nickname will not be included in the returned | |
35 // value (see GetCertAsciiNameOrNickname instead). | |
36 std::string GetCertNameOrNickname( | |
37 net::X509Certificate::OSCertHandle cert_handle); | |
38 | |
39 // Returns the unformated ASCII common name for |cert_handle|->subject. | |
40 std::string GetCertAsciiNameOrNickname( | |
41 net::X509Certificate::OSCertHandle cert_handle); | |
42 | |
43 } // namespace certificate | |
44 } // namespace chromeos | |
45 | |
46 #endif // CHROMEOS_NETWORK_CERTIFICATE_HELPER_H_ | |
OLD | NEW |