Skip to content

Commit

Permalink
mock kdf_opslimit and kdf_memlimit (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
jshawl authored Feb 14, 2024
1 parent b626c50 commit cfc2ec9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 2 additions & 0 deletions spec/minisign/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
p: 'test/minisign.pub',
s: 'test/minisign.key'
}
allow_any_instance_of(Minisign::KeyPair).to receive(:kdf_memlimit_bytes).and_return([0, 0, 0, 0, 0, 0, 0, 0])
allow_any_instance_of(Minisign::KeyPair).to receive(:kdf_opslimit_bytes).and_return([0, 0, 0, 0, 0, 0, 0, 0])
end
it 'does not overwrite existing keys' do
expect do
Expand Down
4 changes: 4 additions & 0 deletions spec/minisign/key_pair_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# frozen_string_literal: true

describe Minisign::KeyPair do
before do
allow_any_instance_of(Minisign::KeyPair).to receive(:kdf_memlimit_bytes).and_return([0, 0, 0, 0, 0, 0, 0, 0])
allow_any_instance_of(Minisign::KeyPair).to receive(:kdf_opslimit_bytes).and_return([0, 0, 0, 0, 0, 0, 0, 0])
end
it 'generates a keypair without a password' do
keypair = Minisign::KeyPair.new
expect(keypair.private_key).to be_truthy
Expand Down
8 changes: 0 additions & 8 deletions spec/minisign/private_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@
190, 222, 200, 51, 166, 7, 25, 89, 5, 225, 56, 170, 157, 127, 219])
end

it 'parses the kdf_opslimit' do
expect(@private_key.instance_variable_get('@kdf_opslimit')).to eq(33_554_432)
end

it 'parses the kdf_memlimit' do
expect(@private_key.instance_variable_get('@kdf_memlimit')).to eq(1_073_741_824)
end

it 'parses the key id' do
expect(@private_key.key_id).to eq([166, 41, 163, 171, 79, 169, 183, 76])
end
Expand Down
2 changes: 1 addition & 1 deletion test/minisign.key
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
untrusted comment: password is "password"
RWRTY0IyEf+yYa5eAX38PgdrI3TMxwy+3sgzpgcZWQXhOKqdf9sAAAACAAAAAAAAAEAAAAAAHe8Olzttgk6k5pZyT3CyCTcTAV0bLN3kq5CUqhLjqSdYZ6oEWs/S7ztaephS+/jwnuOElLBKkg3Sd56jzyvMwL4qStNUTyPDqckNjniw2SlowmHN8n5NnR47gvqjo96E+vakpw8v5PE=
RWRTY0IyEf+yYa5eAX38PgdrI3TMxwy+3sgzpgcZWQXhOKqdf9sAAAAAAAAAAAAAAAAAAAAA/U8DYz0Eko/Szf4bn6ToESk4xYlAhij7j3WcGVJ3zok8moiuxprV/NVcMf6odyCTOV0qY0Qni8OO4jqQ/ZS9c8TzOvRnxbt/zHyoDBA9CbVdBJmb9O1Ap+xKe55Q7AOqM0aWSPwWHjY=

0 comments on commit cfc2ec9

Please sign in to comment.