@Override
  public KeyData getPublicKeyData(ByteString serializedKey) throws GeneralSecurityException {
    try {
      HpkePrivateKey keyProto =
          HpkePrivateKey.parseFrom(serializedKey, ExtensionRegistryLite.getEmptyRegistry());
      return KeyData.newBuilder()
          .setTypeUrl(LegacyHybridEncryptKeyManager.TYPE_URL)
          .setValue(keyProto.getPublicKey().toByteString())
          .setKeyMaterialType(KeyMaterialType.ASYMMETRIC_PUBLIC)
          .build();
    } catch (InvalidProtocolBufferException e) {
      throw new GeneralSecurityException("Expected serialized HpkePrivateKey proto", e);
    }
  }
A KeyManager for HybridDecrypt with a custom type URL for testing.
java_src/src/main/java/com/google/crypto/tink/hybrid/internal/testing/LegacyHybridDecryptKeyManager.java