File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -851,6 +851,12 @@ def unwrap(self):
851851 else :
852852 raise ValueError ("No SSL wrapper around " + str (self ))
853853
854+ def verify_client_post_handshake (self ):
855+ if self ._sslobj :
856+ return self ._sslobj .verify_client_post_handshake ()
857+ else :
858+ raise ValueError ("No SSL wrapper around " + str (self ))
859+
854860 def _real_close (self ):
855861 self ._sslobj = None
856862 socket ._real_close (self )
@@ -952,7 +958,6 @@ def version(self):
952958 return None
953959 return self ._sslobj .version ()
954960
955-
956961def wrap_socket (sock , keyfile = None , certfile = None ,
957962 server_side = False , cert_reqs = CERT_NONE ,
958963 ssl_version = PROTOCOL_TLS , ca_certs = None ,
Original file line number Diff line number Diff line change @@ -4610,3 +4610,27 @@ init_ssl(void)
46104610 if (r == NULL || PyModule_AddObject (m , "_OPENSSL_API_VERSION" , r ))
46114611 return ;
46124612}
4613+
4614+ /*[clinic input]
4615+ _ssl._SSLSocket.verify_client_post_handshake
4616+
4617+ Initiate TLS 1.3 post-handshake authentication
4618+ [clinic start generated code]*/
4619+
4620+ static PyObject *
4621+ _ssl__SSLSocket_verify_client_post_handshake_impl (PySSLSocket * self )
4622+ /*[clinic end generated code: output=532147f3b1341425 input=6bfa874810a3d889]*/
4623+ {
4624+ #ifdef TLS1_3_VERSION
4625+ int err = SSL_verify_client_post_handshake (self -> ssl );
4626+ if (err == 0 )
4627+ return _setSSLError (NULL , 0 , __FILE__ , __LINE__ );
4628+ else
4629+ Py_RETURN_NONE ;
4630+ #else
4631+ PyErr_SetString (PyExc_NotImplementedError ,
4632+ "Post-handshake auth is not supported by your "
4633+ "OpenSSL version." );
4634+ return NULL ;
4635+ #endif
4636+ }
You can’t perform that action at this time.
0 commit comments