diff --git a/spec/webauthn/attestation_statement/packed_spec.rb b/spec/webauthn/attestation_statement/packed_spec.rb index cc62bb2a..ed242b66 100644 --- a/spec/webauthn/attestation_statement/packed_spec.rb +++ b/spec/webauthn/attestation_statement/packed_spec.rb @@ -90,7 +90,6 @@ let(:algorithm) { -7 } let(:attestation_key) { create_ec_key } let(:signature) { attestation_key.sign("SHA256", to_be_signed) } - let(:attestation_certificate_version) { 2 } let(:attestation_certificate_subject) { "/C=UY/O=ACME/OU=Authenticator Attestation/CN=CN" } let(:attestation_certificate_basic_constraints) { "CA:FALSE" } let(:attestation_certificate_start_time) { Time.now - 1 } @@ -103,7 +102,7 @@ root_certificate, root_key, attestation_key, - version: attestation_certificate_version, + version: 2, name: attestation_certificate_subject, not_before: attestation_certificate_start_time, not_after: attestation_certificate_end_time, @@ -187,7 +186,9 @@ context "when the attestation certificate doesn't meet requirements" do context "because version is invalid" do - let(:attestation_certificate_version) { 1 } + before do + attestation_certificate.version = 1 + end it "fails" do expect(statement.valid?(authenticator_data, client_data_hash)).to be_falsy diff --git a/spec/webauthn/attestation_statement/tpm_spec.rb b/spec/webauthn/attestation_statement/tpm_spec.rb index 4340a8b9..169f4f51 100644 --- a/spec/webauthn/attestation_statement/tpm_spec.rb +++ b/spec/webauthn/attestation_statement/tpm_spec.rb @@ -36,7 +36,7 @@ root_certificate, root_key, aik, - version: aik_certificate_version, + version: 2, name: aik_certificate_subject, not_before: aik_certificate_start_time, not_after: aik_certificate_end_time, @@ -49,7 +49,6 @@ end let(:aik) { create_rsa_key } - let(:aik_certificate_version) { 2 } let(:aik_certificate_subject) { "" } let(:aik_certificate_basic_constraints) { "CA:FALSE" } let(:aik_certificate_extended_key_usage) { ::TPM::AIKCertificate::OID_TCG_KP_AIK_CERTIFICATE } @@ -361,7 +360,9 @@ context "when the AIK certificate doesn't meet requirements" do context "because version is invalid" do - let(:aik_certificate_version) { 1 } + before do + aik_certificate.version = 1 + end it "returns false" do expect(statement.valid?(authenticator_data, client_data_hash)).to be_falsy