ϪfdZddlmZddlmZddlmZddlmZddl m Z ee e jdjdjZGd d ej ZGd d Zy )z Helper classes for twisted.test.test_ssl. They are in a separate module so they will not prevent test_ssl importing if pyOpenSSL is unavailable. ) annotations)SSL)ssl) nativeString)FilePathzutf-8s server.pemceZdZdZdZddZy)ClientTLSContextz: SSL Context Factory for client-side connections. cHtjtjS)z Return an L{SSL.Context} to be use for client-side connections. Will not return a cached context. This is done to improve the test coverage as most implementation are caching the context. )rContext SSLv23_METHOD)selfs :/usr/lib/python3/dist-packages/twisted/test/ssl_helpers.py getContextzClientTLSContext.getContexts{{3,,--Nreturnz SSL.Context)__name__ __module__ __qualname____doc__isClientrrrr r sH.rr c4eZdZdZdZedf ddZddZy)ServerTLSContextz: SSL Context Factory for server-side connections. rNcD||_|tj}||_y)N)filenamerr _method)rrmethods r__init__zServerTLSContext.__init__.s"! >&&F rctj|j}|j|j|j |j|S)z Return an L{SSL.Context} to be use for server-side connections. Will not return a cached context. This is done to improve the test coverage as most implementation are caching the context. )rr ruse_certificate_fileruse_privatekey_file)rctxs rrzServerTLSContext.getContext7s?kk$,,'   /  . r)rz str | bytesrz int | NonerNoner)rrrrrcertPathr rrrrrr's7H'/T#8B  rrN)r __future__rOpenSSLrtwisted.internetrtwisted.python.compatrtwisted.python.filepathr__file__encodesiblingpathr&ClientContextFactoryr rrrrr1s` # ., !9:BB=QVV W.s//.$r