AsyncSSLSocket::getSSLClientCiphers using static map
[folly.git] / folly / io / async / ssl / OpenSSLUtils.h
index 8f5ea87ae28622f2e6d6a01f53d590a61f9fbcd9..199ecfdf8b10b9efd42b101171beb77ff2db49e4 100644 (file)
@@ -81,6 +81,16 @@ class OpenSSLUtils {
                                              sockaddr_storage* addrStorage,
                                              socklen_t* addrLen);
 
+  /**
+   * Get a stringified cipher name (e.g., ECDHE-ECDSA-CHACHA20-POLY1305) given
+   * the 2-byte code (e.g., 0xcca9) for the cipher. The name conversion only
+   * works for the ciphers built into the linked OpenSSL library
+   *
+   * @param cipherCode      A 16-bit IANA cipher code (machine endianness)
+   * @return Cipher name, or empty if the code is not found
+   */
+  static const std::string& getCipherName(uint16_t cipherCode);
+
   /**
   * Wrappers for BIO operations that may be different across different
   * versions/flavors of OpenSSL (including forks like BoringSSL)