mail-gpg 0.3.2 → 0.3.3

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: 0fa28ac570f95bf31e58025d3e29c4d8fe15c43a
4
- data.tar.gz: 3a4afd5b7c7847333c364135aba9acb20fc9762d
3
+ metadata.gz: dc0c7bb838506fa1e0e3f01fbce200a95e13e76f
4
+ data.tar.gz: a528a571122d6c9b61c5ce2152b37973bdec88d9
5
5
  SHA512:
6
- metadata.gz: d96da3558cb0b0ed814dce389d0e969e19edf718712adcecc0dc5bad04c6d1a35ed8da20acbf9427212072daf1c462e48a9391d5fc0c6d5b63c4e6a9e3593052
7
- data.tar.gz: 3a8e23f13198857aa5fe9f533a08d7209d55ee0ba9839d913b977fbea59841315c211c1f87f3440e0c7a1d3a239419ed84dcb0b593efa6590aa85aadfce129cd
6
+ metadata.gz: 40c3c768a539f4e016fc259cbd13b5d7323b423bde90be8dcb4a970017dc9d33e686d73e5d1a834facd8db82e9816f96f1e1e08eebbdbfa21773eeb435e51493
7
+ data.tar.gz: 1b37f11b4beb3311a1c894c2b1c77e626f8cadfd4cacdac74ab9bb96e528c6773ad10a91b093585276677825ed589555e21a7fe1673e82fd6193960e71bb7d87
@@ -1,3 +1,7 @@
1
+ == 0.3.3 2018-04-01
2
+
3
+ * fix broken GpgmeHelper#keys_for_data #59
4
+
1
5
  == 0.3.2 2018-03-30
2
6
 
3
7
  * do not attempt to decrypt inline-encrypted HTML parts #52
@@ -128,8 +128,8 @@ module Mail
128
128
  unless key_id.nil? || key_id.empty?
129
129
  GPGME::Key.find(:public, key_id, :encrypt)
130
130
  end
131
- end.flatten
132
- elsif emails_or_shas_or_keys.size > 0
131
+ end.flatten.compact
132
+ elsif emails_or_shas_or_keys and emails_or_shas_or_keys.size > 0
133
133
  # key lookup in keychain for all receivers
134
134
  GPGME::Key.find :public, emails_or_shas_or_keys, :encrypt
135
135
  else
@@ -1,5 +1,5 @@
1
1
  module Mail
2
2
  module Gpg
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
@@ -11,7 +11,9 @@ class DecryptedPartTest < Test::Unit::TestCase
11
11
  subject 'test'
12
12
  body 'i am unencrypted'
13
13
  end
14
- @part = Mail::Gpg::EncryptedPart.new(@mail, { :sign => true, :password => 'abc' })
14
+ @part = Mail::Gpg::EncryptedPart.new(@mail, { recipients: ['jane@foo.bar'],
15
+ :sign => true,
16
+ :password => 'abc' })
15
17
  end
16
18
 
17
19
  should 'decrypt' do
@@ -17,67 +17,20 @@ class EncryptedPartTest < Test::Unit::TestCase
17
17
  subject 'test'
18
18
  body 'i am unencrypted'
19
19
  end
20
- @part = Mail::Gpg::EncryptedPart.new(mail)
20
+ @part = Mail::Gpg::EncryptedPart.new(mail, recipients: ['jane@foo.bar'])
21
21
  end
22
22
 
23
- context 'with email address' do
24
- setup do
25
- @email = 'jane@foo.bar'
26
- end
27
-
28
- should 'resolve email to gpg keys' do
29
- assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, @email)
30
- check_key_list keys
31
- end
32
-
33
- should 'resolve emails to gpg keys' do
34
- assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, [@email])
35
- check_key_list keys
36
- end
37
-
23
+ should 'have binary content type and name' do
24
+ assert_equal 'application/octet-stream; name=encrypted.asc', @part.content_type
38
25
  end
39
26
 
40
- context 'with key id' do
41
- setup do
42
- @key_id = GPGME::Key.find(:public, 'jane@foo.bar').first.sha
43
- end
44
-
45
- should 'resolve single id gpg keys' do
46
- assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, @key_id)
47
- check_key_list keys
48
- end
49
- should 'resolve id list to gpg keys' do
50
- assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, [@key_id])
51
- check_key_list keys
52
- end
27
+ should 'have description' do
28
+ assert_match(/openpgp/i, @part.content_description)
53
29
  end
54
30
 
55
- context 'with key fingerprint' do
56
- setup do
57
- @key_fpr = GPGME::Key.find(:public, 'jane@foo.bar').first.fingerprint
58
- end
59
-
60
- should 'resolve single id gpg keys' do
61
- assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, @key_fpr)
62
- check_key_list keys
63
- end
64
- should 'resolve id list to gpg keys' do
65
- assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, [@key_fpr])
66
- check_key_list keys
67
- end
31
+ should 'have inline disposition and default filename' do
32
+ assert_equal 'inline; filename=encrypted.asc', @part.content_disposition
68
33
  end
69
34
 
70
- context 'with emails and key data' do
71
- setup do
72
- @key = GPGME::Key.find(:public, 'jane@foo.bar').first.export(armor: true).to_s
73
- @emails = ['jane@foo.bar']
74
- @key_data = { 'jane@foo.bar' => @key }
75
- end
76
-
77
- should 'resolve to gpg keys' do
78
- assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, @emails, @key_data)
79
- check_key_list keys
80
- end
81
- end
82
35
  end
83
36
  end
@@ -0,0 +1,79 @@
1
+ require 'test_helper'
2
+
3
+ class GpgmeHelperTest < Test::Unit::TestCase
4
+
5
+ def check_key_list(keys)
6
+ assert_equal 1, keys.size
7
+ assert_equal GPGME::Key, keys.first.class
8
+ assert_equal 'jane@foo.bar', keys.first.email
9
+ end
10
+
11
+ context 'GpgmeHelper' do
12
+
13
+ should 'handle empty email list' do
14
+ assert_equal [], Mail::Gpg::GpgmeHelper.send(:keys_for_data, nil)
15
+ assert_equal [], Mail::Gpg::GpgmeHelper.send(:keys_for_data, [])
16
+ end
17
+
18
+ context 'with email address' do
19
+ setup do
20
+ @email = 'jane@foo.bar'
21
+ end
22
+
23
+ should 'resolve email to gpg keys' do
24
+ assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, @email)
25
+ check_key_list keys
26
+ end
27
+
28
+ should 'resolve emails to gpg keys' do
29
+ assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, [@email])
30
+ check_key_list keys
31
+ end
32
+
33
+ end
34
+
35
+ context 'with key id' do
36
+ setup do
37
+ @key_id = GPGME::Key.find(:public, 'jane@foo.bar').first.sha
38
+ end
39
+
40
+ should 'resolve single id gpg keys' do
41
+ assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, @key_id)
42
+ check_key_list keys
43
+ end
44
+ should 'resolve id list to gpg keys' do
45
+ assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, [@key_id])
46
+ check_key_list keys
47
+ end
48
+ end
49
+
50
+ context 'with key fingerprint' do
51
+ setup do
52
+ @key_fpr = GPGME::Key.find(:public, 'jane@foo.bar').first.fingerprint
53
+ end
54
+
55
+ should 'resolve single id gpg keys' do
56
+ assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, @key_fpr)
57
+ check_key_list keys
58
+ end
59
+ should 'resolve id list to gpg keys' do
60
+ assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, [@key_fpr])
61
+ check_key_list keys
62
+ end
63
+ end
64
+
65
+ context 'with emails and key data' do
66
+ setup do
67
+ @key = GPGME::Key.find(:public, 'jane@foo.bar').first.export(armor: true).to_s
68
+ @emails = ['jane@foo.bar']
69
+ @key_data = { 'jane@foo.bar' => @key }
70
+ end
71
+
72
+ should 'resolve to gpg keys' do
73
+ assert keys = Mail::Gpg::GpgmeHelper.send(:keys_for_data, @emails, @key_data)
74
+ check_key_list keys
75
+ end
76
+ end
77
+ end
78
+ end
79
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail-gpg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Kraemer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-30 00:00:00.000000000 Z
11
+ date: 2018-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail
@@ -182,6 +182,7 @@ files:
182
182
  - test/gpghome/random_seed
183
183
  - test/gpghome/secring.gpg
184
184
  - test/gpghome/trustdb.gpg
185
+ - test/gpgme_helper_test.rb
185
186
  - test/hkp_test.rb
186
187
  - test/inline_decrypted_message_test.rb
187
188
  - test/inline_signed_message_test.rb
@@ -224,6 +225,7 @@ test_files:
224
225
  - test/gpghome/random_seed
225
226
  - test/gpghome/secring.gpg
226
227
  - test/gpghome/trustdb.gpg
228
+ - test/gpgme_helper_test.rb
227
229
  - test/hkp_test.rb
228
230
  - test/inline_decrypted_message_test.rb
229
231
  - test/inline_signed_message_test.rb