Fix Ed25519 signature: use standard mode, not prehashed
EdDSAEngine(MessageDigest) is for Ed25519ph (prehashed mode). Standard Ed25519 requires EdDSAEngine() with no arguments.
This commit is contained in:
parent
56120a9b6b
commit
94f1da3ff1
|
|
@ -101,8 +101,8 @@ class DeviceIdentity(context: Context) {
|
||||||
val privateKeySpec = EdDSAPrivateKeySpec(privateKeyBytes, ed25519Spec)
|
val privateKeySpec = EdDSAPrivateKeySpec(privateKeyBytes, ed25519Spec)
|
||||||
val privateKey = EdDSAPrivateKey(privateKeySpec)
|
val privateKey = EdDSAPrivateKey(privateKeySpec)
|
||||||
|
|
||||||
// Sign the payload
|
// Sign the payload using standard Ed25519 (not prehashed Ed25519ph)
|
||||||
val signature = EdDSAEngine(MessageDigest.getInstance(ed25519Spec.hashAlgorithm)).apply {
|
val signature = EdDSAEngine().apply {
|
||||||
initSign(privateKey)
|
initSign(privateKey)
|
||||||
update(payload.toByteArray(Charsets.UTF_8))
|
update(payload.toByteArray(Charsets.UTF_8))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue