-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Minisign.rb | ||
# Minisign | ||
|
||
A rubygem for verifying [Minisign](http://jedisct1.github.io/minisign/) signatures. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
describe Minisign::PublicKey do | ||
before do | ||
@pk = Minisign::PublicKey.new(File.read('test/local.pub').split("\n").pop) | ||
@message = File.read('test/example.txt') | ||
end | ||
it 'verifies signatures' do | ||
@signature = Minisign::Signature.new(File.read('test/example.txt.minisig')) | ||
expect(@pk.verify(@signature, @message)).to match('Trusted comment') | ||
end | ||
it 'raises ed25519 errors' do | ||
@signature = Minisign::Signature.new(File.read('test/example.txt.minisig.unverifiable')) | ||
expect { @pk.verify(@signature, @message) }.to raise_error(Ed25519::VerifyError) | ||
end | ||
it 'verifies trusted comments' do | ||
@signature = Minisign::Signature.new(File.read('test/example.txt.minisig.tampered')) | ||
expect { @pk.verify(@signature, @message) }.to raise_error('Comment signature verification failed') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'simplecov' | ||
SimpleCov.start do | ||
add_filter '/spec' | ||
end | ||
|
||
require 'minisign' | ||
|
||
RSpec.configure do |config| | ||
config.expect_with :rspec do |expectations| | ||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true | ||
end | ||
config.mock_with :rspec do |mocks| | ||
mocks.verify_partial_doubles = true | ||
end | ||
config.shared_context_metadata_behavior = :apply_to_host_groups | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
untrusted comment: signature from minisign secret key | ||
RUTg6JXWzv6GDmPMFIE8V3D+S6mi6FBFrUNwvRVZrLNrySSWT8HPLXhN16nSzb3WLTSd59SceVfGtgEP2FMHVAqTc40mLXBbJQ4= | ||
trusted comment: timestamp:1653934367 file:example.txt hashed | ||
YU7xAGNcc5LGLHHyw14S6xtIvhfF3chGJ/rLSauaiPb1jtnt6JHB/ieMIjqEZ8unxxLllXQ2t6uQqzIKsiwAAg== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
untrusted comment: signature from minisign secret key | ||
RUTg6JXWzv6GDmPMFIE8V3D+S5mi6FBFrUNwvRVZrLNrySSWT8HPLXhN16nSzb3WLTSd59SceVfGtgEP2FMHVAqTc40mLXBbJQ4= | ||
trusted comment: timestamp:1653934067 file:example.txt hashed | ||
YU7xAGNcc5LGLHHyw14S6xtIvhfF3chGJ/rLSauaiPb1jtnt6JHB/ieMIjqEZ8unxxLllXQ2t6uQqzIKsiwAAg== |