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