From dece930724dee04a93c7a1456af977beac327fef Mon Sep 17 00:00:00 2001 From: rhoerbe Date: Wed, 16 Jul 2014 09:02:34 +0200 Subject: [PATCH] added support for more hash algorithms (SHA2, RIPEMED160) (this patch required for saml2test alg config option) --- src/xmldsig/__init__.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/xmldsig/__init__.py b/src/xmldsig/__init__.py index a184912..81d5579 100644 --- a/src/xmldsig/__init__.py +++ b/src/xmldsig/__init__.py @@ -10,20 +10,45 @@ from saml2 import SamlBase NAMESPACE = 'http://www.w3.org/2000/09/xmldsig#' ENCODING_BASE64 = 'http://www.w3.org/2000/09/xmldsig#base64' + +# digest and signature algorithms (not implemented = commented out) DIGEST_SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1' -ALG_EXC_C14N = 'http://www.w3.org/2001/10/xml-exc-c14n#' -SIG_DSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#dsa-sha1' +DIGEST_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#sha224' +DIGEST_SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256' +DIGEST_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384' +DIGEST_SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512' +DIGEST_RIPEMD160 = 'http://www.w3.org/2001/04/xmlenc#ripemd160' +digest_default = DIGEST_SHA1 + +#SIG_DSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#dsa-sha1' +#SIG_DSA_SHA256 = 'http://www.w3.org/2009/xmldsig11#dsa-sha256' +#SIG_ECDSA_SHA1 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha1' +#SIG_ECDSA_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha224' +#SIG_ECDSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha256' +#SIG_ECDSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha384' +#SIG_ECDSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#ECDSA_sha512' +SIG_RSA_MD5 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-md5' # test framework SIG_RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' +SIG_RSA_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha224' +SIG_RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' +SIG_RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384' +SIG_RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512' +SIG_RSA_RIPMED160 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160' +sig_default = SIG_RSA_SHA1 + MAC_SHA1 = 'http://www.w3.org/2000/09/xmldsig#hmac-sha1' C14N = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315' C14N_WITH_C = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments' +ALG_EXC_C14N = 'http://www.w3.org/2001/10/xml-exc-c14n#' TRANSFORM_XSLT = 'http://www.w3.org/TR/1999/REC-xslt-19991116' TRANSFORM_XPATH = 'http://www.w3.org/TR/1999/REC-xpath-19991116' TRANSFORM_ENVELOPED = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature' + + class CryptoBinary_(SamlBase): """The http://www.w3.org/2000/09/xmldsig#:CryptoBinary element """