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