@@ -1536,20 +1536,25 @@ def _check_signature(self, decoded_xml, item, node_name=NODE_NAME, origdoc=None,
1536
1536
# - or the exclusive canonicalization transforms
1537
1537
# (with the identifier http://www.w3.org/2001/10/xml-exc-c14n#
1538
1538
# or http://www.w3.org/2001/10/xml-exc-c14n#WithComments).
1539
- transform_alogs = [
1539
+ transform_algos = [
1540
1540
transform .algorithm
1541
1541
for transform in references [0 ].transforms .transform
1542
1542
]
1543
- transform_alogs_n = len (transform_alogs )
1544
- only_up_to_two_transforms_are_defined = (
1543
+ tranform_algos_valid = ALLOWED_TRANSFORMS .intersection (transform_algos )
1544
+ transform_algos_n = len (transform_algos )
1545
+ tranform_algos_valid_n = len (tranform_algos_valid )
1546
+
1547
+ the_number_of_transforms_is_one_or_two = (
1545
1548
signatures_must_have_a_single_reference_element
1546
- and 1 <= transform_alogs_n <= 2
1549
+ and 1 <= transform_algos_n <= 2
1547
1550
)
1548
1551
all_transform_algs_are_allowed = (
1549
- only_up_to_two_transforms_are_defined
1550
- and transform_alogs_n == len (
1551
- ALLOWED_TRANSFORMS .intersection (transform_alogs )
1552
- )
1552
+ the_number_of_transforms_is_one_or_two
1553
+ and transform_algos_n == tranform_algos_valid_n
1554
+ )
1555
+ the_enveloped_signature_transform_is_defined = (
1556
+ the_number_of_transforms_is_one_or_two
1557
+ and TRANSFORM_ENVELOPED in transform_algos
1553
1558
)
1554
1559
1555
1560
# The <ds:Object> element is not defined for use with SAML signatures,
@@ -1572,10 +1577,13 @@ def _check_signature(self, decoded_xml, item, node_name=NODE_NAME, origdoc=None,
1572
1577
the_anchor_points_to_the_enclosing_element_ID_attribute
1573
1578
),
1574
1579
"canonicalization method is c14n" : canonicalization_method_is_c14n ,
1575
- "only up to two transforms are defined " : (
1576
- only_up_to_two_transforms_are_defined
1580
+ "the number of transforms is one or two " : (
1581
+ the_number_of_transforms_is_one_or_two
1577
1582
),
1578
1583
"all transform algs are allowed" : all_transform_algs_are_allowed ,
1584
+ "the enveloped signature transform is defined" : (
1585
+ the_enveloped_signature_transform_is_defined
1586
+ ),
1579
1587
"object element is not present" : object_element_is_not_present ,
1580
1588
}
1581
1589
if not all (validators .values ()):
0 commit comments