2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-05-14 15:19:25 +02:00
|
|
|
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) }
|
|
|
|
|
2022-12-06 11:59:09 +01:00
|
|
|
it { is_expected.to eq Time.zone.parse('2022-12-06 09:11:17Z') }
|
2019-05-14 15:19:25 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '.timestamp_signed_data' do
|
|
|
|
subject { described_class.signed_digest(asn1timestamp) }
|
|
|
|
|
2022-12-06 11:59:09 +01:00
|
|
|
let(:data) { Digest::SHA256.hexdigest('{"1":"hash1","2":"hash2"}') }
|
2019-05-14 15:19:25 +02:00
|
|
|
|
|
|
|
it { is_expected.to eq data }
|
|
|
|
end
|
|
|
|
end
|