Source:
<code>public void testAuthenticateEdDsa() throws Exception { byte[] challenge = "dies ist ein challenge ☭".getBytes(); byte[] signature; KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application); long masterKeyId = mStaticRingEdDsa.getMasterKeyId(); Long authSubKeyId = keyRepository.getCachedPublicKeyRing(masterKeyId).getSecretAuthenticationId(); { AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.application, keyRepository); AuthenticationData.Builder authData = AuthenticationData.builder(); authData.setAuthenticationMasterKeyId(masterKeyId); authData.setAuthenticationSubKeyId(authSubKeyId); authData.setHashAlgorithm(HashAlgorithmTags.SHA512); AuthenticationParcel authenticationParcel = AuthenticationParcel .createAuthenticationParcel(authData.build(), challenge); CryptoInputParcel inputParcel = CryptoInputParcel.createCryptoInputParcel(); inputParcel = inputParcel.withPassphrase(mKeyPhrase); AuthenticationResult result = op.execute(authData.build(), inputParcel, authenticationParcel); Assert.assertTrue("authentication must succeed", result.success()); signature = result.getSignature(); } { CanonicalizedPublicKey canonicalizedPublicKey = keyRepository.getCanonicalizedPublicKeyRing(masterKeyId) .getPublicKey(authSubKeyId); PublicKey publicKey = canonicalizedPublicKey.getJcaPublicKey(); EdDSAEngine engine = new EdDSAEngine(MessageDigest.getInstance("SHA-512")); engine.initVerify(publicKey); engine.setParameter(EdDSAEngine.ONE_SHOT_MODE); <START> engine.update(challenge); <END> boolean isSignatureValid = engine.verify(signature); Assert.assertTrue("signature must be valid", isSignatureValid); } }</code><technical_language>EdDSA is parametrized a hashing algorithm, other (most?) signature schemes arbitrary input, fixed length. This led some confusion for well, interface inconsistent - JCA assumes signing algorithms paired hashing algos, for a generic interface assume fixed length. A simple eddsa sha512 parametrization is more equivalent "RSAwithNONE" "RSAwithSHA512", in openpgp context was</technical_language>

Target:
public void testAuthenticateEdDsa() throws Exception { byte[] challenge = "dies ist ein challenge ☭".getBytes(); byte[] signature; KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application); long masterKeyId = mStaticRingEdDsa.getMasterKeyId(); Long authSubKeyId = keyRepository.getCachedPublicKeyRing(masterKeyId).getSecretAuthenticationId(); { AuthenticationOperation op = new AuthenticationOperation(RuntimeEnvironment.application, keyRepository); AuthenticationData.Builder authData = AuthenticationData.builder(); authData.setAuthenticationMasterKeyId(masterKeyId); authData.setAuthenticationSubKeyId(authSubKeyId); authData.setHashAlgorithm(HashAlgorithmTags.SHA512); AuthenticationParcel authenticationParcel = AuthenticationParcel .createAuthenticationParcel(authData.build(), challenge); CryptoInputParcel inputParcel = CryptoInputParcel.createCryptoInputParcel(); inputParcel = inputParcel.withPassphrase(mKeyPhrase); AuthenticationResult result = op.execute(authData.build(), inputParcel, authenticationParcel); Assert.assertTrue("authentication must succeed", result.success()); signature = result.getSignature(); } { CanonicalizedPublicKey canonicalizedPublicKey = keyRepository.getCanonicalizedPublicKeyRing(masterKeyId) .getPublicKey(authSubKeyId); PublicKey publicKey = canonicalizedPublicKey.getJcaPublicKey(); EdDSAParameterSpec spec = EdDSANamedCurveTable.getByName("Ed25519"); Signature signatureVerifier = new EdDSAEngine(MessageDigest.getInstance(spec.getHashAlgorithm())); signatureVerifier.setParameter(EdDSAEngine.ONE_SHOT_MODE); signatureVerifier.initVerify(publicKey); signatureVerifier.update(challenge); boolean isSignatureValid = signatureVerifier.verify(signature); Assert.assertTrue("signature must be valid", isSignatureValid); } }