@AccessesPartialKey
  private static LegacyKmsEnvelopeAeadKey parseKey(
      ProtoKeySerialization serialization, @Nullable SecretKeyAccess access)
      throws GeneralSecurityException {
    if (!serialization.getTypeUrl().equals(TYPE_URL)) {
      throw new IllegalArgumentException(
          "Wrong type URL in call to LegacyKmsEnvelopeAeadProtoSerialization.parseKey");
    }
    try {
      KmsEnvelopeAeadKey protoKey =
          KmsEnvelopeAeadKey.parseFrom(
              serialization.getValue(), ExtensionRegistryLite.getEmptyRegistry());
      if (protoKey.getVersion() != 0) {
        throw new GeneralSecurityException(
            "KmsEnvelopeAeadKeys are only accepted with version 0, got " + protoKey);
      }

      LegacyKmsEnvelopeAeadParameters parameters =
          parseParameters(protoKey.getParams(), serialization.getOutputPrefixType());
      return LegacyKmsEnvelopeAeadKey.create(parameters, serialization.getIdRequirementOrNull());
    } catch (InvalidProtocolBufferException e) {
      throw new GeneralSecurityException("Parsing KmsEnvelopeAeadKey failed: ", e);
    }
  }
Serializers and Parsers for LegacyKmsEnvelopeAeadProtoKey and
LegacyKmsEnvelopeAeadProtoParameters
java_src/src/main/java/com/google/crypto/tink/aead/LegacyKmsEnvelopeAeadProtoSerialization.java