From 16d3ae1b8e96b4c112c0f17911b5d14f0ed20385 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Thu, 17 Oct 2019 04:07:56 +0300 Subject: UniversalString needs to be encoded as UCS-4 (#5000) --- src/cryptography/hazmat/backends/openssl/encode_asn1.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/cryptography/hazmat/backends/openssl/encode_asn1.py b/src/cryptography/hazmat/backends/openssl/encode_asn1.py index fc16a58b..ca35f0e7 100644 --- a/src/cryptography/hazmat/backends/openssl/encode_asn1.py +++ b/src/cryptography/hazmat/backends/openssl/encode_asn1.py @@ -121,6 +121,8 @@ def _encode_sk_name_entry(backend, attributes): def _encode_name_entry(backend, attribute): if attribute._type is _ASN1Type.BMPString: value = attribute.value.encode('utf_16_be') + elif attribute._type is _ASN1Type.UniversalString: + value = attribute.value.encode('utf_32_be') else: value = attribute.value.encode('utf8') -- cgit v1.2.3