You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

backports.ssl

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backports.ssl

The Python 3.4 standard `ssl` module API implemented on top of pyOpenSSL


Maintainers
1

Readme


backports.ssl

What is it?

It's the Python 3.4 standard ssl module API implemented on top of pyOpenSSL::

import backports.ssl as ssl
import socket

context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.verify_mode = ssl.CERT_REQUIRED

conn = context.wrap_socket(socket.socket(socket.AF_INET))
conn.connect(('google.com', 443))
print conn.getpeercert()
conn.close()

Why?

Because the latest web technologies should be available to those running older versions of Python.

Isn't this obsoleted by PEP 466_?

If you're on Python 2.7, then probably. But PEP 466 doesn't cover Python 2.6, 3.2, or 3.3, and the ssl.RAND_*() functions are explicitly out of scope. This package supports it all.

How do I use it with third-party libraries?

Monkey-patching support is included a la gevent_::

import backports.ssl.monkey as monkey
import requests

monkey.patch()
requests.get('https://google.com')

Why am I getting AttributeError\ s for newer features?

Like the standard ssl module, certain attributes will not be available if your OpenSSL does not support them. See Installing OpenSSL_ for instructions.

Installing OpenSSL

TODO

  • Verify that we play nicely with gevent's monkey-patching.
  • Backport and pass the standard Python ssl test suite.
  • If not that, automate testing against hyper, urllib3, requests, and Tornado test suites.
  • Use the bundled 3.x OpenSSL, if available and newer than the default.

.. _PEP 466: http://legacy.python.org/dev/peps/pep-0466 .. _gevent: http://gevent.org

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc