Merge pull request #234 from reaperhulk/utf8-time
set string mask utf8only
diff --git a/ChangeLog b/ChangeLog
index 5abdf38..61bfa5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,14 @@
-2011-09-02 Hynek Schlawack <hs@ox.cx>
+2015-04-15 Paul Kehrer <paul.l.kehrer@gmail.com>
+
+ * OpenSSL/crypto.py, OpenSSL/test/test_crypto.py: Switch to utf8string
+ mask by default. OpenSSL formerly defaulted to a T61String if there
+ were UTF-8 characters present. This was changed to default to
+ UTF8String in the config around 2005, but the actual code didn't
+ change it until late last year. This will default us to the setting
+ that actually works. To revert this you can call
+ crypto._lib.ASN1_STRING_set_default_mask_asc(b"default")
+
+2015-04-14 Hynek Schlawack <hs@ox.cx>
* Release 0.15.1
diff --git a/OpenSSL/crypto.py b/OpenSSL/crypto.py
index 50ff74f..c7bdabc 100644
--- a/OpenSSL/crypto.py
+++ b/OpenSSL/crypto.py
@@ -2637,3 +2637,9 @@
# This is similar but exercised mainly by exception_from_error_queue. It calls
# both ERR_load_crypto_strings() and ERR_load_SSL_strings().
_lib.SSL_load_error_strings()
+
+
+
+# Set the default string mask to match OpenSSL upstream (since 2005) and
+# RFC5280 recommendations.
+_lib.ASN1_STRING_set_default_mask_asc(b'utf8only')
diff --git a/OpenSSL/test/test_crypto.py b/OpenSSL/test/test_crypto.py
index f6f0751..73e9cc7 100644
--- a/OpenSSL/test/test_crypto.py
+++ b/OpenSSL/test/test_crypto.py
@@ -1003,7 +1003,7 @@
self.assertEqual(
a.der(),
b('0\x1b1\x0b0\t\x06\x03U\x04\x06\x13\x02US'
- '1\x0c0\n\x06\x03U\x04\x03\x13\x03foo'))
+ '1\x0c0\n\x06\x03U\x04\x03\x0c\x03foo'))
def test_get_components(self):