libsaml 2.22.2 → 2.23.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8145f1601cf38860a5fce6a78336b882fcf6cf02
4
- data.tar.gz: 73ad0cbb417957495a802602356003d4a6bd3da6
3
+ metadata.gz: 2b0fea88cbabb7ef6da156f348494ec005e3ec78
4
+ data.tar.gz: 6793447534a1947ea4ce6da59b459315ca48eaf8
5
5
  SHA512:
6
- metadata.gz: 68e9b938046abf0292b8da29c90eebf0e4b0e2fefda62cff5ddb14835ef997f0b6c52fc92fc6395c40349add3fc11d7290bbfe057e115fa3499f266add8bcf2f
7
- data.tar.gz: 393d53430af040f22860e5cd0ee6c686a102e443ca096bdccb65af28bed7e3d8f7d369a84fa4c6b6182b86197f0df752e4d9de2c456e000b755dd4f120fe9daa
6
+ metadata.gz: 350001a2afe90a33823c33d3fc75e67c7375c076e40de376ef12f4d442f0f805c20575e223334cc086695d9f346a715ab5d1a7e3c1688623ff11c2746d7bd43d
7
+ data.tar.gz: 597ec590265c404e9d844e23347a036d1782a6c8358df0690ce786b3e09789a60a52b6d1f7410305ab2b56f3c2590c814febbb25e84b14a53e857107580e6d7d
@@ -13,6 +13,29 @@ module Saml
13
13
  has_many :encrypted_keys, Xmlenc::Builder::EncryptedKey, xpath: "./"
14
14
 
15
15
  validates :encrypted_data, presence: true
16
+
17
+ def encrypt(attribute, encrypted_key_data, encrypted_data_options = {})
18
+ self.encrypted_data = Xmlenc::Builder::EncryptedData.new(encrypted_data_options)
19
+ self.encrypted_data.set_encryption_method algorithm: 'http://www.w3.org/2001/04/xmlenc#aes256-cbc'
20
+ self.encrypted_data.set_key_name key_name
21
+
22
+ encrypted_key_data.each do |key_descriptor, key_options|
23
+ encrypted_key = self.encrypted_data.encrypt Nokogiri::XML(attribute.to_xml).root.to_xml, key_options
24
+ encrypted_key.set_encryption_method algorithm: 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p', digest_method_algorithm: 'http://www.w3.org/2000/09/xmldsig#sha1'
25
+ encrypted_key.set_key_name key_descriptor.key_info.key_name
26
+ encrypted_key.carried_key_name = key_name
27
+ encrypted_key.encrypt key_descriptor.certificate.public_key
28
+
29
+ self.encrypted_keys ||= []
30
+ self.encrypted_keys << encrypted_key
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def key_name
37
+ @key_name ||= Saml.generate_id
38
+ end
16
39
  end
17
40
  end
18
41
  end
data/lib/saml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Saml
2
- VERSION = '2.22.2'
2
+ VERSION = '2.23.1'
3
3
  end
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: 2.22.2
4
+ version: 2.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoist Claassen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-31 00:00:00.000000000 Z
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport