Skip to content

Commit 5a30933

Browse files
author
Roland Hedberg
committed
Test using nod-default signing algorithm.
1 parent fd9651e commit 5a30933

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

tests/test_40_sigver.py

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22

33
import base64
4+
from saml2.xmldsig import SIG_RSA_SHA256
45
from saml2 import sigver
56
from saml2 import extension_elements_to_elements
67
from saml2 import class_name
@@ -510,9 +511,36 @@ def test_xmlsec_err():
510511
assert False
511512

512513

514+
def test_sha256_signing():
515+
conf = config.SPConfig()
516+
conf.load_file("server_conf")
517+
md = MetadataStore([saml, samlp], None, conf)
518+
md.load("local", full_path("idp_example.xml"))
519+
520+
conf.metadata = md
521+
conf.only_use_keys_in_metadata = False
522+
sec = sigver.security_context(conf)
523+
524+
assertion = factory(
525+
saml.Assertion, version="2.0", id="11111",
526+
issue_instant="2009-10-30T13:20:28Z",
527+
signature=sigver.pre_signature_part("11111", sec.my_cert, 1,
528+
sign_alg=SIG_RSA_SHA256),
529+
attribute_statement=do_attribute_statement(
530+
{("", "", "surName"): ("Foo", ""),
531+
("", "", "givenName"): ("Bar", ""), })
532+
)
533+
534+
s = sec.sign_statement(assertion, class_name(assertion),
535+
key_file=full_path("test.key"),
536+
node_id=assertion.id)
537+
assert s
538+
539+
540+
513541
if __name__ == "__main__":
514-
t = TestSecurity()
515-
t.setup_class()
516-
t.test_sign_assertion()
542+
# t = TestSecurity()
543+
# t.setup_class()
544+
# t.test_sign_assertion()
517545

518-
#test_xmlsec_err()
546+
test_sha256_signing()

0 commit comments

Comments
 (0)