/* * Copyright (C) 2017 Schürmann & Breitmoser GbR * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package org.sufficientlysecure.keychain.pgp; import java.util.Collections; import java.util.List; import android.net.Uri; import android.os.Parcelable; import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; @AutoValue public abstract class PgpDecryptVerifyInputParcel implements Parcelable { @Nullable @SuppressWarnings("mutable") abstract byte[] getInputBytes(); @Nullable abstract Uri getInputUri(); @Nullable abstract Uri getOutputUri(); abstract boolean isAllowSymmetricDecryption(); abstract boolean isDecryptMetadataOnly(); abstract boolean isAutocryptSetup(); @Nullable abstract List getAllowedKeyIds(); @Nullable @SuppressWarnings("mutable") abstract byte[] getDetachedSignature(); @Nullable abstract String getSenderAddress(); public abstract Builder toBuilder(); public static Builder builder() { return new AutoValue_PgpDecryptVerifyInputParcel.Builder() .setAllowSymmetricDecryption(false) .setDecryptMetadataOnly(false) .setAutocryptSetup(false); } @AutoValue.Builder public abstract static class Builder { public abstract Builder setInputBytes(byte[] inputBytes); public abstract Builder setInputUri(Uri inputUri); public abstract Builder setOutputUri(Uri outputUri); public abstract Builder setAllowSymmetricDecryption(boolean allowSymmetricDecryption); public abstract Builder setDecryptMetadataOnly(boolean decryptMetadataOnly); public abstract Builder setDetachedSignature(byte[] detachedSignature); public abstract Builder setSenderAddress(String senderAddress); public abstract Builder setAutocryptSetup(boolean isAutocryptSetup); public abstract Builder setAllowedKeyIds(List allowedKeyIds); abstract List getAllowedKeyIds(); abstract PgpDecryptVerifyInputParcel autoBuild(); public PgpDecryptVerifyInputParcel build() { List allowedKeyIds = getAllowedKeyIds(); if (allowedKeyIds != null) { setAllowedKeyIds(Collections.unmodifiableList(allowedKeyIds)); } return autoBuild(); } } }