Metadata-Version: 2.4
Name: tornado_m2crypto
Version: 0.1.4
Summary: Extension for running tornado with M2Crypto instead of the standard python SSL module
Home-page: https://github.com/DIRACGrid/tornado_m2crypto
Project-URL: Bug Reports, https://github.com/DIRACGrid/tornado_m2crypto/issues
Project-URL: Source, https://github.com/DIRACGrid/tornado_m2crypto/
Keywords: dirac
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Requires-Python: >=2.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: enum34; python_version < "3.4"
Requires-Dist: m2crypto
Requires-Dist: tornado
Provides-Extra: testing
Requires-Dist: requests; extra == "testing"
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# tornado_m2crypto

This extension is meant to run tornado with M2Crypto instead of the standard python SSL

# Dependencies

Of course, you need M2Crypto
You need a patched version of Tornado: git+https://github.com/DIRACGrid/tornado.git@iostreamConfigurable


# How to use


The tornado_m2crypto/tests directory contains several examples.
Basically, just take any normal https server with tornado you want, and add the following at the beginning


```
# Patching
# needed because some direct calls to ssl_wrap_socket in TCPServer
from tornado_m2crypto.m2netutil import m2_wrap_socket
import tornado.netutil
tornado.netutil.ssl_wrap_socket = m2_wrap_socket


# Dynamically configurable
import tornado.iostream
tornado.iostream.SSLIOStream.configure('tornado_m2crypto.m2iostream.M2IOStream')


import tornado.httputil
tornado.httputil.HTTPServerRequest.configure('tornado_m2crypto.m2httputil.M2HTTPServerRequest')

```





# How to test

There are several types of tests.

## Unit test

Almost a copy paste of the SSLIOStream tests from tornado:

`tox -r`

## HTTPS test

A simple HTTPS server

`tox -r -e m2io_https`

You can then talk to you using (only requires `requests` package)

`python test_client.py`


## DIRAC test

An HTTPS server converting the certificate to "DIRAC certificates"

`tox -r -e m2io_dirac`

You can talk to it the same way as the normal HTTPS test, and you can give it a proxy
