Ed25519PrivateKeyManager extends PrivateKeyTypeManager<Ed25519PrivateKey, Ed25519PublicKey> { @Override public Ed25519PublicKey getPublicKey(Ed25519PrivateKey key) throws GeneralSecurityException { return key.getPublicKey(); } Ed25519PrivateKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override Ed25519PublicKey getPublicKey(Ed25519PrivateKey key); @Override KeyMaterialType keyMaterialType(); @Override Ed25519PrivateKey parseKey(ByteString byteString); @Override void validateKey(Ed25519PrivateKey keyProto); @Override KeyFactory<Ed25519KeyFormat, Ed25519PrivateKey> keyFactory(); static void registerPair(boolean newKeyAllowed); static final KeyTemplate ed25519Template(); static final KeyTemplate rawEd25519Template();  }
@Test public void getPublicKey_checkValues() throws Exception { Ed25519PrivateKey privateKey = factory.createKey(Ed25519KeyFormat.getDefaultInstance()); Ed25519PublicKey publicKey = manager.getPublicKey(privateKey); assertThat(publicKey).isEqualTo(privateKey.getPublicKey()); }
@Test public void createPrimitive() throws Exception { Ed25519PrivateKey privateKey = factory.createKey(Ed25519KeyFormat.getDefaultInstance()); PublicKeySign signer = manager.getPrimitive(privateKey, PublicKeySign.class); PublicKeyVerify verifier = new Ed25519Verify(privateKey.getPublicKey().getKeyValue().toByteArray()); byte[] message = Random.randBytes(135); verifier.verify(signer.sign(message), message); }