Skip to content

Commit 8453f12

Browse files
committed
FIX XMLSecurity SHA256 and SHA512 uris
1 parent 347893b commit 8453f12

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

lib/xml_security.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class Document < BaseDocument
8484
RSA_SHA384 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384"
8585
RSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"
8686
SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1"
87-
SHA256 = "http://www.w3.org/2001/04/xmldsig-more#sha256"
87+
SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'
8888
SHA384 = "http://www.w3.org/2001/04/xmldsig-more#sha384"
89-
SHA512 = "http://www.w3.org/2001/04/xmldsig-more#sha512"
89+
SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'
9090
ENVELOPED_SIG = "http://www.w3.org/2000/09/xmldsig#enveloped-signature"
9191
INC_PREFIX_LIST = "#default samlp saml ds xs xsi md"
9292

test/logoutrequest_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class RequestTest < Minitest::Test
112112

113113
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], request_xml
114114
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'/>], request_xml
115-
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#sha256'/>], request_xml
115+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmlenc#sha256'/>], request_xml
116116
end
117117

118118
it "create a signed logout request with 512 digest and signature method RSA_SHA384" do
@@ -125,7 +125,7 @@ class RequestTest < Minitest::Test
125125

126126
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], request_xml
127127
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'/>], request_xml
128-
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#sha512'/>], request_xml
128+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmlenc#sha512'/>], request_xml
129129
end
130130
end
131131

test/metadata_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class MetadataTest < Minitest::Test
203203
it "creates a signed metadata with specified digest and signature methods" do
204204
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>]m, xml_text
205205
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'/>], xml_text
206-
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#sha512'/>], xml_text
206+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmlenc#sha512'/>], xml_text
207207

208208
signed_metadata_2 = XMLSecurity::SignedDocument.new(xml_text)
209209

test/request_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class RequestTest < Minitest::Test
199199
request_xml = Base64.decode64(params["SAMLRequest"])
200200
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], request_xml
201201
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'/>], request_xml
202-
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#sha512'/>], request_xml
202+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmlenc#sha512'/>], request_xml
203203
end
204204
end
205205

test/slo_logoutresponse_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class SloLogoutresponseTest < Minitest::Test
7878
response_xml = Base64.decode64(params["SAMLResponse"])
7979
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], response_xml
8080
assert_match /<ds:SignatureMethod Algorithm='http:\/\/www.w3.org\/2001\/04\/xmldsig-more#rsa-sha256'\/>/, response_xml
81-
assert_match /<ds:DigestMethod Algorithm='http:\/\/www.w3.org\/2001\/04\/xmldsig-more#sha256'\/>/, response_xml
81+
assert_match /<ds:DigestMethod Algorithm='http:\/\/www.w3.org\/2001\/04\/xmlenc#sha256'\/>/, response_xml
8282
end
8383

8484
it "create a signed logout response with 512 digest and signature method RSA_SHA384" do
@@ -91,7 +91,7 @@ class SloLogoutresponseTest < Minitest::Test
9191
response_xml = Base64.decode64(params["SAMLResponse"])
9292
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], response_xml
9393
assert_match /<ds:SignatureMethod Algorithm='http:\/\/www.w3.org\/2001\/04\/xmldsig-more#rsa-sha384'\/>/, response_xml
94-
assert_match /<ds:DigestMethod Algorithm='http:\/\/www.w3.org\/2001\/04\/xmldsig-more#sha512'\/>/, response_xml
94+
assert_match /<ds:DigestMethod Algorithm='http:\/\/www.w3.org\/2001\/04\/xmlenc#sha512'\/>/, response_xml
9595
end
9696
end
9797

0 commit comments

Comments
 (0)