On 8/31/20 8:16 AM, Anders Rundgren wrote:
On
https://tools.ietf.org/html/rfc8032#page-24
you can find test vectors that are also used by rfc8037 (JOSE).
However, there seems to be no information on how to create an EdDSA
public key from such a vector.
Apparently you must be an expert on the inner workings of EdDSA in order
to use this API.
I have though managed(...) but 1) it looks strange 2) it may be incorrect.
Steps
1. Convert the hex-code to a byte[] array.
2. Reverse (!) all the bytes in the byte[] array.
3. publicKey = kf.generatePublic(
new EdECPublicKeySpec(new NamedParameterSpec(alg),
new EdECPoint(false, new
BigInteger(1, theByteArray))));
Ideally, EdECPoint should have an constructor that does whatever it
takes based on a byte[] array.
It is equally fuzzy in the other direction. A "getByteArray()" on
EdECPoint had been great.
Thanx,
Anders
Hi,
It does seem like a constructor and/or helper methods would be a good
addition. I filed a bug to track this:
https://bugs.openjdk.java.net/browse/JDK-8252595
thanks
Tony