libsaml 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/saml/elements/encrypted_id.rb +40 -4
- data/lib/saml/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e73072466741589480fc5f90f964a5269daed6b
|
4
|
+
data.tar.gz: 39711779f39cf35a9f7297f2086a8a3264e959dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeb4f71dd537afb00af8f944c149d8f9b0ecaa4957d5c91305622d82bf1d909ee91912e472e254073ebce1eaf11e581a309fdabf1b1c6e3cb91a90aa4cf002c5
|
7
|
+
data.tar.gz: fcd455a37996355a939d9c57f938fbd3958110534b10d22d2a685aee939299d9a52e81d25ab0bae8eae4f9cd5525e5bbcff212410a95f946c303ffcd4aec7f29
|
@@ -25,9 +25,21 @@ module Saml
|
|
25
25
|
|
26
26
|
def encrypt(key_descriptors, key_options = {})
|
27
27
|
key_descriptors = Array(key_descriptors)
|
28
|
-
encrypted_keys = []
|
29
28
|
|
29
|
+
if key_descriptors.any?
|
30
|
+
if key_descriptors.one?
|
31
|
+
encrypt_for_one_recipient(key_descriptors.first, key_options)
|
32
|
+
else
|
33
|
+
encrypt_for_multiple_recipients(key_descriptors, key_options)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def encrypt_for_one_recipient(key_descriptor, key_options = {})
|
30
41
|
self.encrypted_data = Xmlenc::Builder::EncryptedData.new
|
42
|
+
|
31
43
|
self.encrypted_data.set_key_retrieval_method Xmlenc::Builder::RetrievalMethod.new(
|
32
44
|
uri: "##{key_options[:id]}"
|
33
45
|
)
|
@@ -35,8 +47,34 @@ module Saml
|
|
35
47
|
algorithm: 'http://www.w3.org/2001/04/xmlenc#aes256-cbc'
|
36
48
|
)
|
37
49
|
|
50
|
+
encrypted_key = self.encrypted_data.encrypt(name_id_xml, key_options)
|
51
|
+
encrypted_key.set_encryption_method(
|
52
|
+
algorithm: 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p',
|
53
|
+
digest_method_algorithm: 'http://www.w3.org/2000/09/xmldsig#sha1'
|
54
|
+
)
|
55
|
+
|
56
|
+
encrypted_key.set_key_name(key_descriptor.key_info.key_name)
|
57
|
+
encrypted_key.encrypt(key_descriptor.certificate.public_key)
|
58
|
+
|
59
|
+
self.encrypted_keys = [ encrypted_key ]
|
60
|
+
self.name_id = nil
|
61
|
+
end
|
62
|
+
|
63
|
+
def encrypt_for_multiple_recipients(key_descriptors, key_options = {})
|
64
|
+
key_name = key_options[:key_name]
|
65
|
+
encrypted_keys = []
|
66
|
+
|
67
|
+
self.encrypted_data = Xmlenc::Builder::EncryptedData.new
|
68
|
+
self.encrypted_data.set_key_name key_name
|
69
|
+
self.encrypted_data.set_encryption_method(
|
70
|
+
algorithm: 'http://www.w3.org/2001/04/xmlenc#aes256-cbc'
|
71
|
+
)
|
72
|
+
|
38
73
|
key_descriptors.each do |key_descriptor|
|
39
|
-
encrypted_key = self.encrypted_data.encrypt(
|
74
|
+
encrypted_key = self.encrypted_data.encrypt(
|
75
|
+
name_id_xml,
|
76
|
+
key_options.merge(id: "_#{SecureRandom.uuid}", carried_key_name: key_name)
|
77
|
+
)
|
40
78
|
encrypted_key.set_encryption_method(
|
41
79
|
algorithm: 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p',
|
42
80
|
digest_method_algorithm: 'http://www.w3.org/2000/09/xmldsig#sha1'
|
@@ -52,8 +90,6 @@ module Saml
|
|
52
90
|
self.name_id = nil
|
53
91
|
end
|
54
92
|
|
55
|
-
private
|
56
|
-
|
57
93
|
def name_id_xml
|
58
94
|
Nokogiri::XML(name_id.to_xml).root.to_xml
|
59
95
|
end
|
data/lib/saml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libsaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoist Claassen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.6.
|
101
|
+
version: 0.6.9
|
102
102
|
- - "<"
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: 0.7.0
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
requirements:
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 0.6.
|
111
|
+
version: 0.6.9
|
112
112
|
- - "<"
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: 0.7.0
|