@Override
  public HybridEncrypt getPrimitive(ByteString serializedKey) throws GeneralSecurityException {
    try {
      com.google.crypto.tink.proto.HpkePublicKey protoKey =
          com.google.crypto.tink.proto.HpkePublicKey.parseFrom(
              serializedKey, ExtensionRegistryLite.getEmptyRegistry());
      return HpkeEncrypt.create(parsePublicKey(protoKey));
    } catch (InvalidProtocolBufferException e) {
      throw new GeneralSecurityException("Expected serialized HpkePublicKey proto", e);
    }
  }
A KeyManager for HPKE Encrypt with a custom type URL for testing.
java_src/src/main/java/com/google/crypto/tink/hybrid/internal/testing/LegacyHybridEncryptKeyManager.java