This repository has been archived by the owner on Jan 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from mobify/development
Fixed typo in SSLContext
- Loading branch information
Showing
4 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIICnzCCAggCCQCGXOeu96ab6zANBgkqhkiG9w0BAQsFADCBkzELMAkGA1UEBhMC | ||
Q0ExGTAXBgNVBAgMEEJyaXRpc2ggQ29sdW1iaWExEjAQBgNVBAcMCVZhbmNvdXZl | ||
cjEdMBsGA1UECgwUVGVzdCBDbGllbnQgQ2VydCBJbmMxGzAZBgNVBAsMElVuaXQg | ||
VGVzdCBEaXZpc2lvbjEZMBcGA1UEAwwQY2xpZW50LnRlc3QuY2VydDAeFw0xNTEy | ||
MjIyMjA4NDJaFw0xNjAxMjEyMjA4NDJaMIGTMQswCQYDVQQGEwJDQTEZMBcGA1UE | ||
CAwQQnJpdGlzaCBDb2x1bWJpYTESMBAGA1UEBwwJVmFuY291dmVyMR0wGwYDVQQK | ||
DBRUZXN0IENsaWVudCBDZXJ0IEluYzEbMBkGA1UECwwSVW5pdCBUZXN0IERpdmlz | ||
aW9uMRkwFwYDVQQDDBBjbGllbnQudGVzdC5jZXJ0MIGfMA0GCSqGSIb3DQEBAQUA | ||
A4GNADCBiQKBgQCzHp5Md/ALVxfxTQy2ZmKYKwzx8z5hQQT1lPzuLLR5tpWALhMz | ||
1t11nnMABzc0mUrtWQYQIt+skNnrna/snKhnFor9GABsPArtZPP+cdxvjr510okz | ||
X87bJjwD35wDmEEjJbpGVQl4MMmC+TVBDxXdVSJpS/Cx2DtsevBbrydsBwIDAQAB | ||
MA0GCSqGSIb3DQEBCwUAA4GBAIId1RjLsA5q3XRgMQs0zIez7bXjpnaNIfRVSZQm | ||
+xXZcDkGdIYG8zSjHM/oRotvMpA3vC03IplTO0HWbSNIywTtxuGoz2meyWu3hLUb | ||
wGT++dYEBzLkEZIi1bAYnSd14eLrrtkAbOf47pki0QSqGcIiwzwMV5dakziaUAcm | ||
jNUJ | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
Proc-Type: 4,ENCRYPTED | ||
DEK-Info: DES-EDE3-CBC,45F919D21278643B | ||
|
||
6EzhPabgaJSsV6DPJRBRZFU0zhr6h8fXZTSu6ZtWVsovsc2mzfdpqtYsmFpY1Cdr | ||
066EVqkF0VDlWEvwhvdSRIdyDyc/9Hp75Lfevj0MZ9V7RaYJlLNtXOwYolBvfAAT | ||
p6c6Okr1GMUhUM6Y/mub7MJ4xQa6RFcnBrlfpUt7zrmfbrzeWdMSqIRCoxKiZy6T | ||
MP3qm8OnnwlsuCDgHXJWvTbQ4MQ1a7AzapLrX3fARM9SMS8I/tibh4f/ut+kUJbr | ||
tFfcfEokCqKDAbggdSdtURC112NuMv8niPkgr2C0mzijcxco59jMT9hZJHh+kAkP | ||
LUzwyFfdvsIgPbYYrlVOzgBCkXFUoy2prvRO9AxXjKHKWox9cC6Xq9s+3Au2OkVm | ||
WAbJcfogRDFRKM0T7OsC5FmwdFT6ITQCOttHSU9fIAWv0mVvyO9uR33NLTdyQg6r | ||
/LURXQa7xZ8rNdoxwqC88YG+L51mJFgw6T5h0brEbI0P0k8A3/rt8EHOkCgNOyQl | ||
mK+N8Wu+VcEHUpxWZJU651+qSvxLIYs9W50Kectrx+tr3OKE/Q/BMkJlld5T1/DH | ||
InJNf+TM0qyz0EgdCgkxQgYK4K71usLklbQX6L0Xuy6rDSmal/n/64HnvLFE444B | ||
59ljwXNJEN3tfhcLNKjBQE8IV4GlclN6RX/DF+45MRzXezIpn2rXZ0JhCAwtSbLC | ||
jEDzmRF5qW2iPEgZq4mURwwtTBMroKb7r+YwCQZvDAhgps1TujltsiTXFQ9rwR6q | ||
sAK9HztfRk1SJXuq3JXHAyneHbfl99EH08bc4TLwwX2s6dG0d8iH1w== | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Tests the hyper SSLContext. | ||
""" | ||
import os | ||
|
||
import pytest | ||
|
||
from hyper.compat import ssl | ||
try: | ||
from hyper.ssl_compat import SSLContext | ||
except ImportError: | ||
SSLContext = None | ||
|
||
|
||
TEST_DIR = os.path.abspath(os.path.dirname(__file__)) | ||
TEST_CERTS_DIR = os.path.join(TEST_DIR, 'certs') | ||
CLIENT_CERT_FILE = os.path.join(TEST_CERTS_DIR, 'client.crt') | ||
CLIENT_KEY_FILE = os.path.join(TEST_CERTS_DIR, 'client.key') | ||
|
||
|
||
class TestHyperSSLContext(object): | ||
""" | ||
Tests hyper SSLContext | ||
""" | ||
|
||
@pytest.mark.skipif( | ||
SSLContext is None, | ||
reason='requires PyOpenSSL' | ||
) | ||
def test_custom_context_with_cert_as_file(self): | ||
# Test using hyper's own SSLContext | ||
context = SSLContext(ssl.PROTOCOL_SSLv23) | ||
context.verify_mode = ssl.CERT_NONE | ||
context.check_hostname = False | ||
|
||
# Test that we can load in a cert and key protected by a passphrase, | ||
# from files. | ||
context.load_cert_chain( | ||
certfile=CLIENT_CERT_FILE, | ||
keyfile=CLIENT_KEY_FILE, | ||
password='abc123' | ||
) |