Skip to content

Commit

Permalink
Merge pull request #1 from omerbenamram/add-client-side-certificates-…
Browse files Browse the repository at this point in the history
…documentation

Add client side certificates verification example to docs
  • Loading branch information
omerbenamram authored Apr 27, 2017
2 parents 480cffa + 1988023 commit 6d1f419
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,17 @@ pass it into the connector::
session = aiohttp.ClientSession(connector=conn)
r = await session.get('https://example.com')

If you need to verify **client-side** certificates, you can do the same thing as the previous example,
but add another call to ``load_cret_chain`` with the key pair::

sslcontext = ssl.create_default_context(
cafile='/path/to/client-side-ca-bundle.crt')
sslcontext.load_cert_chain('/path/to/client/public/key.pem', '/path/to/client/private/key.pem')
conn = aiohttp.TCPConnector(ssl_context=sslcontext)
session = aiohttp.ClientSession(connector=conn)
r = await session.get('https://server-with-client-side-certificates-validaction.com')


You may also verify certificates via MD5, SHA1, or SHA256 fingerprint::

# Attempt to connect to https://www.python.org
Expand Down

0 comments on commit 6d1f419

Please sign in to comment.