I am trying to implement EDDSA signature with Luna HSM(Gemalto)
Signature signature = null;
signature = Signature.getInstance("EDDSA", "LunaProvider");
PrivateKey privateKey = getPrivateByAlias(privateKeyLabel);
signature.initSign(privateKey);
signature.update(payload);
byte[] byteArray = signature.sign();
But after the signing, the byteArray size is coming as 71, but EDDSA signature size is 64 as per specification. I am not sure what i am missing here. I couldn't find any document either online.
This is exactly a size you would expect for an X9.63 compatible signature, which consists of a DER encoding of two signed big endian integers. If you want to have a 64 byte signature then you should convert the 2 integers inside using the following explanation. An implementation in Java of I2OSP and OS2IP can be found here.
So the steps are:
BigInteger
values using the new BigInteger(byte[])
constructor;