saml-kit 0.2.8 → 0.2.9

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
  SHA256:
3
- metadata.gz: c496796275792465ee1906c67364da02c7633058aa58ba06cd8f3471f24aadf7
4
- data.tar.gz: '090aef04081e81bad6805fecbc73daeaa88fdeaf2d88dbcaeb42c8e204416e0f'
3
+ metadata.gz: 0bf388798a57928e726edb29bf5a4998f43a62139b4cb5da662a73e434b23dae
4
+ data.tar.gz: 3c5d2bc07e37dcc6f95779bde81cfdff175f5f61929370dcd7fa6950e3614676
5
5
  SHA512:
6
- metadata.gz: f1c3064dfb1e0ae83c665d6e43da37ad639b384491b1100d5c3cdf4b52a6f18e3cf169cb81e4b93516dffc4b73b3f3318c99d6e43b4fb5684c51503917437ff4
7
- data.tar.gz: '020684ed30855042cf53c804ec1e12355ffe1ac032365abc94de85b757c8e330418435cde36cc8e081d231a7cccbf8777012adfff44e4003d02d26b14eaecf23'
6
+ metadata.gz: ee450ff950b85fa7f4d6c6f32a97015eb0cb6ddf530560a243b97a9c5bab3f488f32be5a94bf439614f3d3378eeb8f5bbcbc92d9935d2bdf3f161d08a29ee466
7
+ data.tar.gz: 81eceb240153a8095a00f82e315b1b623ad3b1c27bb86ce59b2294ebf143d7bc4a57193d2a6ca2a1e31b251e19991d9f0b99d11f914f457972ebc7d27f58a04e
@@ -1,5 +1,5 @@
1
1
  module Saml
2
2
  module Kit
3
- VERSION = "0.2.8"
3
+ VERSION = "0.2.9"
4
4
  end
5
5
  end
@@ -1,10 +1,10 @@
1
1
  module Saml
2
2
  module Kit
3
3
  class XmlDecryption
4
- attr_reader :private_key
4
+ attr_reader :private_keys
5
5
 
6
6
  def initialize(configuration: Saml::Kit.configuration)
7
- @private_key = configuration.private_keys(use: :encryption).last
7
+ @private_keys = configuration.private_keys(use: :encryption)
8
8
  end
9
9
 
10
10
  def decrypt(data)
@@ -19,7 +19,16 @@ module Saml
19
19
  def symmetric_key_from(encrypted_data)
20
20
  encrypted_key = encrypted_data['KeyInfo']['EncryptedKey']
21
21
  cipher_text = Base64.decode64(encrypted_key['CipherData']['CipherValue'])
22
- to_plaintext(cipher_text, private_key, encrypted_key["EncryptionMethod"]['Algorithm'])
22
+ attempts = private_keys.count
23
+ private_keys.each do |private_key|
24
+ begin
25
+ attempts -= 1
26
+ return to_plaintext(cipher_text, private_key, encrypted_key["EncryptionMethod"]['Algorithm'])
27
+ rescue OpenSSL::PKey::RSAError => error
28
+ Saml::Kit.logger.error(error)
29
+ raise if attempts.zero?
30
+ end
31
+ end
23
32
  end
24
33
 
25
34
  def to_plaintext(cipher_text, symmetric_key, algorithm)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saml-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan