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 privateKey = EdDSAPrivateKey(privateKeySpec)
|
||||
|
||||
// Sign the payload
|
||||
val signature = EdDSAEngine(MessageDigest.getInstance(ed25519Spec.hashAlgorithm)).apply {
|
||||
// Sign the payload using standard Ed25519 (not prehashed Ed25519ph)
|
||||
val signature = EdDSAEngine().apply {
|
||||
initSign(privateKey)
|
||||
update(payload.toByteArray(Charsets.UTF_8))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue