private static LegacyKmsAeadKey parseKey(
      ProtoKeySerialization serialization, @Nullable SecretKeyAccess access)
      throws GeneralSecurityException {
    if (!serialization.getTypeUrl().equals(TYPE_URL)) {
      throw new IllegalArgumentException(
          "Wrong type URL in call to LegacyKmsAeadProtoSerialization.parseKey");
    }
    try {
      com.google.crypto.tink.proto.KmsAeadKey protoKey =
          com.google.crypto.tink.proto.KmsAeadKey.parseFrom(
              serialization.getValue(), ExtensionRegistryLite.getEmptyRegistry());
      if (protoKey.getVersion() != 0) {
        throw new GeneralSecurityException(
            "KmsAeadKey are only accepted with version 0, got " + protoKey);
      }
      LegacyKmsAeadParameters parameters =
          LegacyKmsAeadParameters.create(
              protoKey.getParams().getKeyUri(), toVariant(serialization.getOutputPrefixType()));
      return LegacyKmsAeadKey.create(parameters, serialization.getIdRequirementOrNull());
    } catch (InvalidProtocolBufferException e) {
      throw new GeneralSecurityException("Parsing KmsAeadKey failed: ", e);
    }
  }
Serializers and Parsers for LegacyKmsAeadProtoKey and LegacyKmsAeadProtoParameters
java_src/src/main/java/com/google/crypto/tink/aead/LegacyKmsAeadProtoSerialization.java