gpgme 2.0.12 → 2.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/gpgme/extconf.rb +15 -6
- data/ext/gpgme/gpgme_n.c +57 -1
- data/lib/gpgme/key_common.rb +4 -4
- data/lib/gpgme/sub_key.rb +3 -3
- data/lib/gpgme/version.rb +1 -1
- data/ports/archives/gpgme-1.9.0.tar.bz2 +0 -0
- data/ports/archives/libassuan-2.4.3.tar.bz2 +0 -0
- data/ports/archives/libgpg-error-1.27.tar.bz2 +0 -0
- data/test/crypto_test.rb +2 -2
- data/test/ctx_test.rb +1 -1
- data/test/key_test.rb +1 -1
- data/test/signature_test.rb +1 -1
- data/test/sub_key_test.rb +1 -1
- data/test/test_helper.rb +29 -8
- metadata +8 -9
- data/ports/archives/gpgme-1.6.0.tar.bz2 +0 -0
- data/ports/archives/libassuan-2.4.2.tar.bz2 +0 -0
- data/ports/archives/libgpg-error-1.21.tar.bz2 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1404d6456af3680a442805ede037a138b5d7ed9
|
4
|
+
data.tar.gz: 5a6fc1cadbfaab728a4abed17824736b31bbdf8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c58514fedfc607814b68d6b714018ffcd07ae8e189ff5aed7d8a7bd890bfde10f19c8683774b8d2bfe8bc55a7a087a51f58d8dadd304e6a1eac9848406ade80e
|
7
|
+
data.tar.gz: c28c1583beab052240c4fe115a1650343d39ada4511eedce726e9e61c57588a6bd2c7a86d6c930fe594226c0390e78b8b73a921bf29f1cd1f16a36ba72d91627
|
data/ext/gpgme/extconf.rb
CHANGED
@@ -62,9 +62,12 @@ EOS
|
|
62
62
|
require 'rubygems'
|
63
63
|
require 'mini_portile2'
|
64
64
|
|
65
|
-
libgpg_error_recipe = MiniPortile.new('libgpg-error', '1.
|
65
|
+
libgpg_error_recipe = MiniPortile.new('libgpg-error', '1.27').tap do |recipe|
|
66
66
|
recipe.target = File.join(ROOT, "ports")
|
67
|
-
recipe.files = [
|
67
|
+
recipe.files = [{
|
68
|
+
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
69
|
+
:sha256 => '4f93aac6fecb7da2b92871bb9ee33032be6a87b174f54abf8ddf0911a22d29d2'
|
70
|
+
}]
|
68
71
|
recipe.configure_options = [
|
69
72
|
'--disable-shared',
|
70
73
|
'--enable-static',
|
@@ -79,9 +82,12 @@ EOS
|
|
79
82
|
recipe.activate
|
80
83
|
end
|
81
84
|
|
82
|
-
libassuan_recipe = MiniPortile.new('libassuan', '2.4.
|
85
|
+
libassuan_recipe = MiniPortile.new('libassuan', '2.4.3').tap do |recipe|
|
83
86
|
recipe.target = File.join(ROOT, "ports")
|
84
|
-
recipe.files = [
|
87
|
+
recipe.files = [{
|
88
|
+
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
89
|
+
:sha256 => '22843a3bdb256f59be49842abf24da76700354293a066d82ade8134bb5aa2b71'
|
90
|
+
}]
|
85
91
|
recipe.configure_options = [
|
86
92
|
'--disable-shared',
|
87
93
|
'--enable-static',
|
@@ -96,9 +102,12 @@ EOS
|
|
96
102
|
recipe.activate
|
97
103
|
end
|
98
104
|
|
99
|
-
gpgme_recipe = MiniPortile.new('gpgme', '1.
|
105
|
+
gpgme_recipe = MiniPortile.new('gpgme', '1.9.0').tap do |recipe|
|
100
106
|
recipe.target = File.join(ROOT, "ports")
|
101
|
-
recipe.files = [
|
107
|
+
recipe.files = [{
|
108
|
+
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
109
|
+
:sha256 => '1b29fedb8bfad775e70eafac5b0590621683b2d9869db994568e6401f4034ceb'
|
110
|
+
}]
|
102
111
|
recipe.configure_options = [
|
103
112
|
'--disable-shared',
|
104
113
|
'--enable-static',
|
data/ext/gpgme/gpgme_n.c
CHANGED
@@ -196,6 +196,53 @@ rb_s_gpgme_set_engine_info (VALUE dummy, VALUE vproto, VALUE vfile_name,
|
|
196
196
|
return LONG2NUM(err);
|
197
197
|
}
|
198
198
|
|
199
|
+
static VALUE
|
200
|
+
rb_s_gpgme_ctx_get_engine_info (VALUE dummy, VALUE vctx, VALUE rinfo)
|
201
|
+
{
|
202
|
+
long idx;
|
203
|
+
|
204
|
+
gpgme_ctx_t ctx;
|
205
|
+
|
206
|
+
UNWRAP_GPGME_CTX(vctx, ctx);
|
207
|
+
if (!ctx)
|
208
|
+
rb_raise (rb_eArgError, "released ctx");
|
209
|
+
|
210
|
+
gpgme_engine_info_t info = gpgme_ctx_get_engine_info (ctx);
|
211
|
+
for (idx = 0; info; info = info->next, idx++)
|
212
|
+
{
|
213
|
+
VALUE vinfo = rb_class_new_instance (0, NULL, cEngineInfo);
|
214
|
+
rb_iv_set (vinfo, "@protocol", INT2FIX(info->protocol));
|
215
|
+
if (info->file_name)
|
216
|
+
rb_iv_set (vinfo, "@file_name", rb_str_new2 (info->file_name));
|
217
|
+
if (info->version)
|
218
|
+
rb_iv_set (vinfo, "@version", rb_str_new2 (info->version));
|
219
|
+
if (info->req_version)
|
220
|
+
rb_iv_set (vinfo, "@req_version", rb_str_new2 (info->req_version));
|
221
|
+
if (info->home_dir)
|
222
|
+
rb_iv_set (vinfo, "@home_dir", rb_str_new2 (info->home_dir));
|
223
|
+
rb_ary_store (rinfo, idx, vinfo);
|
224
|
+
}
|
225
|
+
return Qnil;
|
226
|
+
}
|
227
|
+
|
228
|
+
static VALUE
|
229
|
+
rb_s_gpgme_ctx_set_engine_info (VALUE dummy, VALUE vctx, VALUE vproto, VALUE vfile_name,
|
230
|
+
VALUE vhome_dir)
|
231
|
+
{
|
232
|
+
gpgme_ctx_t ctx;
|
233
|
+
|
234
|
+
UNWRAP_GPGME_CTX(vctx, ctx);
|
235
|
+
if (!ctx)
|
236
|
+
rb_raise (rb_eArgError, "released ctx");
|
237
|
+
gpgme_error_t err = gpgme_ctx_set_engine_info (ctx,
|
238
|
+
NUM2INT(vproto),
|
239
|
+
NIL_P(vfile_name) ? NULL :
|
240
|
+
StringValueCStr(vfile_name),
|
241
|
+
NIL_P(vhome_dir) ? NULL :
|
242
|
+
StringValueCStr(vhome_dir));
|
243
|
+
return LONG2NUM(err);
|
244
|
+
}
|
245
|
+
|
199
246
|
static VALUE
|
200
247
|
rb_s_gpgme_pubkey_algo_name (VALUE dummy, VALUE valgo)
|
201
248
|
{
|
@@ -843,7 +890,13 @@ utf8_str_new (const char *data)
|
|
843
890
|
{
|
844
891
|
VALUE string = rb_str_new2 (data);
|
845
892
|
#ifdef HAVE_RUBY_ENCODING_H
|
893
|
+
/* We assume all the C strings from GPGME are in UTF-8 encoding.
|
894
|
+
If there is any string which cannot be represented in UTF-8,
|
895
|
+
set the string's encoding to ASCII-8BIT and leave the caller to
|
896
|
+
detect the encoding. */
|
846
897
|
rb_enc_associate_index (string, rb_enc_find_index ("UTF-8"));
|
898
|
+
if (rb_enc_str_coderange (string) == ENC_CODERANGE_BROKEN)
|
899
|
+
rb_enc_associate_index (string, rb_enc_find_index ("ASCII-8BIT"));
|
847
900
|
#endif
|
848
901
|
return string;
|
849
902
|
}
|
@@ -2203,7 +2256,10 @@ Init_gpgme_n (void)
|
|
2203
2256
|
rb_s_gpgme_get_engine_info, 1);
|
2204
2257
|
rb_define_module_function (mGPGME, "gpgme_set_engine_info",
|
2205
2258
|
rb_s_gpgme_set_engine_info, 3);
|
2206
|
-
|
2259
|
+
rb_define_module_function (mGPGME, "gpgme_ctx_get_engine_info",
|
2260
|
+
rb_s_gpgme_ctx_get_engine_info, 2);
|
2261
|
+
rb_define_module_function (mGPGME, "gpgme_ctx_set_engine_info",
|
2262
|
+
rb_s_gpgme_ctx_set_engine_info, 4);
|
2207
2263
|
rb_define_module_function (mGPGME, "gpgme_pubkey_algo_name",
|
2208
2264
|
rb_s_gpgme_pubkey_algo_name, 1);
|
2209
2265
|
rb_define_module_function (mGPGME, "gpgme_hash_algo_name",
|
data/lib/gpgme/key_common.rb
CHANGED
@@ -16,10 +16,10 @@ module GPGME
|
|
16
16
|
# +:encrypt+, +:sign+, +:certify+ or +:authenticate+
|
17
17
|
def capability
|
18
18
|
caps = []
|
19
|
-
caps << :encrypt if @can_encrypt
|
20
|
-
caps << :sign if @can_sign
|
21
|
-
caps << :certify if @can_certify
|
22
|
-
caps << :authenticate if @can_authenticate
|
19
|
+
caps << :encrypt if @can_encrypt == 1
|
20
|
+
caps << :sign if @can_sign == 1
|
21
|
+
caps << :certify if @can_certify == 1
|
22
|
+
caps << :authenticate if @can_authenticate == 1
|
23
23
|
caps
|
24
24
|
end
|
25
25
|
|
data/lib/gpgme/sub_key.rb
CHANGED
@@ -30,7 +30,7 @@ module GPGME
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def sha
|
33
|
-
(@
|
33
|
+
(@fpr || @keyid)[-8 .. -1]
|
34
34
|
end
|
35
35
|
|
36
36
|
PUBKEY_ALGO_LETTERS = {
|
@@ -49,7 +49,7 @@ module GPGME
|
|
49
49
|
secret? ? 'ssc' : 'sub',
|
50
50
|
length,
|
51
51
|
pubkey_algo_letter,
|
52
|
-
(@
|
52
|
+
(@fpr || @keyid)[-8 .. -1],
|
53
53
|
timestamp.strftime('%Y-%m-%d'),
|
54
54
|
trust.inspect,
|
55
55
|
capability.inspect)
|
@@ -60,7 +60,7 @@ module GPGME
|
|
60
60
|
secret? ? 'ssc' : 'sub',
|
61
61
|
length,
|
62
62
|
pubkey_algo_letter,
|
63
|
-
(@
|
63
|
+
(@fpr || @keyid)[-8 .. -1],
|
64
64
|
timestamp.strftime('%Y-%m-%d'))
|
65
65
|
end
|
66
66
|
end
|
data/lib/gpgme/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/test/crypto_test.rb
CHANGED
@@ -4,7 +4,7 @@ require 'tempfile'
|
|
4
4
|
|
5
5
|
describe GPGME::Crypto do
|
6
6
|
before do
|
7
|
-
skip unless
|
7
|
+
skip unless ensure_keys GPGME::PROTOCOL_OpenPGP
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "default options functionality" do
|
@@ -43,7 +43,7 @@ describe GPGME::Crypto do
|
|
43
43
|
|
44
44
|
describe :encrypt do
|
45
45
|
it "should raise an error if the recipients aren't trusted" do
|
46
|
-
assert_raises GPGME::Error::
|
46
|
+
assert_raises GPGME::Error::UnusablePublicKey do
|
47
47
|
GPGME::Crypto.new.encrypt TEXT[:plain]
|
48
48
|
end
|
49
49
|
end
|
data/test/ctx_test.rb
CHANGED
data/test/key_test.rb
CHANGED
data/test/signature_test.rb
CHANGED
data/test/sub_key_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -82,12 +82,33 @@ def without_key(key, &block)
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
85
|
+
DIRS = []
|
86
|
+
|
87
|
+
at_exit do
|
88
|
+
DIRS.each do |dir|
|
89
|
+
FileUtils.remove_entry dir
|
90
|
+
end
|
91
|
+
DIRS.clear
|
92
|
+
end
|
93
|
+
|
94
|
+
def ensure_keys(proto)
|
95
|
+
return false unless GPGME::Engine.check_version proto
|
96
|
+
|
97
|
+
case proto
|
98
|
+
when GPGME::PROTOCOL_OpenPGP
|
99
|
+
# We use a different home directory for the keys to not disturb current
|
100
|
+
# installation
|
101
|
+
require 'tmpdir'
|
102
|
+
|
103
|
+
if DIRS.empty?
|
104
|
+
dir = Dir.mktmpdir
|
105
|
+
GPGME::Engine.home_dir = dir
|
106
|
+
DIRS.push(dir)
|
107
|
+
remove_all_keys
|
108
|
+
import_keys
|
109
|
+
end
|
110
|
+
true
|
111
|
+
else
|
112
|
+
return false
|
113
|
+
end
|
93
114
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daiki Ueno
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mini_portile2
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 2.1
|
20
|
+
version: '2.1'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 2.1
|
27
|
+
version: '2.1'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: mocha
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,9 +131,9 @@ files:
|
|
131
131
|
- lib/gpgme/sub_key.rb
|
132
132
|
- lib/gpgme/user_id.rb
|
133
133
|
- lib/gpgme/version.rb
|
134
|
-
- ports/archives/gpgme-1.
|
135
|
-
- ports/archives/libassuan-2.4.
|
136
|
-
- ports/archives/libgpg-error-1.
|
134
|
+
- ports/archives/gpgme-1.9.0.tar.bz2
|
135
|
+
- ports/archives/libassuan-2.4.3.tar.bz2
|
136
|
+
- ports/archives/libgpg-error-1.27.tar.bz2
|
137
137
|
- test/crypto_test.rb
|
138
138
|
- test/ctx_test.rb
|
139
139
|
- test/data_test.rb
|
@@ -166,9 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project: ruby-gpgme
|
169
|
-
rubygems_version: 2.
|
169
|
+
rubygems_version: 2.5.2
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: Ruby binding of GPGME.
|
173
173
|
test_files: []
|
174
|
-
has_rdoc: true
|
Binary file
|
Binary file
|
Binary file
|