gpgme 2.0.26 → 2.0.27

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fe08b2c986a5e8b47b37c96aec3bca4a490ae41ec56d8b596746e3392632e11
4
- data.tar.gz: 15191272b4aefcf3df3cfec3d2bccc51eb41863036e8e746bf68a22f6c22e323
3
+ metadata.gz: '093297484bc11143d4e8975436edf17204eeb030977cd8d2574c1c243d3e5141'
4
+ data.tar.gz: 40eace30d5728a62fc95ca9f2f5d573cf300fc41c3fcf130e2bfd361dbb1b0f3
5
5
  SHA512:
6
- metadata.gz: fa950f73817ce3afce83d1f0d2fb5ef9c2d1dc7a251f12376c079ef6b685f8d7b83f5242df381b1cac3632e5aa4946f8eb38947ad3d3e1b64ee24b7ddc2c6a5a
7
- data.tar.gz: a77cf22e0fc1c41936c537a3a47a4c651ec1f8b2d7e9a8a0708d99ffc011b887b339cc57ecf82114370f3a644ce27eb6e6e4483e5277db8af03dc05d89dc854e
6
+ metadata.gz: d819decb7dcfb09954abadedb48c05d6930b8581d8dc6cd4ba1fffbec8e732289b8765918eedd8c0881e0ef2875f465de7df24824b3f210585458fda8f3f3650
7
+ data.tar.gz: b69af5dccc9e681a0d6c931ee1f6ab3e94a686457c73cd772c6b5d08bf70753fb6f585c57895275d0ad640040a7eacac0f1ab066a1a6c345d2424c11c80d45a5
data/ext/gpgme/extconf.rb CHANGED
@@ -116,11 +116,11 @@ EOS
116
116
  # if PKG_CONFIG_PATH is not set properly.
117
117
  ENV["PKG_CONFIG_PATH"] = [*pkg_config_paths, ENV["PKG_CONFIG_PATH"]].compact.join(File::PATH_SEPARATOR)
118
118
 
119
- gpgme_recipe = MiniPortile.new('gpgme', '2.0.0').tap do |recipe|
119
+ gpgme_recipe = MiniPortile.new('gpgme', '2.3.1').tap do |recipe|
120
120
  recipe.target = File.join(ROOT, "ports")
121
121
  recipe.files = [{
122
122
  :url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
123
- :sha256 => 'ddf161d3c41ff6a3fcbaf4be6c6e305ca4ef1cc3f1ecdfce0c8c2a167c0cc36d'
123
+ :sha256 => '2bf94e0e677e5a8fc31f79dd323f91c5416b36fb851058bc1e8bce39f2642434'
124
124
  }]
125
125
  recipe.configure_options = [
126
126
  '--disable-shared',
@@ -9,12 +9,10 @@ module GPGME
9
9
  end
10
10
 
11
11
  def write(hook, buffer, length)
12
- data = buffer[0 .. length]
13
- # Handle encoding conversion if the IO has a different encoding
14
- if @io.respond_to?(:external_encoding) && @io.external_encoding
15
- data = data.encode(@io.external_encoding, invalid: :replace, undef: :replace)
16
- end
17
- @io.write(data)
12
+ # GPGME output can be arbitrary binary data (for example, an OpenPGP
13
+ # message). Do not transcode it to the IO's encoding: conversion can
14
+ # replace invalid byte sequences and corrupt the output.
15
+ @io.write(buffer.byteslice(0, length))
18
16
  end
19
17
 
20
18
  def seek(hook, offset, whence)
data/lib/gpgme/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module GPGME
2
2
  # The version of GPGME ruby binding you are using
3
- VERSION = "2.0.26"
3
+ VERSION = "2.0.27"
4
4
  end
Binary file
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  require 'test_helper'
3
3
  require 'stringio'
4
+ require 'tempfile'
4
5
 
5
6
  describe GPGME::IOCallbacks do
6
7
  describe "encoding handling" do
@@ -43,21 +44,16 @@ describe GPGME::IOCallbacks do
43
44
  assert_equal "Hello World", io.read
44
45
  end
45
46
 
46
- it "replaces invalid characters when converting encodings" do
47
+ it "preserves invalid UTF-8 bytes when writing to a binary IO" do
47
48
  io = StringIO.new
48
- io.set_encoding(Encoding::UTF_8)
49
+ io.set_encoding(Encoding::ASCII_8BIT)
49
50
  callbacks = GPGME::IOCallbacks.new(io)
50
51
 
51
- # Invalid UTF-8 sequence in ASCII-8BIT string
52
- invalid_data = "Hello\xC3\x28World".b
52
+ invalid_data = "Hello\xC3\x28World".dup.force_encoding(Encoding::UTF_8)
53
53
 
54
- # Should not raise, should replace invalid chars
55
54
  callbacks.write(nil, invalid_data, invalid_data.bytesize)
56
55
  io.rewind
57
- result = io.read
58
- # The invalid sequence should be replaced
59
- refute_nil result
60
- assert result.valid_encoding?
56
+ assert_equal invalid_data.bytes, io.read.bytes
61
57
  end
62
58
 
63
59
  it "reads data from IO" do
@@ -133,6 +129,29 @@ describe GPGME::IOCallbacks do
133
129
  result.force_encoding(Encoding::UTF_8)
134
130
  assert_equal utf8_text, result
135
131
  end
132
+
133
+ it "preserves encrypted output when default internal encoding is UTF-8" do
134
+ original_internal = Encoding.default_internal
135
+ output = Tempfile.new('gpgme-ciphertext')
136
+ output.binmode
137
+ plaintext = 'encryption output must remain binary-safe'
138
+
139
+ begin
140
+ Encoding.default_internal = Encoding::UTF_8
141
+
142
+ crypto = GPGME::Crypto.new(always_trust: true)
143
+ crypto.encrypt(plaintext, recipients: KEYS.first[:sha], output: output)
144
+ output.close
145
+
146
+ ciphertext = File.binread(output.path)
147
+ refute_empty ciphertext
148
+ assert_equal 0x80, ciphertext.getbyte(0) & 0x80
149
+ ensure
150
+ output.close unless output.closed?
151
+ output.unlink
152
+ Encoding.default_internal = original_internal
153
+ end
154
+ end
136
155
  end
137
156
 
138
157
  describe "default internal encoding support" do
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpgme
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.26
4
+ version: 2.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daiki Ueno
8
8
  - Albert Llop
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2025-07-26 00:00:00.000000000 Z
12
+ date: 2026-11-23 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: mini_portile2
@@ -130,7 +131,7 @@ files:
130
131
  - lib/gpgme/sub_key.rb
131
132
  - lib/gpgme/user_id.rb
132
133
  - lib/gpgme/version.rb
133
- - ports/archives/gpgme-2.0.0.tar.bz2
134
+ - ports/archives/gpgme-2.3.1.tar.bz2
134
135
  - ports/archives/libassuan-3.0.2.tar.bz2
135
136
  - ports/archives/libgpg-error-1.55.tar.bz2
136
137
  - test/crypto_test.rb
@@ -152,6 +153,7 @@ homepage: http://github.com/ueno/ruby-gpgme
152
153
  licenses:
153
154
  - LGPL-2.1+
154
155
  metadata: {}
156
+ post_install_message:
155
157
  rdoc_options: []
156
158
  require_paths:
157
159
  - lib
@@ -167,7 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
169
  - !ruby/object:Gem::Version
168
170
  version: '0'
169
171
  requirements: []
170
- rubygems_version: 3.7.2
172
+ rubygems_version: 3.0.3.1
173
+ signing_key:
171
174
  specification_version: 4
172
175
  summary: Ruby binding of GPGME.
173
176
  test_files: []
Binary file