Skip to content

Commit

Permalink
test: update test setup
Browse files Browse the repository at this point in the history
Now, when the algorithm is `ECDSA`, the `unique` field of the `pubArea`
should include two sized buffers instead of just one.

This commit is based on this commit from `tpm-key_attestation`:
cedarcode/tpm-key_attestation@fd43e5f
  • Loading branch information
nicolastemciuc committed Jan 22, 2025
1 parent a282a5a commit fcf580b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/webauthn/attestation_statement/tpm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@
t_public.alg_type = ::TPM::ALG_ECC
t_public.name_alg = name_alg
t_public.parameters = pub_area_parameters
t_public.unique.buffer = credential_key.public_key.to_bn.to_s(2)[1..-1]

public_key_bytes = credential_key.public_key.to_bn.to_s(2)[1..-1]
coordinate_length = public_key_bytes.size / 2
t_public.unique.x.buffer = public_key_bytes[0..(coordinate_length - 1)]
t_public.unique.y.buffer = public_key_bytes[coordinate_length..-1]

t_public.to_binary_s
end
Expand All @@ -200,7 +204,11 @@
t_public.alg_type = ::TPM::ALG_ECC
t_public.name_alg = name_alg
t_public.parameters = pub_area_parameters
t_public.unique.buffer = create_ec_key.public_key.to_bn.to_s(2)[1..-1]

public_key_bytes = create_ec_key.public_key.to_bn.to_s(2)[1..-1]
coordinate_length = public_key_bytes.size / 2
t_public.unique.x.buffer = public_key_bytes[0..(coordinate_length - 1)]
t_public.unique.y.buffer = public_key_bytes[coordinate_length..-1]

t_public.to_binary_s
end
Expand Down

0 comments on commit fcf580b

Please sign in to comment.