diff --git a/saml2idp/codex.py b/saml2idp/codex.py index a2e2ebf..d1c18ad 100644 --- a/saml2idp/codex.py +++ b/saml2idp/codex.py @@ -5,8 +5,6 @@ import zlib import base64 -from django.utils.six import binary_type - def decode_base64_and_inflate(b64string): decoded_data = base64.b64decode(b64string) @@ -21,5 +19,5 @@ def deflate_and_base64_encode(string_val): def nice64(src): """ Returns src base64-encoded and formatted nicely for our XML. """ - assert isinstance(src, binary_type), 'Can only encode bytes' + assert isinstance(src, bytes), 'Can only encode bytes' return base64.b64encode(src).decode('ascii') diff --git a/saml2idp/xml_signing.py b/saml2idp/xml_signing.py index 2f6c834..2e23dd7 100644 --- a/saml2idp/xml_signing.py +++ b/saml2idp/xml_signing.py @@ -9,7 +9,6 @@ import string import OpenSSL.crypto -from django.utils import six from . import saml2idp_metadata as smd from .codex import nice64 @@ -54,9 +53,6 @@ def load_private_key(config): def sign_with_rsa(private_key, data): digest = "sha1" - # This needs to be bytes on py2, str on py3. This is very odd. - if six.PY2: - digest = digest.encode('ascii') data = OpenSSL.crypto.sign(private_key, data, digest) return base64.b64encode(data).decode('ascii')