Skip to content

Commit

Permalink
Moving string mask to end of file to perform initialization at the sa…
Browse files Browse the repository at this point in the history
…me time as other code.
Spindel authored and reaperhulk committed Apr 15, 2015
1 parent 5533e25 commit 349e136
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions OpenSSL/crypto.py
Original file line number Diff line number Diff line change
@@ -463,9 +463,6 @@ def __setattr__(self, name, value):
if isinstance(value, _text_type):
value = value.encode('utf-8')

# Make it so OpenSSL generates utf-8 strings.
_lib.ASN1_STRING_set_default_mask_asc(b'utf8only')

add_result = _lib.X509_NAME_add_entry_by_NID(
self._name, nid, _lib.MBSTRING_UTF8, value, -1, -1, 0)
if not add_result:
@@ -2640,3 +2637,9 @@ def locking_function(mode, index, filename, line):
# 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')

0 comments on commit 349e136

Please sign in to comment.