@@ -1334,6 +1334,7 @@ sub digest_saml {
1334
1334
$xpc -> registerNs(' saml' , ' urn:oasis:names:tc:SAML:2.0:assertion' );
1335
1335
$xpc -> registerNs(' samlp' , ' urn:oasis:names:tc:SAML:2.0:protocol' );
1336
1336
$xpc -> registerNs(' ds' , ' http://www.w3.org/2000/09/xmldsig#' );
1337
+ $xpc -> registerNs(' ec' , ' http://www.w3.org/2001/10/xml-exc-c14n#' );
1337
1338
1338
1339
my $parent_node = $signature_node -> parentNode;
1339
1340
@@ -1351,6 +1352,12 @@ sub digest_saml {
1351
1352
1352
1353
my $with_comments = ($transform_algs [1] =~ / WithComments/ );
1353
1354
1355
+ my ($inclusive_ns ) =
1356
+ $xpc -> findnodes(' ./ec:InclusiveNamespaces' , $transforms [1]);
1357
+ my $prefix_list = $inclusive_ns
1358
+ ? [split ' ' , $inclusive_ns -> getAttribute(' PrefixList' )]
1359
+ : undef ;
1360
+
1354
1361
my $digest_method =
1355
1362
$xpc -> findnodes(' ./ds:DigestMethod' , $reference_node )-> [0];
1356
1363
my $alg = $digest_method -> getAttribute(' Algorithm' );
@@ -1359,7 +1366,8 @@ sub digest_saml {
1359
1366
1360
1367
my $next_sibling = $signature_node -> nextSibling();
1361
1368
$signature_node -> unbindNode();
1362
- my $parent_node_c14n = $parent_node -> toStringEC14N($with_comments );
1369
+ my $parent_node_c14n =
1370
+ $parent_node -> toStringEC14N($with_comments , undef , $xpc , $prefix_list );
1363
1371
$parent_node -> insertBefore($signature_node , $next_sibling );
1364
1372
1365
1373
my %hash_func_map = (
@@ -1455,7 +1463,6 @@ sub signature_saml {
1455
1463
}
1456
1464
1457
1465
return $result ;
1458
-
1459
1466
}
1460
1467
1461
1468
sub get_time {
@@ -1520,7 +1527,9 @@ sub gen_tmpl {
1520
1527
<ds:Reference URI="#${id}">
1521
1528
<ds:Transforms>
1522
1529
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
1523
- <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
1530
+ <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
1531
+ <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="xs example"/>
1532
+ </ds:Transform>
1524
1533
</ds:Transforms>
1525
1534
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
1526
1535
<ds:DigestValue></ds:DigestValue>
@@ -1606,7 +1615,7 @@ END_XML
1606
1615
</saml:Attribute>
1607
1616
<saml:Attribute Name="http://schemas.example.com/identity/claims/foo"
1608
1617
>
1609
- <saml:AttributeValue xsi:type="xs :string">bar</saml:AttributeValue>
1618
+ <saml:AttributeValue xsi:type="example :string">bar</saml:AttributeValue>
1610
1619
</saml:Attribute>
1611
1620
</saml:AttributeStatement>
1612
1621
</saml:Assertion>
0 commit comments