gpgme 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/gpgme/extconf.rb +3 -3
- data/ext/gpgme/gpgme_n.c +17 -1
- data/lib/gpgme/key.rb +6 -0
- data/lib/gpgme/sub_key.rb +13 -4
- data/ports/archives/gpgme-1.5.3.tar.bz2 +0 -0
- data/ports/archives/libassuan-2.2.0.tar.bz2 +0 -0
- data/ports/archives/libgpg-error-1.17.tar.bz2 +0 -0
- data/test/ctx_test.rb +23 -0
- data/test/support/resources.rb +16 -0
- data/test/test_helper.rb +6 -1
- metadata +58 -51
- checksums.yaml +0 -7
- data/ports/archives/gpgme-1.5.1.tar.bz2 +0 -0
- data/ports/archives/gpgme-1.5.1.tar.bz2.sig +0 -0
- data/ports/archives/libassuan-2.1.2.tar.bz2 +0 -0
- data/ports/archives/libassuan-2.1.2.tar.bz2.sig +0 -0
- data/ports/archives/libgpg-error-1.13.tar.bz2 +0 -0
data/ext/gpgme/extconf.rb
CHANGED
@@ -62,7 +62,7 @@ EOS
|
|
62
62
|
require 'rubygems'
|
63
63
|
require 'mini_portile'
|
64
64
|
|
65
|
-
libgpg_error_recipe = MiniPortile.new('libgpg-error', '1.
|
65
|
+
libgpg_error_recipe = MiniPortile.new('libgpg-error', '1.17').tap do |recipe|
|
66
66
|
recipe.target = File.join(ROOT, "ports")
|
67
67
|
recipe.files = ["ftp://ftp.gnupg.org/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2"]
|
68
68
|
recipe.configure_options = [
|
@@ -79,7 +79,7 @@ EOS
|
|
79
79
|
recipe.activate
|
80
80
|
end
|
81
81
|
|
82
|
-
libassuan_recipe = MiniPortile.new('libassuan', '2.
|
82
|
+
libassuan_recipe = MiniPortile.new('libassuan', '2.2.0').tap do |recipe|
|
83
83
|
recipe.target = File.join(ROOT, "ports")
|
84
84
|
recipe.files = ["ftp://ftp.gnupg.org/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2"]
|
85
85
|
recipe.configure_options = [
|
@@ -96,7 +96,7 @@ EOS
|
|
96
96
|
recipe.activate
|
97
97
|
end
|
98
98
|
|
99
|
-
gpgme_recipe = MiniPortile.new('gpgme', '1.5.
|
99
|
+
gpgme_recipe = MiniPortile.new('gpgme', '1.5.3').tap do |recipe|
|
100
100
|
recipe.target = File.join(ROOT, "ports")
|
101
101
|
recipe.files = ["ftp://ftp.gnupg.org/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2"]
|
102
102
|
recipe.configure_options = [
|
data/ext/gpgme/gpgme_n.c
CHANGED
@@ -1205,6 +1205,9 @@ rb_s_gpgme_op_import_result (VALUE dummy, VALUE vctx)
|
|
1205
1205
|
rb_raise (rb_eArgError, "released ctx");
|
1206
1206
|
|
1207
1207
|
result = gpgme_op_import_result (ctx);
|
1208
|
+
if (!result)
|
1209
|
+
rb_raise (rb_eArgError, "no result");
|
1210
|
+
|
1208
1211
|
vresult = rb_class_new_instance (0, NULL, cImportResult);
|
1209
1212
|
rb_iv_set (vresult, "@considered", INT2NUM(result->considered));
|
1210
1213
|
rb_iv_set (vresult, "@no_user_id", INT2NUM(result->no_user_id));
|
@@ -1517,6 +1520,9 @@ rb_s_gpgme_op_decrypt_result (VALUE dummy, VALUE vctx)
|
|
1517
1520
|
rb_raise (rb_eArgError, "released ctx");
|
1518
1521
|
|
1519
1522
|
result = gpgme_op_decrypt_result (ctx);
|
1523
|
+
if (!result)
|
1524
|
+
rb_raise (rb_eArgError, "no result");
|
1525
|
+
|
1520
1526
|
vresult = rb_class_new_instance (0, NULL, cDecryptResult);
|
1521
1527
|
if (result->unsupported_algorithm)
|
1522
1528
|
rb_iv_set (vresult, "@unsupported_algorithm",
|
@@ -1532,7 +1538,8 @@ rb_s_gpgme_op_decrypt_result (VALUE dummy, VALUE vctx)
|
|
1532
1538
|
rb_iv_set (vrecipient, "@status", UINT2NUM(recipient->status));
|
1533
1539
|
rb_ary_push (vrecipients, vrecipient);
|
1534
1540
|
}
|
1535
|
-
|
1541
|
+
if (result->file_name)
|
1542
|
+
rb_iv_set (vresult, "@file_name", rb_str_new2 (result->file_name));
|
1536
1543
|
return vresult;
|
1537
1544
|
}
|
1538
1545
|
|
@@ -1595,6 +1602,9 @@ rb_s_gpgme_op_verify_result (VALUE dummy, VALUE vctx)
|
|
1595
1602
|
rb_raise (rb_eArgError, "released ctx");
|
1596
1603
|
|
1597
1604
|
verify_result = gpgme_op_verify_result (ctx);
|
1605
|
+
if (!verify_result)
|
1606
|
+
rb_raise (rb_eArgError, "no result");
|
1607
|
+
|
1598
1608
|
vverify_result = rb_class_new_instance(0, NULL, cVerifyResult);
|
1599
1609
|
rb_iv_set (vverify_result, "@signatures", vsignatures);
|
1600
1610
|
for (signature = verify_result->signatures; signature;
|
@@ -1778,6 +1788,9 @@ rb_s_gpgme_op_sign_result (VALUE dummy, VALUE vctx)
|
|
1778
1788
|
rb_raise (rb_eArgError, "released ctx");
|
1779
1789
|
|
1780
1790
|
result = gpgme_op_sign_result (ctx);
|
1791
|
+
if (!result)
|
1792
|
+
rb_raise (rb_eArgError, "no result");
|
1793
|
+
|
1781
1794
|
vresult = rb_class_new_instance (0, NULL, cSignResult);
|
1782
1795
|
vinvalid_signers = rb_ary_new ();
|
1783
1796
|
rb_iv_set (vresult, "@invalid_signers", vinvalid_signers);
|
@@ -1893,6 +1906,9 @@ rb_s_gpgme_op_encrypt_result (VALUE dummy, VALUE vctx)
|
|
1893
1906
|
rb_raise (rb_eArgError, "released ctx");
|
1894
1907
|
|
1895
1908
|
result = gpgme_op_encrypt_result (ctx);
|
1909
|
+
if (!result)
|
1910
|
+
rb_raise (rb_eArgError, "no result");
|
1911
|
+
|
1896
1912
|
vresult = rb_class_new_instance (0, NULL, cEncryptResult);
|
1897
1913
|
vinvalid_recipients = rb_ary_new ();
|
1898
1914
|
rb_iv_set (vresult, "@invalid_recipients", vinvalid_recipients);
|
data/lib/gpgme/key.rb
CHANGED
data/lib/gpgme/sub_key.rb
CHANGED
@@ -8,16 +8,25 @@ module GPGME
|
|
8
8
|
include KeyCommon
|
9
9
|
|
10
10
|
def timestamp
|
11
|
-
|
11
|
+
case @timestamp
|
12
|
+
when -1, 0
|
13
|
+
# FIXME: add a special value for invalid timestamp, or throw an error
|
14
|
+
return nil
|
15
|
+
else
|
16
|
+
return Time.at(@timestamp)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def expires?
|
21
|
+
@expires != 0
|
12
22
|
end
|
13
23
|
|
14
24
|
def expires
|
15
|
-
Time.at(@expires)
|
25
|
+
expires? ? Time.at(@expires) : nil
|
16
26
|
end
|
17
27
|
|
18
28
|
def expired
|
19
|
-
|
20
|
-
@expires < Time.now.to_i
|
29
|
+
expires? && @expires < Time.now.to_i
|
21
30
|
end
|
22
31
|
|
23
32
|
def sha
|
Binary file
|
Binary file
|
Binary file
|
data/test/ctx_test.rb
CHANGED
@@ -127,6 +127,29 @@ describe GPGME::Ctx do
|
|
127
127
|
# it ":progress_callback_value"
|
128
128
|
end
|
129
129
|
|
130
|
+
describe :decrypt_result do
|
131
|
+
it "returns the list of encyption recipients" do
|
132
|
+
cipher = GPGME::Data.new(KEY_1_ENCRYPTED)
|
133
|
+
output = GPGME::Data.new
|
134
|
+
|
135
|
+
GPGME::Ctx.new do |ctx|
|
136
|
+
ctx.decrypt_verify(cipher, output)
|
137
|
+
assert_equal 1, ctx.decrypt_result.recipients.size
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should not segfault" do
|
142
|
+
cipher = GPGME::Data.new(KEY_1_ENCRYPTED)
|
143
|
+
ouput = GPGME::Data.new
|
144
|
+
|
145
|
+
GPGME::Ctx.new do |ctx|
|
146
|
+
assert_raises ArgumentError do
|
147
|
+
ctx.decrypt_result
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
130
153
|
describe :armor do
|
131
154
|
it "sets false by default" do
|
132
155
|
ctx = GPGME::Ctx.new
|
data/test/support/resources.rb
CHANGED
@@ -492,6 +492,8 @@ KEYS << { :sha => 'test2@example.com', :public => key2_public, :secret => key2_s
|
|
492
492
|
KEYS << { :sha => 'test3@example.com', :public => key3_public, :secret => key3_secret}
|
493
493
|
KEYS << { :sha => 'test4@example.com', :public => key4_public, :secret => key4_secret}
|
494
494
|
|
495
|
+
PLAIN_KEY = { :sha => 'test1@example.com', :public => key1_public, :secret => key1_secret }
|
496
|
+
|
495
497
|
PASSWORD_KEY = {
|
496
498
|
:sha => 'test_with_password@example.com',
|
497
499
|
:public => password_key_public,
|
@@ -514,3 +516,17 @@ TEXT = {
|
|
514
516
|
:passwored => passwored.chomp,
|
515
517
|
:expired_key_sign => signed_with_expired_key_text.chomp
|
516
518
|
}
|
519
|
+
|
520
|
+
KEY_1_ENCRYPTED = <<-RUBY
|
521
|
+
-----BEGIN PGP MESSAGE-----
|
522
|
+
Version: GnuPG v1
|
523
|
+
|
524
|
+
hIwDbJ4P+uQnvtQBBACOzUqiKHRS8cEDPpQl1dQznpxcWW3Md8X3eFRx3+qD0X7+
|
525
|
+
aEadz/cUXf7nO9KimeO7qhqNBJoPQEzZTqirebLgq2pq+Rtp2zGCvU1hUnAmVm27
|
526
|
+
CZE/quNaBV33V0haddWm4Y8AD7e7T2a2LBDrMNGsD9eKjREJ+g/Pmm5WLRDx69JP
|
527
|
+
AaXe0Msjfyapj07hCPZptE8iP2/tCSvRDmiSgidPAZM4NnL2ANwfT6kslVha0mos
|
528
|
+
MH+qcPlxAMrMnjuWs+wFiVnWLEYfIqNzH7Z2irC2NA==
|
529
|
+
=O59i
|
530
|
+
-----END PGP MESSAGE-----
|
531
|
+
RUBY
|
532
|
+
|
data/test/test_helper.rb
CHANGED
@@ -16,9 +16,14 @@ require 'minitest/autorun'
|
|
16
16
|
require 'minitest/spec'
|
17
17
|
require 'minitest/pride'
|
18
18
|
require 'mocha'
|
19
|
-
require 'ruby-debug'
|
20
19
|
require 'gpgme'
|
21
20
|
|
21
|
+
if RUBY_VERSION.split('.').first.to_i > 1
|
22
|
+
require 'byebug'
|
23
|
+
else
|
24
|
+
require 'ruby-debug'
|
25
|
+
end
|
26
|
+
|
22
27
|
require File.dirname(__FILE__) + "/support/resources"
|
23
28
|
|
24
29
|
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpgme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.8
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Daiki Ueno
|
@@ -9,31 +10,28 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2014-
|
13
|
+
date: 2014-12-31 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: mini_portile
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
17
19
|
requirements:
|
18
|
-
- - '>='
|
20
|
+
- - ! '>='
|
19
21
|
- !ruby/object:Gem::Version
|
20
22
|
version: 0.5.0
|
21
|
-
- - <=
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.6.0
|
24
23
|
type: :runtime
|
25
24
|
prerelease: false
|
26
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
27
|
requirements:
|
28
|
-
- - '>='
|
28
|
+
- - ! '>='
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: 0.5.0
|
31
|
-
- - <=
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.6.0
|
34
31
|
- !ruby/object:Gem::Dependency
|
35
32
|
name: mocha
|
36
33
|
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
37
35
|
requirements:
|
38
36
|
- - ~>
|
39
37
|
- !ruby/object:Gem::Version
|
@@ -41,6 +39,7 @@ dependencies:
|
|
41
39
|
type: :development
|
42
40
|
prerelease: false
|
43
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
44
43
|
requirements:
|
45
44
|
- - ~>
|
46
45
|
- !ruby/object:Gem::Version
|
@@ -48,6 +47,7 @@ dependencies:
|
|
48
47
|
- !ruby/object:Gem::Dependency
|
49
48
|
name: minitest
|
50
49
|
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
@@ -55,6 +55,7 @@ dependencies:
|
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
58
59
|
requirements:
|
59
60
|
- - ~>
|
60
61
|
- !ruby/object:Gem::Version
|
@@ -62,6 +63,7 @@ dependencies:
|
|
62
63
|
- !ruby/object:Gem::Dependency
|
63
64
|
name: yard
|
64
65
|
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
65
67
|
requirements:
|
66
68
|
- - ~>
|
67
69
|
- !ruby/object:Gem::Version
|
@@ -69,6 +71,7 @@ dependencies:
|
|
69
71
|
type: :development
|
70
72
|
prerelease: false
|
71
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
72
75
|
requirements:
|
73
76
|
- - ~>
|
74
77
|
- !ruby/object:Gem::Version
|
@@ -76,20 +79,23 @@ dependencies:
|
|
76
79
|
- !ruby/object:Gem::Dependency
|
77
80
|
name: coveralls
|
78
81
|
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
79
83
|
requirements:
|
80
|
-
- - '>='
|
84
|
+
- - ! '>='
|
81
85
|
- !ruby/object:Gem::Version
|
82
86
|
version: '0'
|
83
87
|
type: :development
|
84
88
|
prerelease: false
|
85
89
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
86
91
|
requirements:
|
87
|
-
- - '>='
|
92
|
+
- - ! '>='
|
88
93
|
- !ruby/object:Gem::Version
|
89
94
|
version: '0'
|
90
95
|
- !ruby/object:Gem::Dependency
|
91
96
|
name: debugger
|
92
97
|
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
93
99
|
requirements:
|
94
100
|
- - ~>
|
95
101
|
- !ruby/object:Gem::Version
|
@@ -97,86 +103,87 @@ dependencies:
|
|
97
103
|
type: :development
|
98
104
|
prerelease: false
|
99
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
100
107
|
requirements:
|
101
108
|
- - ~>
|
102
109
|
- !ruby/object:Gem::Version
|
103
110
|
version: 1.6.6
|
104
|
-
description:
|
105
|
-
|
111
|
+
description: ! 'Ruby-GPGME is a Ruby language binding of GPGME (GnuPG
|
112
|
+
|
106
113
|
Made Easy). GnuPG Made Easy (GPGME) is a library designed to make access to
|
114
|
+
|
107
115
|
GnuPG easier for applications. It provides a High-Level Crypto API for
|
108
|
-
|
116
|
+
|
117
|
+
encryption, decryption, signing, signature verification and key management.'
|
109
118
|
email: ueno@gnu.org
|
110
119
|
executables: []
|
111
120
|
extensions:
|
112
121
|
- ext/gpgme/extconf.rb
|
113
122
|
extra_rdoc_files: []
|
114
123
|
files:
|
115
|
-
- lib/gpgme.rb
|
116
|
-
- lib/gpgme/
|
124
|
+
- lib/gpgme/ctx.rb
|
125
|
+
- lib/gpgme/io_callbacks.rb
|
126
|
+
- lib/gpgme/crypto.rb
|
127
|
+
- lib/gpgme/user_id.rb
|
117
128
|
- lib/gpgme/version.rb
|
118
|
-
- lib/gpgme/signature.rb
|
119
|
-
- lib/gpgme/engine.rb
|
120
|
-
- lib/gpgme/key.rb
|
121
|
-
- lib/gpgme/misc.rb
|
122
129
|
- lib/gpgme/data.rb
|
123
|
-
- lib/gpgme/
|
124
|
-
- lib/gpgme/key_sig.rb
|
125
|
-
- lib/gpgme/constants.rb
|
130
|
+
- lib/gpgme/misc.rb
|
126
131
|
- lib/gpgme/sub_key.rb
|
127
|
-
- lib/gpgme/
|
132
|
+
- lib/gpgme/error.rb
|
133
|
+
- lib/gpgme/key.rb
|
134
|
+
- lib/gpgme/constants.rb
|
135
|
+
- lib/gpgme/signature.rb
|
136
|
+
- lib/gpgme/engine.rb
|
128
137
|
- lib/gpgme/key_common.rb
|
129
|
-
- lib/gpgme/
|
130
|
-
- lib/gpgme/
|
131
|
-
- lib/gpgme
|
132
|
-
- ext/gpgme/gpgme_n.c
|
138
|
+
- lib/gpgme/compat.rb
|
139
|
+
- lib/gpgme/key_sig.rb
|
140
|
+
- lib/gpgme.rb
|
133
141
|
- ext/gpgme/extconf.rb
|
134
|
-
-
|
135
|
-
- test/sub_key_test.rb
|
136
|
-
- test/test_helper.rb
|
137
|
-
- test/data_test.rb
|
138
|
-
- test/crypto_test.rb
|
142
|
+
- ext/gpgme/gpgme_n.c
|
139
143
|
- test/gpgme_test.rb
|
144
|
+
- test/data_test.rb
|
145
|
+
- test/files/testkey_pub.gpg
|
146
|
+
- test/files/testkey_sec.gpg
|
140
147
|
- test/signature_test.rb
|
141
|
-
- test/
|
148
|
+
- test/crypto_test.rb
|
142
149
|
- test/ctx_test.rb
|
143
|
-
- test/
|
144
|
-
- test/
|
145
|
-
-
|
150
|
+
- test/support/resources.rb
|
151
|
+
- test/test_helper.rb
|
152
|
+
- test/sub_key_test.rb
|
153
|
+
- test/key_test.rb
|
154
|
+
- examples/keylist.rb
|
155
|
+
- examples/edit.rb
|
146
156
|
- examples/roundtrip.rb
|
147
157
|
- examples/verify.rb
|
148
158
|
- examples/genkey.rb
|
149
|
-
- examples/
|
150
|
-
-
|
151
|
-
- ports/archives/
|
152
|
-
- ports/archives/
|
153
|
-
- ports/archives/gpgme-1.5.1.tar.bz2
|
154
|
-
- ports/archives/libassuan-2.1.2.tar.bz2
|
155
|
-
- ports/archives/gpgme-1.5.1.tar.bz2.sig
|
159
|
+
- examples/sign.rb
|
160
|
+
- ports/archives/libassuan-2.2.0.tar.bz2
|
161
|
+
- ports/archives/libgpg-error-1.17.tar.bz2
|
162
|
+
- ports/archives/gpgme-1.5.3.tar.bz2
|
156
163
|
homepage: http://github.com/ueno/ruby-gpgme
|
157
164
|
licenses:
|
158
165
|
- LGPL-2.1+
|
159
|
-
metadata: {}
|
160
166
|
post_install_message:
|
161
167
|
rdoc_options: []
|
162
168
|
require_paths:
|
163
169
|
- lib
|
164
170
|
- ext
|
165
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
166
173
|
requirements:
|
167
|
-
- - '>='
|
174
|
+
- - ! '>='
|
168
175
|
- !ruby/object:Gem::Version
|
169
176
|
version: '0'
|
170
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
171
179
|
requirements:
|
172
|
-
- - '>='
|
180
|
+
- - ! '>='
|
173
181
|
- !ruby/object:Gem::Version
|
174
182
|
version: '0'
|
175
183
|
requirements: []
|
176
184
|
rubyforge_project: ruby-gpgme
|
177
|
-
rubygems_version:
|
185
|
+
rubygems_version: 1.8.23
|
178
186
|
signing_key:
|
179
|
-
specification_version:
|
187
|
+
specification_version: 3
|
180
188
|
summary: Ruby binding of GPGME.
|
181
189
|
test_files: []
|
182
|
-
has_rdoc: true
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: ddad2098d7948b2270488e28182d4cb8caab2dcf
|
4
|
-
data.tar.gz: f7df6a6384be5d81de6695158a5cf1b858f9402d
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: ddc16711b30e02461dbf3d570e88aa48b97993b7741baf5354ce79a7d1f17789cd430a68d25244e3b4f212f77c2b93a204385e26957f23c9413f4b6e6aae4629
|
7
|
-
data.tar.gz: 21112836148bf1a1f976c8b3890b27a38e69506e69b21dfd09b00c74bec3dae93f561c1ef4c70d71bbac381b3cd039cde9294e7ea95d40f6fb024f3b8d16f09a
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|