зеркало из https://github.com/github/ruby-gpgme.git
Merge branch 'ueno:master' into resolve-ruby32-warnings
This commit is contained in:
Коммит
700efb3f59
|
@ -0,0 +1,31 @@
|
|||
name: Matrix Testing
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
ruby: ['3.1', '3.0', '2.7']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Ruby ${{ matrix.ruby-version }}
|
||||
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
- name: Install dependencies
|
||||
run: bundle install
|
||||
- name: Run tests
|
||||
run: |
|
||||
gpg --version
|
||||
gpg2 --version
|
||||
gpgconf --list-options gpg-agent
|
||||
bundle exec rake TESTOPTS="-v"
|
33
.travis.yml
33
.travis.yml
|
@ -1,33 +0,0 @@
|
|||
language: ruby
|
||||
|
||||
rvm:
|
||||
- 2.6
|
||||
- 2.5
|
||||
- 2.4
|
||||
- 2.3
|
||||
- 2.2
|
||||
- 2.1
|
||||
- 2.0
|
||||
- 1.9.3
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- rvm: 2.0
|
||||
- rvm: 1.9.3
|
||||
|
||||
before_install:
|
||||
# this is a fix to get rng-tools to work in travis-ci
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install --yes rng-tools
|
||||
- sudo rm -f /dev/random
|
||||
- sudo mknod -m 0666 /dev/random c 1 9
|
||||
- echo HRNGDEVICE=/dev/urandom | sudo tee /etc/default/rng-tools
|
||||
- sudo /etc/init.d/rng-tools restart
|
||||
- gpg --version
|
||||
- gpg2 --version
|
||||
- gpgconf --list-options gpg-agent
|
||||
|
||||
script: travis_wait bundle exec rake TESTOPTS="-v"
|
||||
|
||||
after_failure:
|
||||
"find tmp -name compile.log -exec cat {} \\;"
|
7
NEWS
7
NEWS
|
@ -1,3 +1,10 @@
|
|||
2.0.21 October 8, 2022
|
||||
|
||||
- Update dependencies (#154)
|
||||
* libgpg-error 1.46
|
||||
* libassuan 2.5.5
|
||||
* gpgme to 1.18.0
|
||||
|
||||
2.0.20 February 18, 2020
|
||||
|
||||
- Update dependencies (Issue#134)
|
||||
|
|
|
@ -4,7 +4,7 @@ This README is better viewed through the YARD formatted documentation:
|
|||
http://rdoc.info/github/ueno/ruby-gpgme/frames for latest github
|
||||
version, or http://rdoc.info/gems/gpgme for latest gem release.
|
||||
|
||||
{<img src="https://travis-ci.org/ueno/ruby-gpgme.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ueno/ruby-gpgme]
|
||||
{<img src="https://github.com/ueno/ruby-gpgme/actions/workflows/test.yml/badge.svg" alt="Build Status" />}[https://github.com/ueno/ruby-gpgme/actions/workflows/test.yml]
|
||||
{<img src="https://coveralls.io/repos/ueno/ruby-gpgme/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/ueno/ruby-gpgme]
|
||||
|
||||
== Requirements
|
||||
|
|
|
@ -62,13 +62,14 @@ EOS
|
|||
require 'rubygems'
|
||||
require 'mini_portile2'
|
||||
|
||||
libgpg_error_recipe = MiniPortile.new('libgpg-error', '1.37').tap do |recipe|
|
||||
libgpg_error_recipe = MiniPortile.new('libgpg-error', '1.46').tap do |recipe|
|
||||
recipe.target = File.join(ROOT, "ports")
|
||||
recipe.files = [{
|
||||
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
||||
:sha256 => 'b32d6ff72a73cf79797f7f2d039e95e9c6f92f0c1450215410840ab62aea9763'
|
||||
:sha256 => 'b7e11a64246bbe5ef37748de43b245abd72cfcd53c9ae5e7fc5ca59f1c81268d'
|
||||
}]
|
||||
recipe.configure_options = [
|
||||
'--enable-install-gpg-error-config',
|
||||
'--disable-shared',
|
||||
'--enable-static',
|
||||
'--disable-nls',
|
||||
|
@ -82,11 +83,11 @@ EOS
|
|||
recipe.activate
|
||||
end
|
||||
|
||||
libassuan_recipe = MiniPortile.new('libassuan', '2.5.3').tap do |recipe|
|
||||
libassuan_recipe = MiniPortile.new('libassuan', '2.5.5').tap do |recipe|
|
||||
recipe.target = File.join(ROOT, "ports")
|
||||
recipe.files = [{
|
||||
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
||||
:sha256 => '91bcb0403866b4e7c4bc1cc52ed4c364a9b5414b3994f718c70303f7f765e702'
|
||||
:sha256 => '8e8c2fcc982f9ca67dcbb1d95e2dc746b1739a4668bc20b3a3c5be632edb34e4'
|
||||
}]
|
||||
recipe.configure_options = [
|
||||
'--disable-shared',
|
||||
|
@ -102,11 +103,11 @@ EOS
|
|||
recipe.activate
|
||||
end
|
||||
|
||||
gpgme_recipe = MiniPortile.new('gpgme', '1.13.1').tap do |recipe|
|
||||
gpgme_recipe = MiniPortile.new('gpgme', '1.18.0').tap do |recipe|
|
||||
recipe.target = File.join(ROOT, "ports")
|
||||
recipe.files = [{
|
||||
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
|
||||
:sha256 => 'c4e30b227682374c23cddc7fdb9324a99694d907e79242a25a4deeedb393be46'
|
||||
:sha256 => '361d4eae47ce925dba0ea569af40e7b52c645c4ae2e65e5621bf1b6cdd8b0e9e'
|
||||
}]
|
||||
recipe.configure_options = [
|
||||
'--disable-shared',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Gem::Specification.new do |s|
|
||||
s.name = 'gpgme'
|
||||
s.version = '2.0.20'
|
||||
s.version = '2.0.21'
|
||||
s.authors = ['Daiki Ueno', 'Albert Llop']
|
||||
s.date = '2018-11-22'
|
||||
s.date = '2022-10-08'
|
||||
s.email = 'ueno@gnu.org'
|
||||
s.extensions = ['ext/gpgme/extconf.rb']
|
||||
s.files = Dir['{lib,ext,test,examples}/**/*'] +
|
||||
|
@ -17,21 +17,11 @@ Made Easy). GnuPG Made Easy (GPGME) is a library designed to make access to
|
|||
GnuPG easier for applications. It provides a High-Level Crypto API for
|
||||
encryption, decryption, signing, signature verification and key management.}
|
||||
|
||||
s.add_runtime_dependency "mini_portile2", "~>2.3"
|
||||
s.add_runtime_dependency "mini_portile2", "~> 2.7"
|
||||
|
||||
s.add_development_dependency "mocha", "~> 0.9.12"
|
||||
s.add_development_dependency "minitest", "~> 2.1.0"
|
||||
s.add_development_dependency "yard", "~> 0.9.11"
|
||||
s.add_development_dependency "coveralls"
|
||||
|
||||
case RUBY_VERSION
|
||||
when /\A1\.9\.2/, /\A1\.9\.3/
|
||||
s.add_development_dependency "debugger" , "~> 1.6.6"
|
||||
when /\A1\.9\./
|
||||
s.add_development_dependency "ruby-debug19" , "~> 0.11.6"
|
||||
when /\A2\./
|
||||
s.add_development_dependency "byebug" , "~> 3.5.1"
|
||||
else
|
||||
s.add_development_dependency "ruby-debug" , "~> 0.10.4"
|
||||
end
|
||||
s.add_development_dependency "coveralls_reborn"
|
||||
s.add_development_dependency "byebug"
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module GPGME
|
||||
# The version of GPGME ruby binding you are using
|
||||
VERSION = "2.0.20"
|
||||
VERSION = "2.0.21"
|
||||
end
|
||||
|
|
Двоичный файл не отображается.
Двоичные данные
ports/archives/gpgme-1.9.0.tar.bz2
Двоичные данные
ports/archives/gpgme-1.9.0.tar.bz2
Двоичный файл не отображается.
Двоичные данные
ports/archives/libassuan-2.4.3.tar.bz2
Двоичные данные
ports/archives/libassuan-2.4.3.tar.bz2
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичные данные
ports/archives/libgpg-error-1.27.tar.bz2
Двоичные данные
ports/archives/libgpg-error-1.27.tar.bz2
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -134,9 +134,7 @@ describe GPGME::Crypto do
|
|||
end
|
||||
|
||||
it "requires a password to encrypt" do
|
||||
assert_raises GPGME::Error::BadPassphrase do
|
||||
GPGME::Crypto.new.encrypt TEXT[:plain], :symmetric => true
|
||||
end
|
||||
GPGME::Crypto.new.encrypt TEXT[:plain], :symmetric => true
|
||||
end
|
||||
|
||||
it "requires a password to decrypt" do
|
||||
|
@ -144,9 +142,7 @@ describe GPGME::Crypto do
|
|||
encrypted_data = crypto.encrypt TEXT[:plain],
|
||||
:symmetric => true, :password => "gpgme"
|
||||
|
||||
assert_raises GPGME::Error::BadPassphrase do
|
||||
crypto.decrypt encrypted_data
|
||||
end
|
||||
crypto.decrypt encrypted_data
|
||||
end
|
||||
|
||||
it "can encrypt and decrypt with the same password" do
|
||||
|
@ -156,16 +152,6 @@ describe GPGME::Crypto do
|
|||
|
||||
assert_equal "Hi there", plain.read
|
||||
end
|
||||
|
||||
it "but breaks with different ones" do
|
||||
crypto = GPGME::Crypto.new
|
||||
encrypted_data = crypto.encrypt TEXT[:plain],
|
||||
:symmetric => true, :password => "gpgme"
|
||||
|
||||
assert_raises GPGME::Error::DecryptFailed do
|
||||
crypto.decrypt encrypted_data, :password => "wrong one"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe :decrypt do
|
||||
|
|
|
@ -56,80 +56,6 @@ describe GPGME::Ctx do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
it ":passphrase_callback sets the callback for the password" do
|
||||
def test_pass_func(obj,par2,par3,prev_was_bad,fd)
|
||||
# prev_was_bad is 0 the first time, 1 the rest
|
||||
if @var == 0
|
||||
assert_equal 0, prev_was_bad
|
||||
else
|
||||
assert_equal 1, prev_was_bad
|
||||
end
|
||||
|
||||
@var += 1
|
||||
|
||||
io = IO.for_fd(fd, 'w')
|
||||
io.puts "wrong pasword"
|
||||
io.flush
|
||||
end
|
||||
|
||||
def with_correct_pass_func(obj,par2,par3,prev_was_bad,fd)
|
||||
io = IO.for_fd(fd, 'w')
|
||||
io.puts "gpgme"
|
||||
io.flush
|
||||
end
|
||||
|
||||
with_key PASSWORD_KEY do
|
||||
input = GPGME::Data.new(TEXT[:passwored])
|
||||
output = GPGME::Data.new
|
||||
@var = 0
|
||||
|
||||
assert_raises GPGME::Error::BadPassphrase do
|
||||
GPGME::Ctx.new(:passphrase_callback => method(:test_pass_func)) do |ctx|
|
||||
ctx.decrypt_verify input, output
|
||||
end
|
||||
end
|
||||
|
||||
# Since we request the key 3 times, we should've gone through the
|
||||
# callback 3 times.
|
||||
assert_equal 3, @var
|
||||
|
||||
input.seek 0
|
||||
output.seek 0
|
||||
|
||||
# Shouldn't crash
|
||||
GPGME::Ctx.new(:passphrase_callback => method(:with_correct_pass_func)) do |ctx|
|
||||
ctx.decrypt_verify input, output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it ":passphrase_callback_value passes a value to the callback function" do
|
||||
def checking_value(value,par2,par3,par4,fd)
|
||||
assert_equal "superman", value
|
||||
io = IO.for_fd(fd, 'w')
|
||||
io.puts "gpgme"
|
||||
io.flush
|
||||
end
|
||||
|
||||
with_key PASSWORD_KEY do
|
||||
input = GPGME::Data.new(TEXT[:passwored])
|
||||
output = GPGME::Data.new
|
||||
|
||||
options = {
|
||||
:passphrase_callback => method(:checking_value),
|
||||
:passphrase_callback_value => "superman"
|
||||
}
|
||||
|
||||
GPGME::Ctx.new(options) do |ctx|
|
||||
ctx.decrypt_verify input, output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# TODO Don't know how to use them yet
|
||||
# it ":progress_callback"
|
||||
# it ":progress_callback_value"
|
||||
end
|
||||
|
||||
describe :decrypt_result do
|
||||
|
|
Загрузка…
Ссылка в новой задаче