Slowly moving from six to future.backports
pycryptodomex from pypi now constructs Cryptodome module on OS X too.
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
provides methods and functions to convert SAML classes to and from strings.
|
provides methods and functions to convert SAML classes to and from strings.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "4.0.3"
|
__version__ = "4.0.4rc1"
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import six
|
import six
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import os
|
import os
|
||||||
|
from base64 import b64encode
|
||||||
|
from base64 import b64decode
|
||||||
|
|
||||||
from Cryptodome import Random
|
from Cryptodome import Random
|
||||||
from Cryptodome.Cipher import AES
|
from Cryptodome.Cipher import AES
|
||||||
from base64 import b64encode, b64decode
|
|
||||||
|
|
||||||
__author__ = 'rolandh'
|
__author__ = 'rolandh'
|
||||||
|
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
import base64
|
import base64
|
||||||
# from binascii import hexlify
|
|
||||||
from binascii import hexlify
|
|
||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
from hashlib import sha1
|
|
||||||
from Cryptodome.PublicKey import RSA
|
|
||||||
import requests
|
import requests
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from binascii import hexlify
|
||||||
|
from hashlib import sha1
|
||||||
|
|
||||||
|
# from Crypto.PublicKey import RSA
|
||||||
|
from Cryptodome.PublicKey import RSA
|
||||||
|
|
||||||
from saml2.metadata import ENDPOINTS
|
from saml2.metadata import ENDPOINTS
|
||||||
from saml2.profile import paos, ecp
|
from saml2.profile import paos, ecp
|
||||||
from saml2.soap import parse_soap_enveloped_saml_artifact_resolve
|
from saml2.soap import parse_soap_enveloped_saml_artifact_resolve
|
||||||
|
@@ -5,14 +5,16 @@ import time
|
|||||||
import cgi
|
import cgi
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from six.moves.urllib.parse import quote, parse_qs
|
from future.backports.http.cookies import SimpleCookie
|
||||||
from six.moves.http_cookies import SimpleCookie
|
from future.backports.urllib.parse import quote
|
||||||
|
from future.backports.urllib.parse import parse_qs
|
||||||
|
|
||||||
from saml2 import BINDING_HTTP_ARTIFACT, SAMLError
|
from saml2 import BINDING_HTTP_ARTIFACT
|
||||||
from saml2 import BINDING_HTTP_REDIRECT
|
from saml2 import BINDING_HTTP_REDIRECT
|
||||||
from saml2 import BINDING_HTTP_POST
|
from saml2 import BINDING_HTTP_POST
|
||||||
from saml2 import BINDING_URI
|
from saml2 import BINDING_URI
|
||||||
from saml2 import BINDING_SOAP
|
from saml2 import BINDING_SOAP
|
||||||
|
from saml2 import SAMLError
|
||||||
from saml2 import time_util
|
from saml2 import time_util
|
||||||
|
|
||||||
__author__ = 'rohe0002'
|
__author__ = 'rohe0002'
|
||||||
@@ -240,10 +242,7 @@ def unpack_redirect(environ):
|
|||||||
|
|
||||||
|
|
||||||
def unpack_post(environ):
|
def unpack_post(environ):
|
||||||
try:
|
|
||||||
return dict([(k, v[0]) for k, v in parse_qs(get_post(environ))])
|
return dict([(k, v[0]) for k, v in parse_qs(get_post(environ))])
|
||||||
except Exception:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def unpack_soap(environ):
|
def unpack_soap(environ):
|
||||||
|
@@ -5,7 +5,6 @@ and SAML2 attribute aggregations as metadata collector in your
|
|||||||
WSGI application.
|
WSGI application.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import cgi
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import platform
|
import platform
|
||||||
@@ -13,10 +12,12 @@ import shelve
|
|||||||
import traceback
|
import traceback
|
||||||
import saml2
|
import saml2
|
||||||
import six
|
import six
|
||||||
from six.moves.urllib.parse import parse_qs, urlparse
|
|
||||||
from saml2.samlp import Extensions
|
from saml2.samlp import Extensions
|
||||||
from saml2 import xmldsig as ds
|
from saml2 import xmldsig as ds
|
||||||
|
|
||||||
|
from future.backports.urllib.parse import parse_qs
|
||||||
|
from future.backports.urllib.parse import urlparse
|
||||||
|
|
||||||
from six import StringIO
|
from six import StringIO
|
||||||
|
|
||||||
from paste.httpexceptions import HTTPSeeOther, HTTPRedirection
|
from paste.httpexceptions import HTTPSeeOther, HTTPRedirection
|
||||||
|
@@ -169,6 +169,7 @@ def rndstr(size=16, alphabet=""):
|
|||||||
alphabet = string.ascii_letters[0:52] + string.digits
|
alphabet = string.ascii_letters[0:52] + string.digits
|
||||||
return type(alphabet)().join(rng.choice(alphabet) for _ in range(size))
|
return type(alphabet)().join(rng.choice(alphabet) for _ in range(size))
|
||||||
|
|
||||||
|
|
||||||
def rndbytes(size=16, alphabet=""):
|
def rndbytes(size=16, alphabet=""):
|
||||||
"""
|
"""
|
||||||
Returns rndstr always as a binary type
|
Returns rndstr always as a binary type
|
||||||
|
@@ -101,12 +101,15 @@ def _decode_attribute_value(typ, text):
|
|||||||
|
|
||||||
|
|
||||||
def _verify_value_type(typ, val):
|
def _verify_value_type(typ, val):
|
||||||
#print("verify value type: %s, %s" % (typ, val))
|
# print("verify value type: %s, %s" % (typ, val))
|
||||||
if typ == XSD + "string":
|
if typ == XSD + "string":
|
||||||
try:
|
try:
|
||||||
return str(val)
|
return str(val)
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
|
if six.PY2:
|
||||||
return unicode(val)
|
return unicode(val)
|
||||||
|
else:
|
||||||
|
return val.decode('utf8')
|
||||||
if typ == XSD + "integer" or typ == XSD + "int":
|
if typ == XSD + "integer" or typ == XSD + "int":
|
||||||
return int(val)
|
return int(val)
|
||||||
if typ == XSD + "float" or typ == XSD + "double":
|
if typ == XSD + "float" or typ == XSD + "double":
|
||||||
|
@@ -12,12 +12,22 @@ import hashlib
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import ssl
|
import ssl
|
||||||
from six.moves.urllib.parse import urlencode
|
|
||||||
|
|
||||||
from time import mktime
|
from time import mktime
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
|
from future.backports.urllib.parse import urlencode
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
# from Crypto.PublicKey.RSA import importKey
|
||||||
|
# from Crypto.Signature import PKCS1_v1_5
|
||||||
|
# from Crypto.Util.asn1 import DerSequence
|
||||||
|
# from Crypto.PublicKey import RSA
|
||||||
|
# from Crypto.Hash import SHA
|
||||||
|
# from Crypto.Hash import SHA224
|
||||||
|
# from Crypto.Hash import SHA256
|
||||||
|
# from Crypto.Hash import SHA384
|
||||||
|
# from Crypto.Hash import SHA512
|
||||||
|
|
||||||
from Cryptodome.PublicKey.RSA import importKey
|
from Cryptodome.PublicKey.RSA import importKey
|
||||||
from Cryptodome.Signature import PKCS1_v1_5
|
from Cryptodome.Signature import PKCS1_v1_5
|
||||||
from Cryptodome.Util.asn1 import DerSequence
|
from Cryptodome.Util.asn1 import DerSequence
|
||||||
|
Reference in New Issue
Block a user