@@ -539,7 +539,8 @@ def test_encrypted_signed_response_1(self):
539
539
sign_assertion = True ,
540
540
encrypt_assertion = False ,
541
541
encrypt_assertion_self_contained = True ,
542
- encrypted_advice_attributes = True ,
542
+ pefim = True ,
543
+ #encrypted_advice_attributes=True,
543
544
encrypt_cert_advice = cert_str ,
544
545
)
545
546
@@ -573,11 +574,15 @@ def test_encrypted_signed_response_1(self):
573
574
574
575
self .verify_assertion (assertion )
575
576
576
- valid = self .server .sec .verify_signature (decr_text ,
577
- self .server .config .cert_file ,
578
- node_name = 'urn:oasis:names:tc:SAML:2.0:assertion:Assertion' ,
579
- node_id = assertion [0 ].id ,
580
- id_attr = "" )
577
+
578
+
579
+ #PEFIM never signs assertions.
580
+ assert assertion [0 ].signature is None
581
+ #valid = self.server.sec.verify_signature(decr_text,
582
+ # self.server.config.cert_file,
583
+ # node_name='urn:oasis:names:tc:SAML:2.0:assertion:Assertion',
584
+ # node_id=assertion[0].id,
585
+ # id_attr="")
581
586
assert valid
582
587
583
588
def test_encrypted_signed_response_2 (self ):
@@ -593,7 +598,6 @@ def test_encrypted_signed_response_2(self):
593
598
sign_assertion = False ,
594
599
encrypt_assertion = True ,
595
600
encrypt_assertion_self_contained = True ,
596
- encrypt_cert = cert_str ,
597
601
)
598
602
599
603
sresponse = response_from_string (signed_resp )
@@ -649,7 +653,6 @@ def test_encrypted_signed_response_3(self):
649
653
650
654
resp .assertion = extension_elements_to_elements (resp .encrypted_assertion [0 ].extension_elements , [saml , samlp ])
651
655
652
-
653
656
valid = self .server .sec .verify_signature (decr_text ,
654
657
self .server .config .cert_file ,
655
658
node_name = 'urn:oasis:names:tc:SAML:2.0:assertion:Assertion' ,
@@ -677,7 +680,8 @@ def test_encrypted_signed_response_4(self):
677
680
sign_assertion = True ,
678
681
encrypt_assertion = True ,
679
682
encrypt_assertion_self_contained = True ,
680
- encrypted_advice_attributes = True ,
683
+ #encrypted_advice_attributes=True,
684
+ pefim = True ,
681
685
encrypt_cert_advice = cert_str ,
682
686
)
683
687
@@ -715,11 +719,13 @@ def test_encrypted_signed_response_4(self):
715
719
extension_elements_to_elements (assertion [0 ].advice .encrypted_assertion [0 ].extension_elements ,[saml , samlp ])
716
720
self .verify_assertion (assertion )
717
721
718
- valid = self .server .sec .verify_signature (decr_text ,
719
- self .server .config .cert_file ,
720
- node_name = 'urn:oasis:names:tc:SAML:2.0:assertion:Assertion' ,
721
- node_id = assertion [0 ].id ,
722
- id_attr = "" )
722
+ #PEFIM never signs assertion in advice
723
+ assert assertion [0 ].signature is None
724
+ #valid = self.server.sec.verify_signature(decr_text,
725
+ # self.server.config.cert_file,
726
+ # node_name='urn:oasis:names:tc:SAML:2.0:assertion:Assertion',
727
+ # node_id=assertion[0].id,
728
+ # id_attr="")
723
729
assert valid
724
730
725
731
def test_encrypted_response_1 (self ):
@@ -735,7 +741,8 @@ def test_encrypted_response_1(self):
735
741
sign_assertion = False ,
736
742
encrypt_assertion = False ,
737
743
encrypt_assertion_self_contained = True ,
738
- encrypted_advice_attributes = True ,
744
+ #encrypted_advice_attributes=True,
745
+ pefim = True ,
739
746
encrypt_cert_advice = cert_str_advice ,
740
747
)
741
748
@@ -767,7 +774,8 @@ def test_encrypted_response_2(self):
767
774
sign_assertion = False ,
768
775
encrypt_assertion = True ,
769
776
encrypt_assertion_self_contained = True ,
770
- encrypted_advice_attributes = True ,
777
+ #encrypted_advice_attributes=True,
778
+ pefim = True ,
771
779
encrypt_cert_advice = cert_str_advice ,
772
780
)
773
781
@@ -859,7 +867,8 @@ def test_encrypted_response_5(self):
859
867
sign_assertion = False ,
860
868
encrypt_assertion = False ,
861
869
encrypt_assertion_self_contained = True ,
862
- encrypted_advice_attributes = True ,
870
+ #encrypted_advice_attributes=True,
871
+ pefim = True
863
872
)
864
873
865
874
_resp = "%s" % _resp
@@ -891,7 +900,8 @@ def test_encrypted_response_6(self):
891
900
sign_assertion = False ,
892
901
encrypt_assertion = True ,
893
902
encrypt_assertion_self_contained = True ,
894
- encrypted_advice_attributes = True ,
903
+ #encrypted_advice_attributes=True,
904
+ pefim = True ,
895
905
encrypt_cert_advice = cert_str_advice ,
896
906
encrypt_cert_assertion = cert_str_assertion
897
907
)
@@ -925,7 +935,8 @@ def test_encrypted_response_7(self):
925
935
sign_assertion = False ,
926
936
encrypt_assertion = True ,
927
937
encrypt_assertion_self_contained = True ,
928
- encrypted_advice_attributes = True ,
938
+ #encrypted_advice_attributes=True,
939
+ pefim = True
929
940
)
930
941
931
942
sresponse = response_from_string (_resp )
@@ -954,7 +965,8 @@ def test_encrypted_response_8(self):
954
965
sign_assertion = False ,
955
966
encrypt_assertion = True ,
956
967
encrypt_assertion_self_contained = True ,
957
- encrypted_advice_attributes = True ,
968
+ #encrypted_advice_attributes=True,
969
+ pefim = True ,
958
970
encrypt_cert_advice = "whatever" ,
959
971
encrypt_cert_assertion = "whatever"
960
972
)
@@ -975,7 +987,8 @@ def test_encrypted_response_8(self):
975
987
sign_assertion = False ,
976
988
encrypt_assertion = False ,
977
989
encrypt_assertion_self_contained = True ,
978
- encrypted_advice_attributes = True ,
990
+ #encrypted_advice_attributes=True,
991
+ pefim = True ,
979
992
encrypt_cert_advice = "whatever" ,
980
993
)
981
994
assert False , "Must throw an exception"
@@ -1017,7 +1030,8 @@ def test_encrypted_response_8(self):
1017
1030
sign_assertion = False ,
1018
1031
encrypt_assertion = True ,
1019
1032
encrypt_assertion_self_contained = True ,
1020
- encrypted_advice_attributes = True ,
1033
+ #encrypted_advice_attributes=True,
1034
+ pefim = True ,
1021
1035
encrypt_cert_advice = "whatever" ,
1022
1036
encrypt_cert_assertion = "whatever"
1023
1037
)
@@ -1038,7 +1052,8 @@ def test_encrypted_response_8(self):
1038
1052
sign_assertion = False ,
1039
1053
encrypt_assertion = False ,
1040
1054
encrypt_assertion_self_contained = True ,
1041
- encrypted_advice_attributes = True ,
1055
+ #encrypted_advice_attributes=True,
1056
+ pefim = True ,
1042
1057
encrypt_cert_advice = "whatever" ,
1043
1058
)
1044
1059
assert False , "Must throw an exception"
@@ -1080,7 +1095,8 @@ def test_encrypted_response_9(self):
1080
1095
sign_assertion = False ,
1081
1096
encrypt_assertion = True ,
1082
1097
encrypt_assertion_self_contained = True ,
1083
- encrypted_advice_attributes = True ,
1098
+ #encrypted_advice_attributes=True,
1099
+ pefim = True ,
1084
1100
)
1085
1101
1086
1102
self .verify_assertion (_resp .assertion .advice .assertion )
@@ -1095,7 +1111,8 @@ def test_encrypted_response_9(self):
1095
1111
sign_assertion = False ,
1096
1112
encrypt_assertion = False ,
1097
1113
encrypt_assertion_self_contained = True ,
1098
- encrypted_advice_attributes = True ,
1114
+ #encrypted_advice_attributes=True,
1115
+ pefim = True
1099
1116
)
1100
1117
1101
1118
self .verify_assertion (_resp .assertion .advice .assertion )
@@ -1253,4 +1270,4 @@ def test_1(self):
1253
1270
if __name__ == "__main__" :
1254
1271
ts = TestServer1 ()
1255
1272
ts .setup_class ()
1256
- ts .test_encrypted_response_9 ()
1273
+ ts .test_encrypted_signed_response_1 ()
0 commit comments