Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Commit

Permalink
Update django to django 3.1, remove redundant backport code
Browse files Browse the repository at this point in the history
  • Loading branch information
AvuGradConnection committed Mar 24, 2021
1 parent 197fca4 commit 71fa738
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
4 changes: 1 addition & 3 deletions saml2idp/codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')
4 changes: 0 additions & 4 deletions saml2idp/xml_signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import string

import OpenSSL.crypto
from django.utils import six

from . import saml2idp_metadata as smd
from .codex import nice64
Expand Down Expand Up @@ -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')

Expand Down

0 comments on commit 71fa738

Please sign in to comment.