diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-19  Vladimir Shabanov  <dev@vshabanov.com>
+
+	* HsOpenSSL.cabal (Version): Bump version to 0.11.6
+
+	* Added Session.contextSetSessionIdContext
+	by Francesco Gazzetta @fgaz (#56)
+
 2020-11-06  Vladimir Shabanov  <dev@vshabanov.com>
 
 	* HsOpenSSL.cabal (Version): Bump version to 0.11.5.1
diff --git a/HsOpenSSL.cabal b/HsOpenSSL.cabal
--- a/HsOpenSSL.cabal
+++ b/HsOpenSSL.cabal
@@ -10,7 +10,7 @@
     systems and stable. You may also be interested in the @tls@ package,
     <http://hackage.haskell.org/package/tls>, which is a pure Haskell
     implementation of SSL.
-Version:       0.11.5.1
+Version:       0.11.6
 License:       PublicDomain
 License-File:  COPYING
 Author:        Adam Langley, Mikhail Vorozhtsov, PHO, Taru Karttunen
diff --git a/OpenSSL/Session.hsc b/OpenSSL/Session.hsc
--- a/OpenSSL/Session.hsc
+++ b/OpenSSL/Session.hsc
@@ -29,6 +29,7 @@
   , contextSetCAFile
   , contextSetCADirectory
   , contextGetCAStore
+  , contextSetSessionIdContext
 
     -- * SSL connections
   , SSL
@@ -338,6 +339,19 @@
     = withContext context $ \ ctx ->
       _ssl_get_cert_store ctx
            >>= wrapX509Store (touchContext context)
+
+foreign import ccall unsafe "SSL_CTX_set_session_id_context"
+  _ssl_set_session_id_context :: Ptr SSLContext_ -> Ptr CChar -> CSize -> IO CInt
+
+-- | Set context within which session can be reused (server side only).
+--
+-- If client certificates are used and the session id context is not set,
+-- attempts by the clients to reuse a session will make the handshake fail.
+contextSetSessionIdContext :: SSLContext -> B.ByteString -> IO ()
+contextSetSessionIdContext context idCtx =
+  withContext context $ \ctx ->
+    B.unsafeUseAsCStringLen idCtx $ \(cIdCtx, len) ->
+        _ssl_set_session_id_context ctx cIdCtx (fromIntegral len) >>= failIf_ (/= 1)
 
 
 data SSL_
