Skip to main content

Extension for running tornado with M2Crypto instead of the standard python SSL module

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tornado_m2crypto-0.1.3.tar.gz (77.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tornado_m2crypto-0.1.3-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

Details for the file tornado_m2crypto-0.1.3.tar.gz.

File metadata

  • Download URL: tornado_m2crypto-0.1.3.tar.gz
  • Upload date:
  • Size: 77.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for tornado_m2crypto-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9c30ce25031ffe438b95f541cb9d50d5858db5d9e519d8e4e67b42f32416c260
MD5 2fe42138bf90b935d07439ff9280f41b
BLAKE2b-256 7bc82df585e8a3cef32fdd29ef5c7c4d9af537ba6278e9b9a4b9043db2f1b26c

See more details on using hashes here.

File details

Details for the file tornado_m2crypto-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for tornado_m2crypto-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d3623676a60b1dbd731df59ac686e9cbb75b8524af865a400995586a397115
MD5 4229bd580cf63f48651d43c3abe57fdb
BLAKE2b-256 e8ea7e01db60f798289db0fd77573d4400e1b0dbec3a35243d751aa12bf80afd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page