Add poor man’s ASN1 parsing
This commit is contained in:
parent
bef9f9e361
commit
e16cb731c5
4 changed files with 45 additions and 1 deletions
19
spec/lib/asn1/timestamp_spec.rb
Normal file
19
spec/lib/asn1/timestamp_spec.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ASN1::Timestamp do
|
||||
let(:asn1timestamp) { File.read('spec/fixtures/files/bill_signature/signature.der') }
|
||||
|
||||
describe '.timestamp_time' do
|
||||
subject { described_class.signature_time(asn1timestamp) }
|
||||
|
||||
it { is_expected.to eq Time.zone.parse('2019-04-30 15:30:20 UTC') }
|
||||
end
|
||||
|
||||
describe '.timestamp_signed_data' do
|
||||
subject { described_class.signed_digest(asn1timestamp) }
|
||||
|
||||
let(:data) { Digest::SHA256.hexdigest('CECI EST UN BLOB') }
|
||||
|
||||
it { is_expected.to eq data }
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue