private static LegacyKmsEnvelopeAeadParameters.Variant toVariant(
      OutputPrefixType outputPrefixType) throws GeneralSecurityException {
    switch (outputPrefixType) {
      case TINK:
        return LegacyKmsEnvelopeAeadParameters.Variant.TINK;
      case RAW:
        return LegacyKmsEnvelopeAeadParameters.Variant.NO_PREFIX;
      default:
        throw new GeneralSecurityException(
            "Unable to parse OutputPrefixType: " + outputPrefixType.getNumber());
    }
  }
Serializers and Parsers for LegacyKmsEnvelopeAeadProtoKey and
LegacyKmsEnvelopeAeadProtoParameters
java_src/src/main/java/com/google/crypto/tink/aead/LegacyKmsEnvelopeAeadProtoSerialization.java