Roger Lipscombe
2021-05-20 15:26:49 UTC
The following snippet...
[] = lists:foldl(fun(_, Acc) ->
Key = public_key:generate_key({namedCurve, secp256r1}),
{'ECPrivateKey', 1, PrivateKey, _Parameters, _PublicKey} = Key,
case byte_size(PrivateKey) of
32 -> Acc;
_ -> [Key | Acc]
end
end, [], lists:seq(1, 10_000)).
...fails.
secp256r1 private keys should be 32-bytes long, afaict. Should OTP be
zero-prefixing the key when converting to binary?
[] = lists:foldl(fun(_, Acc) ->
Key = public_key:generate_key({namedCurve, secp256r1}),
{'ECPrivateKey', 1, PrivateKey, _Parameters, _PublicKey} = Key,
case byte_size(PrivateKey) of
32 -> Acc;
_ -> [Key | Acc]
end
end, [], lists:seq(1, 10_000)).
...fails.
secp256r1 private keys should be 32-bytes long, afaict. Should OTP be
zero-prefixing the key when converting to binary?