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_BASE_SSL_CIPHER_SUITE_NAMES_H_ | 5 #ifndef NET_BASE_SSL_CIPHER_SUITE_NAMES_H_ |
6 #define NET_BASE_SSL_CIPHER_SUITE_NAMES_H_ | 6 #define NET_BASE_SSL_CIPHER_SUITE_NAMES_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "net/base/net_api.h" | 12 #include "net/base/net_export.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 // SSLCipherSuiteToStrings returns three strings for a given cipher suite | 16 // SSLCipherSuiteToStrings returns three strings for a given cipher suite |
17 // number, the name of the key exchange algorithm, the name of the cipher and | 17 // number, the name of the key exchange algorithm, the name of the cipher and |
18 // the name of the MAC. The cipher suite number is the number as sent on the | 18 // the name of the MAC. The cipher suite number is the number as sent on the |
19 // wire and recorded at | 19 // wire and recorded at |
20 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml | 20 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml |
21 // If the cipher suite is unknown, the strings are set to "???". | 21 // If the cipher suite is unknown, the strings are set to "???". |
22 NET_API void SSLCipherSuiteToStrings(const char** key_exchange_str, | 22 NET_EXPORT void SSLCipherSuiteToStrings(const char** key_exchange_str, |
23 const char** cipher_str, | 23 const char** cipher_str, |
24 const char** mac_str, | 24 const char** mac_str, |
25 uint16 cipher_suite); | 25 uint16 cipher_suite); |
26 | 26 |
27 // SSLCompressionToString returns the name of the compression algorithm | 27 // SSLCompressionToString returns the name of the compression algorithm |
28 // specified by |compression_method|, which is the TLS compression id. | 28 // specified by |compression_method|, which is the TLS compression id. |
29 // If the algorithm is unknown, |name| is set to "???". | 29 // If the algorithm is unknown, |name| is set to "???". |
30 NET_API void SSLCompressionToString(const char** name, | 30 NET_EXPORT void SSLCompressionToString(const char** name, |
31 uint8 compression_method); | 31 uint8 compression_method); |
32 | 32 |
33 // SSLVersionToString returns the name of the SSL protocol version | 33 // SSLVersionToString returns the name of the SSL protocol version |
34 // specified by |ssl_version|, which is defined in | 34 // specified by |ssl_version|, which is defined in |
35 // net/base/ssl_connection_status_flags.h. | 35 // net/base/ssl_connection_status_flags.h. |
36 // If the version is unknown, |name| is set to "???". | 36 // If the version is unknown, |name| is set to "???". |
37 NET_API void SSLVersionToString(const char** name, int ssl_version); | 37 NET_EXPORT void SSLVersionToString(const char** name, int ssl_version); |
38 | 38 |
39 // Parses a string literal that represents a SSL/TLS cipher suite. | 39 // Parses a string literal that represents a SSL/TLS cipher suite. |
40 // | 40 // |
41 // Supported literal forms: | 41 // Supported literal forms: |
42 // 0xAABB, where AA is cipher_suite[0] and BB is cipher_suite[1], as | 42 // 0xAABB, where AA is cipher_suite[0] and BB is cipher_suite[1], as |
43 // defined in RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher | 43 // defined in RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher |
44 // suites in this form will not return an error. | 44 // suites in this form will not return an error. |
45 // | 45 // |
46 // Returns true if the cipher suite was successfully parsed, storing the | 46 // Returns true if the cipher suite was successfully parsed, storing the |
47 // result in |cipher_suite|. | 47 // result in |cipher_suite|. |
48 // | 48 // |
49 // TODO(rsleevi): Support the full strings defined in the IANA TLS parameters | 49 // TODO(rsleevi): Support the full strings defined in the IANA TLS parameters |
50 // list. | 50 // list. |
51 NET_API bool ParseSSLCipherString(const std::string& cipher_string, | 51 NET_EXPORT bool ParseSSLCipherString(const std::string& cipher_string, |
52 uint16* cipher_suite); | 52 uint16* cipher_suite); |
53 | 53 |
54 } // namespace net | 54 } // namespace net |
55 | 55 |
56 #endif // NET_BASE_SSL_CIPHER_SUITE_NAMES_H_ | 56 #endif // NET_BASE_SSL_CIPHER_SUITE_NAMES_H_ |
OLD | NEW |