Android Chromoting: Remove exit-fullscreen button.
[chromium-blink-merge.git] / chrome / common / net / x509_certificate_model.h
blob1a5d350dd5fe6e87d022a24212dcfd9d84460442
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
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_NET_X509_CERTIFICATE_MODEL_H_
6 #define CHROME_COMMON_NET_X509_CERTIFICATE_MODEL_H_
8 #include "net/cert/cert_type.h"
9 #include "net/cert/x509_certificate.h"
11 // This namespace defines a set of functions to be used in UI-related bits of
12 // X509 certificates. It decouples the UI from the underlying crypto library
13 // (currently NSS or OpenSSL - in development).
14 // This is currently only used by linux, as mac / windows use their own native
15 // certificate viewers and crypto libraries.
16 namespace x509_certificate_model {
18 std::string GetCertNameOrNickname(
19 net::X509Certificate::OSCertHandle cert_handle);
21 std::string GetTokenName(net::X509Certificate::OSCertHandle cert_handle);
23 std::string GetVersion(net::X509Certificate::OSCertHandle cert_handle);
25 net::CertType GetType(net::X509Certificate::OSCertHandle cert_handle);
27 void GetUsageStrings(
28 net::X509Certificate::OSCertHandle cert_handle,
29 std::vector<std::string>* usages);
31 std::string GetSerialNumberHexified(
32 net::X509Certificate::OSCertHandle cert_handle,
33 const std::string& alternative_text);
35 std::string GetIssuerCommonName(
36 net::X509Certificate::OSCertHandle cert_handle,
37 const std::string& alternative_text);
39 std::string GetIssuerOrgName(
40 net::X509Certificate::OSCertHandle cert_handle,
41 const std::string& alternative_text);
43 std::string GetIssuerOrgUnitName(
44 net::X509Certificate::OSCertHandle cert_handle,
45 const std::string& alternative_text);
47 std::string GetSubjectOrgName(
48 net::X509Certificate::OSCertHandle cert_handle,
49 const std::string& alternative_text);
51 std::string GetSubjectOrgUnitName(
52 net::X509Certificate::OSCertHandle cert_handle,
53 const std::string& alternative_text);
55 std::string GetSubjectCommonName(
56 net::X509Certificate::OSCertHandle cert_handle,
57 const std::string& alternative_text);
59 bool GetTimes(net::X509Certificate::OSCertHandle cert_handle,
60 base::Time* issued, base::Time* expires);
62 std::string GetTitle(net::X509Certificate::OSCertHandle cert_handle);
63 std::string GetIssuerName(net::X509Certificate::OSCertHandle cert_handle);
64 std::string GetSubjectName(net::X509Certificate::OSCertHandle cert_handle);
66 struct Extension {
67 std::string name;
68 std::string value;
71 typedef std::vector<Extension> Extensions;
73 void GetExtensions(
74 const std::string& critical_label,
75 const std::string& non_critical_label,
76 net::X509Certificate::OSCertHandle cert_handle,
77 Extensions* extensions);
79 // Hash a certificate using the given algorithm, return the result as a
80 // colon-seperated hex string.
81 std::string HashCertSHA256(net::X509Certificate::OSCertHandle cert_handle);
82 std::string HashCertSHA1(net::X509Certificate::OSCertHandle cert_handle);
84 // For host values, if they contain IDN Punycode-encoded A-labels, this will
85 // return a string suitable for display that contains both the original and the
86 // decoded U-label form. Otherwise, the string will be returned as is.
87 std::string ProcessIDN(const std::string& input);
89 std::string GetCMSString(const net::X509Certificate::OSCertHandles& cert_chain,
90 size_t start, size_t end);
92 std::string ProcessSecAlgorithmSignature(
93 net::X509Certificate::OSCertHandle cert_handle);
94 std::string ProcessSecAlgorithmSubjectPublicKey(
95 net::X509Certificate::OSCertHandle cert_handle);
96 std::string ProcessSecAlgorithmSignatureWrap(
97 net::X509Certificate::OSCertHandle cert_handle);
99 std::string ProcessSubjectPublicKeyInfo(
100 net::X509Certificate::OSCertHandle cert_handle);
102 std::string ProcessRawBitsSignatureWrap(
103 net::X509Certificate::OSCertHandle cert_handle);
105 // Format a buffer as |hex_separator| separated string, with 16 bytes on each
106 // line separated using |line_separator|.
107 std::string ProcessRawBytesWithSeparators(const unsigned char* data,
108 size_t data_length,
109 char hex_separator,
110 char line_separator);
112 // Format a buffer as a space separated string, with 16 bytes on each line.
113 std::string ProcessRawBytes(const unsigned char* data,
114 size_t data_length);
116 #if defined(USE_NSS)
117 // Format a buffer as a space separated string, with 16 bytes on each line.
118 // |data_length| is the length in bits.
119 std::string ProcessRawBits(const unsigned char* data,
120 size_t data_length);
121 #endif // USE_NSS
123 } // namespace x509_certificate_model
125 #endif // CHROME_COMMON_NET_X509_CERTIFICATE_MODEL_H_