@Test
public void getPublicKeyData_invalidPrivateKey_throws() throws Exception {

  TestPrivateKeyTypeManager privateManager = new TestPrivateKeyTypeManager();
  TestPublicKeyTypeManager publicManager = new TestPublicKeyTypeManager();
  PrivateKeyManager<Void> manager =
      new PrivateKeyManagerImpl<>(privateManager, publicManager, Void.class);
  Ed25519PrivateKey privateKey =
      Ed25519PrivateKey.newBuilder()
          .setPublicKey(
              Ed25519PublicKey.newBuilder()
                  .setKeyValue(ByteString.copyFrom(Random.randBytes(32))))
          .setKeyValue(ByteString.copyFrom(Random.randBytes(33)))
          .build();
  ByteString privateKeyByteString = privateKey.toByteString();
  
  try {
    manager.getPublicKeyData(privateKeyByteString);
    fail();
  } catch (GeneralSecurityException e) {
    assertExceptionContains(e, "validateKey(Ed25519PrivateKey)");
  }
}