gpgme 2.0.9 → 2.0.10
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 +2 -2
- data/ext/gpgme/gpgme_n.c +109 -0
- data/lib/gpgme/constants.rb +14 -0
- data/lib/gpgme/ctx.rb +37 -0
- data/lib/gpgme/version.rb +1 -1
- data/ports/archives/gpgme-1.6.0.tar.bz2 +0 -0
- data/ports/archives/gpgme-1.6.0.tar.bz2.sig +0 -0
- data/ports/archives/libassuan-2.1.2.tar.bz2 +0 -0
- data/ports/archives/libgpg-error-1.20.tar.bz2 +0 -0
- data/ports/archives/libgpg-error-1.20.tar.bz2.sig +0 -0
- metadata +9 -5
- data/ports/archives/gpgme-1.5.5.tar.bz2 +0 -0
- data/ports/archives/libgpg-error-1.19.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: 4ce47e59e5bd44bbd0317f79a67556f7abc31afd
|
4
|
+
data.tar.gz: aa43c99f2a7e2e1fa09b7a46600755ec7c7d81a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63dd5843ee14da10265d8612215efaa77ca46e27928d04cb5bdef7724f78f039ef6d1ffe27c175669f12860fca5c8cc486709633b26675cae2f78070bd0b94d4
|
7
|
+
data.tar.gz: a4a7395de03e7fdf35d27b3957945970de8f2449fcd9146391fc177456ad6fbc1296cbfbb52851024f5791e48668491e3634482a08cdd41704b2d5ed4108eceb
|
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.20').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 = [
|
@@ -96,7 +96,7 @@ EOS
|
|
96
96
|
recipe.activate
|
97
97
|
end
|
98
98
|
|
99
|
-
gpgme_recipe = MiniPortile.new('gpgme', '1.
|
99
|
+
gpgme_recipe = MiniPortile.new('gpgme', '1.6.0').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
@@ -622,6 +622,54 @@ rb_s_gpgme_get_passphrase_cb (VALUE dummy, VALUE vctx, VALUE rpassfunc,
|
|
622
622
|
return Qnil;
|
623
623
|
}
|
624
624
|
|
625
|
+
#if defined(GPGME_VERSION_NUMBER) && GPGME_VERSION_NUMBER >= 0x010600
|
626
|
+
static gpgme_error_t
|
627
|
+
status_cb (void *hook, const char *keyword, const char *args)
|
628
|
+
{
|
629
|
+
VALUE vcb = (VALUE)hook, vstatusfunc, vhook_value;
|
630
|
+
|
631
|
+
vstatusfunc = RARRAY_PTR(vcb)[0];
|
632
|
+
vhook_value = RARRAY_PTR(vcb)[1];
|
633
|
+
|
634
|
+
rb_funcall (vstatusfunc, rb_intern ("call"), 3,
|
635
|
+
vhook_value,
|
636
|
+
keyword ? rb_str_new2 (keyword) : Qnil,
|
637
|
+
args ? rb_str_new2 (args) : Qnil);
|
638
|
+
return gpgme_err_make (GPG_ERR_SOURCE_USER_1, GPG_ERR_NO_ERROR);
|
639
|
+
}
|
640
|
+
|
641
|
+
static VALUE
|
642
|
+
rb_s_gpgme_set_status_cb (VALUE dummy, VALUE vctx, VALUE vstatusfunc,
|
643
|
+
VALUE vhook_value)
|
644
|
+
{
|
645
|
+
gpgme_ctx_t ctx;
|
646
|
+
VALUE vcb = rb_ary_new ();
|
647
|
+
|
648
|
+
rb_ary_push (vcb, vstatusfunc);
|
649
|
+
rb_ary_push (vcb, vhook_value);
|
650
|
+
/* Keep a reference to avoid GC. */
|
651
|
+
rb_iv_set (vctx, "@status_cb", vcb);
|
652
|
+
|
653
|
+
UNWRAP_GPGME_CTX(vctx, ctx);
|
654
|
+
if (!ctx)
|
655
|
+
rb_raise (rb_eArgError, "released ctx");
|
656
|
+
gpgme_set_status_cb (ctx, status_cb, (void*)vcb);
|
657
|
+
return Qnil;
|
658
|
+
}
|
659
|
+
|
660
|
+
static VALUE
|
661
|
+
rb_s_gpgme_get_status_cb (VALUE dummy, VALUE vctx, VALUE rstatusfunc,
|
662
|
+
VALUE rhook_value)
|
663
|
+
{
|
664
|
+
VALUE vcb = rb_iv_get (vctx, "@status_cb");
|
665
|
+
|
666
|
+
/* No need to call gpgme_get_status_cb. */
|
667
|
+
rb_ary_store (rstatusfunc, 0, RARRAY_PTR(vcb)[0]);
|
668
|
+
rb_ary_store (rhook_value, 0, RARRAY_PTR(vcb)[1]);
|
669
|
+
return Qnil;
|
670
|
+
}
|
671
|
+
#endif
|
672
|
+
|
625
673
|
static void
|
626
674
|
progress_cb (void *hook, const char *what, int type, int current, int total)
|
627
675
|
{
|
@@ -709,6 +757,35 @@ rb_s_gpgme_get_pinentry_mode (VALUE dummy, VALUE vctx)
|
|
709
757
|
}
|
710
758
|
#endif
|
711
759
|
|
760
|
+
#if defined(GPGME_VERSION_NUMBER) && GPGME_VERSION_NUMBER >= 0x010600
|
761
|
+
static VALUE
|
762
|
+
rb_s_gpgme_set_offline (VALUE dummy, VALUE vctx, VALUE vyes)
|
763
|
+
{
|
764
|
+
gpgme_ctx_t ctx;
|
765
|
+
|
766
|
+
UNWRAP_GPGME_CTX(vctx, ctx);
|
767
|
+
if (!ctx)
|
768
|
+
rb_raise (rb_eArgError, "released ctx");
|
769
|
+
|
770
|
+
gpgme_set_offline (ctx, vyes == Qtrue);
|
771
|
+
return Qnil;
|
772
|
+
}
|
773
|
+
|
774
|
+
static VALUE
|
775
|
+
rb_s_gpgme_get_offline (VALUE dummy, VALUE vctx)
|
776
|
+
{
|
777
|
+
gpgme_ctx_t ctx;
|
778
|
+
int yes;
|
779
|
+
|
780
|
+
UNWRAP_GPGME_CTX(vctx, ctx);
|
781
|
+
if (!ctx)
|
782
|
+
rb_raise (rb_eArgError, "released ctx");
|
783
|
+
|
784
|
+
yes = gpgme_get_offline (ctx);
|
785
|
+
return yes ? Qtrue : Qfalse;
|
786
|
+
}
|
787
|
+
#endif
|
788
|
+
|
712
789
|
static VALUE
|
713
790
|
rb_s_gpgme_op_keylist_start (VALUE dummy, VALUE vctx, VALUE vpattern,
|
714
791
|
VALUE vsecret_only)
|
@@ -2246,6 +2323,16 @@ Init_gpgme_n (void)
|
|
2246
2323
|
rb_s_gpgme_get_progress_cb, 3);
|
2247
2324
|
rb_define_module_function (mGPGME, "gpgme_set_locale",
|
2248
2325
|
rb_s_gpgme_set_locale, 3);
|
2326
|
+
#if defined(GPGME_VERSION_NUMBER) && GPGME_VERSION_NUMBER >= 0x010600
|
2327
|
+
rb_define_module_function (mGPGME, "gpgme_set_offline",
|
2328
|
+
rb_s_gpgme_set_offline, 2);
|
2329
|
+
rb_define_module_function (mGPGME, "gpgme_get_offline",
|
2330
|
+
rb_s_gpgme_get_offline, 1);
|
2331
|
+
rb_define_module_function (mGPGME, "gpgme_set_status_cb",
|
2332
|
+
rb_s_gpgme_set_status_cb, 3);
|
2333
|
+
rb_define_module_function (mGPGME, "gpgme_get_status_cb",
|
2334
|
+
rb_s_gpgme_get_status_cb, 3);
|
2335
|
+
#endif
|
2249
2336
|
|
2250
2337
|
/* Key Management */
|
2251
2338
|
rb_define_module_function (mGPGME, "gpgme_op_keylist_start",
|
@@ -2877,4 +2964,26 @@ Init_gpgme_n (void)
|
|
2877
2964
|
rb_define_const (mGPGME, "GPGME_SPAWN_ALLOW_SET_FG",
|
2878
2965
|
INT2FIX(GPGME_SPAWN_ALLOW_SET_FG));
|
2879
2966
|
#endif
|
2967
|
+
|
2968
|
+
/* This flag was added in 1.2.0. */
|
2969
|
+
#ifdef GPGME_EXPORT_MODE_EXTERN
|
2970
|
+
rb_define_const (mGPGME, "GPGME_EXPORT_MODE_EXTERN",
|
2971
|
+
INT2FIX(GPGME_EXPORT_MODE_EXTERN));
|
2972
|
+
#endif
|
2973
|
+
|
2974
|
+
/* This flag was added in 1.3.0. */
|
2975
|
+
#ifdef GPGME_EXPORT_MODE_MINIMAL
|
2976
|
+
rb_define_const (mGPGME, "GPGME_EXPORT_MODE_MINIMAL",
|
2977
|
+
INT2FIX(GPGME_EXPORT_MODE_MINIMAL));
|
2978
|
+
#endif
|
2979
|
+
|
2980
|
+
/* These flags were added in 1.6.0. */
|
2981
|
+
#if defined(GPGME_VERSION_NUMBER) && GPGME_VERSION_NUMBER >= 0x010600
|
2982
|
+
rb_define_const (mGPGME, "GPGME_EXPORT_MODE_SECRET",
|
2983
|
+
INT2FIX(GPGME_EXPORT_MODE_SECRET));
|
2984
|
+
rb_define_const (mGPGME, "GPGME_EXPORT_MODE_RAW",
|
2985
|
+
INT2FIX(GPGME_EXPORT_MODE_RAW));
|
2986
|
+
rb_define_const (mGPGME, "GPGME_EXPORT_MODE_PKCS12",
|
2987
|
+
INT2FIX(GPGME_EXPORT_MODE_PKCS12));
|
2988
|
+
#endif
|
2880
2989
|
}
|
data/lib/gpgme/constants.rb
CHANGED
@@ -236,6 +236,20 @@ module GPGME
|
|
236
236
|
SPAWN_ALLOW_SET_FG = GPGME_SPAWN_ALLOW_SET_FG
|
237
237
|
end
|
238
238
|
|
239
|
+
if defined?(GPGME_EXPORT_MODE_EXTERN)
|
240
|
+
EXPORT_MODE_EXTERN = GPGME_EXPORT_MODE_EXTERN
|
241
|
+
end
|
242
|
+
|
243
|
+
if defined?(GPGME_EXPORT_MODE_MINIMAL)
|
244
|
+
EXPORT_MODE_MINIMAL = GPGME_EXPORT_MODE_MINIMAL
|
245
|
+
end
|
246
|
+
|
247
|
+
if defined?(GPGME_EXPORT_MODE_SECRET)
|
248
|
+
EXPORT_MODE_SECRET = GPGME_EXPORT_MODE_SECRET
|
249
|
+
EXPORT_MODE_RAW = GPGME_EXPORT_MODE_RAW
|
250
|
+
EXPORT_MODE_PKCS12 = GPGME_EXPORT_MODE_PKCS12
|
251
|
+
end
|
252
|
+
|
239
253
|
KEYLIST_MODE_NAMES = {
|
240
254
|
KEYLIST_MODE_LOCAL => :local,
|
241
255
|
KEYLIST_MODE_EXTERN => :extern,
|
data/lib/gpgme/ctx.rb
CHANGED
@@ -23,11 +23,14 @@ module GPGME
|
|
23
23
|
# * +:pinentry_mode+ One of: +PINENTRY_MODE_DEFAULT+,
|
24
24
|
# +PINENTRY_MODE_ASK+, +PINENTRY_MODE_CANCEL+,
|
25
25
|
# +PINENTRY_MODE_ERROR+, or +PINENTRY_MODE_LOOPBACK+.
|
26
|
+
# * +:offline+ if set to true, dirmngr will not contact external services
|
26
27
|
# * +:password+ password of the passphrased password being used.
|
27
28
|
# * +:passphrase_callback+ A callback function. See {#set_passphrase_callback}.
|
28
29
|
# * +:passphrase_callback_value+ An object passed to passphrase_callback.
|
29
30
|
# * +:progress_callback+ A callback function. See {#set_progress_callback}.
|
30
31
|
# * +:progress_callback_value+ An object passed to progress_callback.
|
32
|
+
# * +:status_callback+ A callback function. See {#set_status_callback}.
|
33
|
+
# * +:status_callback_value+ An object passed to status_callback.
|
31
34
|
#
|
32
35
|
# @example
|
33
36
|
# ctx = GPGME::Ctx.new
|
@@ -51,6 +54,7 @@ module GPGME
|
|
51
54
|
ctx.textmode = options[:textmode] if options[:textmode]
|
52
55
|
ctx.keylist_mode = options[:keylist_mode] if options[:keylist_mode]
|
53
56
|
ctx.pinentry_mode = options[:pinentry_mode] if options[:pinentry_mode]
|
57
|
+
ctx.offline = options[:offline] if options[:offline]
|
54
58
|
|
55
59
|
if options[:password]
|
56
60
|
ctx.set_passphrase_callback GPGME::Ctx.method(:pass_function),
|
@@ -65,6 +69,10 @@ module GPGME
|
|
65
69
|
ctx.set_progress_callback options[:progress_callback],
|
66
70
|
options[:progress_callback_value]
|
67
71
|
end
|
72
|
+
if options[:status_callback]
|
73
|
+
ctx.set_status_callback options[:status_callback],
|
74
|
+
options[:status_callback_value]
|
75
|
+
end
|
68
76
|
|
69
77
|
if block_given?
|
70
78
|
begin
|
@@ -153,6 +161,18 @@ module GPGME
|
|
153
161
|
GPGME::gpgme_get_pinentry_mode(self)
|
154
162
|
end
|
155
163
|
|
164
|
+
# Change the default behaviour of the dirmngr that might require
|
165
|
+
# connections to external services.
|
166
|
+
def offline=(mode)
|
167
|
+
GPGME::gpgme_set_offline(self, mode)
|
168
|
+
mode
|
169
|
+
end
|
170
|
+
|
171
|
+
# Return the current offline mode.
|
172
|
+
def offline
|
173
|
+
GPGME::gpgme_get_offline(self)
|
174
|
+
end
|
175
|
+
|
156
176
|
##
|
157
177
|
# Passphrase and progress callbacks
|
158
178
|
##
|
@@ -223,6 +243,23 @@ module GPGME
|
|
223
243
|
end
|
224
244
|
alias set_progress_cb set_progress_callback
|
225
245
|
|
246
|
+
# Set the status callback with given hook value.
|
247
|
+
# +statusfunc+ should respond to +call+ with 3 arguments.
|
248
|
+
#
|
249
|
+
# * +obj+ the parameter +:status_callback_value+ passed when creating
|
250
|
+
# the {GPGME::Ctx} object.
|
251
|
+
# * +keyword+ the name of the status message
|
252
|
+
# * +args+ any arguments for the status message
|
253
|
+
#
|
254
|
+
# def status_function(obj, keyword, args)
|
255
|
+
# $stderr.puts("#{keyword} #{args}")
|
256
|
+
# return 0
|
257
|
+
# end
|
258
|
+
def set_status_callback(statusfunc, hook_value = nil)
|
259
|
+
GPGME::gpgme_set_status_cb(self, statusfunc, hook_value)
|
260
|
+
end
|
261
|
+
alias set_status_cb set_status_callback
|
262
|
+
|
226
263
|
##
|
227
264
|
# Searching and iterating through keys. Used by {GPGME::Key.find}
|
228
265
|
##
|
data/lib/gpgme/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
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.10
|
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: 2015-
|
12
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mini_portile
|
@@ -131,9 +131,12 @@ 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.
|
134
|
+
- ports/archives/gpgme-1.6.0.tar.bz2
|
135
|
+
- ports/archives/gpgme-1.6.0.tar.bz2.sig
|
136
|
+
- ports/archives/libassuan-2.1.2.tar.bz2
|
135
137
|
- ports/archives/libassuan-2.2.1.tar.bz2
|
136
|
-
- ports/archives/libgpg-error-1.
|
138
|
+
- ports/archives/libgpg-error-1.20.tar.bz2
|
139
|
+
- ports/archives/libgpg-error-1.20.tar.bz2.sig
|
137
140
|
- test/crypto_test.rb
|
138
141
|
- test/ctx_test.rb
|
139
142
|
- test/data_test.rb
|
@@ -166,8 +169,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
169
|
version: '0'
|
167
170
|
requirements: []
|
168
171
|
rubyforge_project: ruby-gpgme
|
169
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.4.8
|
170
173
|
signing_key:
|
171
174
|
specification_version: 4
|
172
175
|
summary: Ruby binding of GPGME.
|
173
176
|
test_files: []
|
177
|
+
has_rdoc: true
|
Binary file
|
Binary file
|