Skip to content

Commit a95c671

Browse files
author
Roland Hedberg
committed
Fixed conflicts
1 parent a9d0b7c commit a95c671

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def run_tests(self):
4343
'paste',
4444
'zope.interface',
4545
'repoze.who',
46-
'pycrypto', #'Crypto'
46+
'pycrypto', # 'Crypto'
4747
'pytz'
4848
]
4949

src/saml2/cert.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import dateutil.parser
66
import pytz
77
from OpenSSL import crypto
8-
from os.path import exists, join
8+
from os.path import join
99
from os import remove
1010
from Crypto.Util import asn1
1111

@@ -228,7 +228,8 @@ def verify_chain(self, cert_chain_str_list, cert_str):
228228
return False, message
229229
else:
230230
cert_str = tmp_cert_str
231-
return True, "Signed certificate is valid and correctly signed by CA certificate."
231+
return (True,
232+
"Signed certificate is valid and correctly signed by CA certificate.")
232233

233234
def certificate_not_valid_yet(self, cert):
234235
starts_to_be_valid = dateutil.parser.parse(cert.get_notBefore())

src/saml2/sigver.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,16 @@
5252

5353
from tempfile import NamedTemporaryFile
5454
from subprocess import Popen, PIPE
55+
from xmlenc import EncryptionMethod, EncryptedKey, CipherData, CipherValue, \
56+
EncryptedData
5557

5658
logger = logging.getLogger(__name__)
5759

5860
SIG = "{%s#}%s" % (ds.NAMESPACE, "Signature")
5961

6062
RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
63+
RSA_1_5 = "http://www.w3.org/2001/04/xmlenc#rsa-1_5"
64+
TRIPLE_DES_CBC = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc"
6165

6266
from Crypto.Hash import SHA256, SHA384, SHA512, SHA
6367

@@ -1509,6 +1513,28 @@ def pre_signature_part(ident, public_key=None, identifier=None):
15091513
return signature
15101514

15111515

1516+
def pre_encryption_part(msg_enc=TRIPLE_DES_CBC, key_enc=RSA_1_5):
1517+
"""
1518+
1519+
:param msg_enc:
1520+
:param key_enc:
1521+
:return:
1522+
"""
1523+
msg_encryption_method = EncryptionMethod(algorithm=msg_enc)
1524+
key_encryption_method = EncryptionMethod(algorithm=key_enc)
1525+
encrypted_key = EncryptedKey(encryption_method=key_encryption_method,
1526+
key_info=ds.KeyInfo(
1527+
key_name=ds.KeyName(text="")),
1528+
cipher_data=CipherData(
1529+
cipher_value=CipherValue(text="")))
1530+
key_info = ds.KeyInfo(encrypted_key=encrypted_key)
1531+
encrypted_data = EncryptedData(
1532+
encryption_method=msg_encryption_method,
1533+
key_info=key_info,
1534+
cipher_data=CipherData(cipher_value=CipherValue(text="")))
1535+
return encrypted_data
1536+
1537+
15121538
def response_factory(sign=False, encrypt=False, **kwargs):
15131539
response = samlp.Response(id=sid(), version=VERSION,
15141540
issue_instant=instant())

0 commit comments

Comments
 (0)