diff options
author | Andre Caron <andre.l.caron@gmail.com> | 2015-05-31 17:15:36 -0400 |
---|---|---|
committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2015-06-24 13:35:48 -0500 |
commit | eebe700861774a640f82391d2a4597d2fe6ff399 (patch) | |
tree | 1420a42f3e43ca01855d7b810126d247afb37795 | |
parent | b1103d25a72818d7fd055f17d8008d0ac99f8b95 (diff) | |
download | cryptography-eebe700861774a640f82391d2a4597d2fe6ff399.tar.gz cryptography-eebe700861774a640f82391d2a4597d2fe6ff399.tar.bz2 cryptography-eebe700861774a640f82391d2a4597d2fe6ff399.zip |
Removes OID to txt to OID conversion.
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/backend.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py index 08e56d07..c509ddb3 100644 --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -80,23 +80,16 @@ def _encode_asn1_str(backend, x, n): def _encode_name(backend, attributes): - resolve = { - x509.OID_COMMON_NAME: b'CN', - x509.OID_COUNTRY_NAME: b'C', - x509.OID_STATE_OR_PROVINCE_NAME: b'ST', - x509.OID_LOCALITY_NAME: b'L', - x509.OID_ORGANIZATION_NAME: b'O', - x509.OID_ORGANIZATIONAL_UNIT_NAME: b'OU', - } subject = backend._lib.X509_NAME_new() subject = backend._ffi.gc(subject, backend._lib.X509_NAME_free) for attribute in attributes: value = attribute.value if isinstance(value, six.text_type): value = value.encode('ascii') - res = backend._lib.X509_NAME_add_entry_by_txt( + obj = _txt2obj(backend, attribute.oid.dotted_string) + res = backend._lib.X509_NAME_add_entry_by_OBJ( subject, - resolve[attribute.oid], + obj, backend._lib.MBSTRING_ASC, value, -1, -1, 0, |