diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-06-26 22:31:05 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-06-26 22:31:05 -0500 |
commit | 666252ce9eb00b926437b49f17553097a8f813e9 (patch) | |
tree | 345aee62c07a0053b9e80749bfe05864648cbc77 | |
parent | 3c6bba5729fa81475dd9e756b800a5e6eda4653b (diff) | |
download | cryptography-666252ce9eb00b926437b49f17553097a8f813e9.tar.gz cryptography-666252ce9eb00b926437b49f17553097a8f813e9.tar.bz2 cryptography-666252ce9eb00b926437b49f17553097a8f813e9.zip |
do this much more simply
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/x509.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py index ce8b89cc..ebda9c98 100644 --- a/src/cryptography/hazmat/backends/openssl/x509.py +++ b/src/cryptography/hazmat/backends/openssl/x509.py @@ -83,13 +83,10 @@ def _decode_general_name(backend, gn): if gn.type == backend._lib.GEN_DNS: data = backend._ffi.buffer(gn.d.dNSName.data, gn.d.dNSName.length)[:] if data.startswith(b"*."): - # This is a wildcard name. We need to split on period, remove the - # leading wildcard, IDNA decode, then re-add the wildcard - # Wildcard characters should always be left-most (RFC 2595 - # section 2.4). - parts = data.split(b".") - parts.pop(0) - data = u"*." + idna.decode(b".".join(parts)) + # This is a wildcard name. We need to remove the leading wildcard, + # IDNA decode, then re-add the wildcard. Wildcard characters should + # always be left-most (RFC 2595 section 2.4). + data = u"*." + idna.decode(data[2:]) else: # Not a wildcard, decode away. If the string has a * in it anywhere # invalid this will raise an InvalidCodePoint |