From 41e2f6d405ba7edca693cb3a1ffa5285a24362a4 Mon Sep 17 00:00:00 2001 From: Neel Goyal Date: Thu, 3 Mar 2016 12:29:48 -0800 Subject: [PATCH] Add service identity to SSL socket and use in ticket cache Summary:Allow applications to specify a service identity tied to an SSLSocket that can be used as a ticket cache key. Further, add the cache key to the SSL_SESSION object and serialize it. Reviewed By: siyengar Differential Revision: D2991005 fb-gh-sync-id: 25a5ddbb66bd9da2084159136cbe4d55b9e00f28 shipit-source-id: 25a5ddbb66bd9da2084159136cbe4d55b9e00f28 --- folly/io/async/AsyncSSLSocket.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/folly/io/async/AsyncSSLSocket.h b/folly/io/async/AsyncSSLSocket.h index 732d486f..6cfd24b6 100644 --- a/folly/io/async/AsyncSSLSocket.h +++ b/folly/io/async/AsyncSSLSocket.h @@ -755,6 +755,12 @@ class AsyncSSLSocket : public virtual AsyncSocket { */ void forceCacheAddrOnFailure(bool force) { cacheAddrOnFailure_ = force; } + const std::string& getServiceIdentity() const { return serviceIdentity_; } + + void setServiceIdentity(std::string serviceIdentity) { + serviceIdentity_ = std::move(serviceIdentity); + } + private: void init(); @@ -866,6 +872,10 @@ class AsyncSSLSocket : public virtual AsyncSocket { std::shared_ptr handshakeCtx_; std::string tlsextHostname_; #endif + + // a service identity that this socket/connection is associated with + std::string serviceIdentity_; + folly::SSLContext::SSLVerifyPeerEnum verifyPeer_{folly::SSLContext::SSLVerifyPeerEnum::USE_CTX}; -- 2.34.1