Chromium Code Reviews| 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); | |
| 21 | |
| 22 // Extracts the token name from |cert|->slot if it exists or returns an empty | |
| 23 // string. | |
| 24 std::string GetCertTokenName(CERTCertificate* cert); | |
|
pmarko
2017/05/11 12:32:46
This is the only one taking CERTCertificate* inste
stevenjb
2017/05/12 19:27:50
That's a good catch. I copied this one from nsNSSC
mattm
2017/05/12 22:27:54
Just fyi, in the future OSCertHandle will not be a
| |
| 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 it is unavailable or empty. | |
|
tbarzic
2017/05/11 19:48:31
nit: s/it/the subject name/
stevenjb
2017/05/12 19:27:50
Done.
| |
| 33 // NOTE: Unlike x509_certificate_model::GetCertNameOrNickname in src/chrome, | |
| 34 // this does not include the raw unformatted version. | |
|
tbarzic
2017/05/11 19:48:31
wdyt about:
Unlike x509_certificate_model::GetCert
stevenjb
2017/05/12 19:27:50
Done.
| |
| 35 std::string GetCertNameOrNickname( | |
| 36 net::X509Certificate::OSCertHandle cert_handle); | |
| 37 | |
| 38 // Returns the unformated ASCII common name for |cert_handle|->subject. | |
| 39 std::string GetCertAsciiNameOrNickname( | |
| 40 net::X509Certificate::OSCertHandle cert_handle); | |
| 41 | |
| 42 } // namespace certificate | |
| 43 } // namespace chromeos | |
| 44 | |
| 45 #endif // CHROMEOS_NETWORK_CERTIFICATE_HELPER_H_ | |
| OLD | NEW |