xmlenc 0.6.8 → 0.6.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bd6b427526017614daaa55dabf68ae2a39bae85
|
4
|
+
data.tar.gz: cc5c4813f5758495e514aed426fb98d9dd45ac4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2c81dbb86bd5f99e014252110984cbb2b4d450d73ad8b31f6f8f2375503a7c5bd63950821fbe4dae85d78eb8209098aedd587690e6135a5c689a73df9f75c94
|
7
|
+
data.tar.gz: 5cba8f5ba6f103b57504b0ef3e9f7dea2fc192dc4c6ff44b06b1b09eea3a3dc3afb0440b695d85c38f4812bf3e38bd7d759d57f530f306ebbefee9448ba186e2
|
@@ -37,9 +37,16 @@ module Xmlenc
|
|
37
37
|
encryptor = algorithm.setup
|
38
38
|
encrypted = encryptor.encrypt(data, :node => encryption_method)
|
39
39
|
cipher_data.cipher_value = Base64.encode64(encrypted)
|
40
|
+
|
40
41
|
key_params = { :data => encryptor.key }
|
42
|
+
|
41
43
|
encrypted_key = EncryptedKey.new(key_params.merge(key_options))
|
42
44
|
encrypted_key.add_data_reference(id)
|
45
|
+
|
46
|
+
if key_options[:carried_key_name].present?
|
47
|
+
encrypted_key.carried_key_name = key_options[:carried_key_name]
|
48
|
+
end
|
49
|
+
|
43
50
|
encrypted_key
|
44
51
|
end
|
45
52
|
|
@@ -50,6 +57,13 @@ module Xmlenc
|
|
50
57
|
end
|
51
58
|
end
|
52
59
|
|
60
|
+
def set_key_name(key_name)
|
61
|
+
if key_name
|
62
|
+
self.key_info ||= KeyInfo.new
|
63
|
+
self.key_info.key_name = key_name
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
53
67
|
private
|
54
68
|
|
55
69
|
def algorithm
|
data/lib/xmlenc/version.rb
CHANGED
@@ -112,23 +112,39 @@ describe Xmlenc::Builder::EncryptedData do
|
|
112
112
|
expect(Xmlenc::Builder::EncryptedKey).to receive(:new).with(hash_including(key_options))
|
113
113
|
subject.encrypt('TEST', key_options)
|
114
114
|
end
|
115
|
+
|
116
|
+
context 'when a "carried_key_name" is passed' do
|
117
|
+
let(:key_options) { { :id => '_SOME_ID', :recipient => 'SOME_RECIPIENT', :carried_key_name => 'CARRIED_KEY_NAME' } }
|
118
|
+
|
119
|
+
it 'sets the carried key name' do
|
120
|
+
expect(subject.encrypt('TEST', key_options).carried_key_name).to eq 'CARRIED_KEY_NAME'
|
121
|
+
end
|
122
|
+
end
|
115
123
|
end
|
116
124
|
end
|
117
125
|
|
118
|
-
describe
|
119
|
-
it
|
126
|
+
describe '#set_key_retrieval_method' do
|
127
|
+
it 'sets the key info with the retrieval method' do
|
120
128
|
subject.set_key_retrieval_method 'retrieval_method'
|
121
|
-
expect(subject.key_info.retrieval_method).to eq
|
129
|
+
expect(subject.key_info.retrieval_method).to eq 'retrieval_method'
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'does not set the key info element if the "retrieval_method" is nil' do
|
133
|
+
subject.key_info = nil
|
134
|
+
subject.set_key_retrieval_method(nil)
|
135
|
+
expect(subject.key_info).to be_nil
|
122
136
|
end
|
137
|
+
end
|
123
138
|
|
124
|
-
|
125
|
-
|
126
|
-
|
139
|
+
describe '#set_key_name' do
|
140
|
+
it 'sets the key info with the key name' do
|
141
|
+
subject.set_key_name 'key_name'
|
142
|
+
expect(subject.key_info.key_name).to eq 'key_name'
|
127
143
|
end
|
128
144
|
|
129
|
-
it
|
145
|
+
it 'does not set the key info element if the "key_name" is nil' do
|
130
146
|
subject.key_info = nil
|
131
|
-
subject.
|
147
|
+
subject.set_key_name(nil)
|
132
148
|
expect(subject.key_info).to be_nil
|
133
149
|
end
|
134
150
|
end
|
@@ -65,10 +65,4 @@ describe Xmlenc::EncryptedDocument do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
describe 'parsing documents' do
|
69
|
-
let(:encrypted_xml) { File.read('spec/fixtures/artifact_response.xml') }
|
70
|
-
fit 'finds the correct data' do
|
71
|
-
puts subject.encrypted_keys.count
|
72
|
-
end
|
73
|
-
end
|
74
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmlenc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoist
|
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
|