@SuppressWarnings("UnusedException")
  private static EciesPublicKey parsePublicKey(
      ProtoKeySerialization serialization, @Nullable SecretKeyAccess access)
      throws GeneralSecurityException {
    if (!serialization.getTypeUrl().equals(PUBLIC_TYPE_URL)) {
      throw new IllegalArgumentException(
          "Wrong type URL in call to EciesProtoSerialization.parsePublicKey: "
              + serialization.getTypeUrl());
    }
    try {
      com.google.crypto.tink.proto.EciesAeadHkdfPublicKey protoKey =
          com.google.crypto.tink.proto.EciesAeadHkdfPublicKey.parseFrom(
              serialization.getValue(), ExtensionRegistryLite.getEmptyRegistry());
      if (protoKey.getVersion() != 0) {
        throw new GeneralSecurityException("Only version 0 keys are accepted");
      }
      EciesParameters parameters =
          fromProtoParameters(serialization.getOutputPrefixType(), protoKey.getParams());
      if (parameters.getCurveType().equals(EciesParameters.CurveType.X25519)) {
        if (!protoKey.getY().isEmpty()) {
          throw new GeneralSecurityException("Y must be empty for X25519 points");
        }
        return EciesPublicKey.createForCurveX25519(
            parameters,
            Bytes.copyFrom(protoKey.getX().toByteArray()),
            serialization.getIdRequirementOrNull());
      }
      ECPoint point =
          new ECPoint(
              BigIntegerEncoding.fromUnsignedBigEndianBytes(protoKey.getX().toByteArray()),
              BigIntegerEncoding.fromUnsignedBigEndianBytes(protoKey.getY().toByteArray()));

      return EciesPublicKey.createForNistCurve(
          parameters, point, serialization.getIdRequirementOrNull());
    } catch (InvalidProtocolBufferException | IllegalArgumentException e) {
      throw new GeneralSecurityException("Parsing EcdsaPublicKey failed");
    }
  }
Registers previously defined parser/serializer objects into a given registry.
java_src/src/main/java/com/google/crypto/tink/hybrid/internal/EciesProtoSerialization.java