Owner email (#414)

* Ensuring python2 works with unicode strings.

* adding in owner DN

* fixing tests

* Upgrading requests.

* Fixing tests.
This commit is contained in:
kevgliss 2016-08-25 10:09:46 -07:00 committed by GitHub
parent 18b99c0de4
commit 2d7a6ccf3c
4 changed files with 7 additions and 5 deletions

View File

@ -322,6 +322,7 @@ def create_csr(**csr_config):
x509.NameAttribute(x509.OID_COUNTRY_NAME, csr_config['country']),
x509.NameAttribute(x509.OID_STATE_OR_PROVINCE_NAME, csr_config['state']),
x509.NameAttribute(x509.OID_LOCALITY_NAME, csr_config['location']),
x509.NameAttribute(x509.OID_EMAIL_ADDRESS, csr_config['owner'])
]))
builder = builder.add_extension(

View File

@ -40,4 +40,4 @@ def parse_certificate(body):
if isinstance(body, bytes):
return x509.load_pem_x509_certificate(body, default_backend())
return x509.load_pem_x509_certificate(bytes(body, 'utf8'), default_backend())
return x509.load_pem_x509_certificate(body, default_backend())
return x509.load_pem_x509_certificate(str(body), default_backend())

View File

@ -284,6 +284,7 @@ def test_create_basic_csr(client):
country='US',
state='CA',
location='A place',
owner='joe@example.com',
extensions=dict(names=dict(sub_alt_names=['test.example.com', 'test2.example.com']))
)
csr, pem = create_csr(**csr_config)
@ -328,12 +329,12 @@ def test_create_csr():
from lemur.certificates.service import create_csr
csr, private_key = create_csr(common_name='ACommonName', organization='test', organizational_unit='Meters', country='US',
state='CA', location='Here')
state='CA', location='Here', owner='joe@example.com')
assert csr
assert private_key
extensions = {'sub_alt_names': {'names': [{'name_type': 'DNSName', 'value': 'AnotherCommonName'}]}}
csr, private_key = create_csr(common_name='ACommonName', organization='test', organizational_unit='Meters', country='US',
csr, private_key = create_csr(owner='joe@example.com', common_name='ACommonName', organization='test', organizational_unit='Meters', country='US',
state='CA', location='Here', extensions=extensions)
assert csr
assert private_key

View File

@ -44,7 +44,7 @@ install_requires = [
'Flask-Mail==0.9.1',
'SQLAlchemy-Utils==0.31.4',
'BeautifulSoup4==4.4.1',
'requests==2.9.1',
'requests==2.11.1',
'psycopg2==2.6.1',
'arrow==0.7.0',
'six==1.10.0',
@ -52,7 +52,7 @@ install_requires = [
'marshmallow-sqlalchemy==0.8.0',
'marshmallow==2.4.0',
'pycrypto==2.6.1',
'cryptography==1.3.2',
'cryptography==1.4',
'pyopenssl==0.15.1',
'pyjwt==1.4.0',
'xmltodict==0.9.2',