aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java219
1 files changed, 31 insertions, 188 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java
index 8eae92e63..8e0c7ab40 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java
@@ -18,58 +18,29 @@
package org.sufficientlysecure.keychain.pgp;
-import org.bouncycastle.bcpg.CompressionAlgorithmTags;
-import org.sufficientlysecure.keychain.Constants;
-import org.sufficientlysecure.keychain.util.Passphrase;
-
+import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
public class PgpSignEncryptInputParcel implements Parcelable {
- protected String mVersionHeader = null;
- protected boolean mEnableAsciiArmorOutput = false;
- protected int mCompressionAlgorithm = CompressionAlgorithmTags.UNCOMPRESSED;
- protected long[] mEncryptionMasterKeyIds = null;
- protected Passphrase mSymmetricPassphrase = null;
- protected int mSymmetricEncryptionAlgorithm = PgpSecurityConstants.OpenKeychainSymmetricKeyAlgorithmTags.USE_DEFAULT;
- protected long mSignatureMasterKeyId = Constants.key.none;
- protected Long mSignatureSubKeyId = null;
- protected int mSignatureHashAlgorithm = PgpSecurityConstants.OpenKeychainHashAlgorithmTags.USE_DEFAULT;
- protected long mAdditionalEncryptId = Constants.key.none;
- protected String mCharset;
- protected boolean mCleartextSignature;
- protected boolean mDetachedSignature = false;
- protected boolean mHiddenRecipients = false;
- protected boolean mIntegrityProtected = true;
- protected boolean mAddBackupHeader = false;
+ private PgpSignEncryptData data;
- public PgpSignEncryptInputParcel() {
+ private Uri mInputUri;
+ private Uri mOutputUri;
+ private byte[] mInputBytes;
+ public PgpSignEncryptInputParcel(PgpSignEncryptData data) {
+ this.data = data;
}
PgpSignEncryptInputParcel(Parcel source) {
+ mInputUri = source.readParcelable(getClass().getClassLoader());
+ mOutputUri = source.readParcelable(getClass().getClassLoader());
+ mInputBytes = source.createByteArray();
- ClassLoader loader = getClass().getClassLoader();
-
- // we do all of those here, so the PgpSignEncryptInput class doesn't have to be parcelable
- mVersionHeader = source.readString();
- mEnableAsciiArmorOutput = source.readInt() == 1;
- mCompressionAlgorithm = source.readInt();
- mEncryptionMasterKeyIds = source.createLongArray();
- mSymmetricPassphrase = source.readParcelable(loader);
- mSymmetricEncryptionAlgorithm = source.readInt();
- mSignatureMasterKeyId = source.readLong();
- mSignatureSubKeyId = source.readInt() == 1 ? source.readLong() : null;
- mSignatureHashAlgorithm = source.readInt();
- mAdditionalEncryptId = source.readLong();
- mCharset = source.readString();
- mCleartextSignature = source.readInt() == 1;
- mDetachedSignature = source.readInt() == 1;
- mHiddenRecipients = source.readInt() == 1;
- mIntegrityProtected = source.readInt() == 1;
- mAddBackupHeader = source.readInt() == 1;
+ data = source.readParcelable(getClass().getClassLoader());
}
@Override
@@ -79,173 +50,45 @@ public class PgpSignEncryptInputParcel implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(mVersionHeader);
- dest.writeInt(mEnableAsciiArmorOutput ? 1 : 0);
- dest.writeInt(mCompressionAlgorithm);
- dest.writeLongArray(mEncryptionMasterKeyIds);
- dest.writeParcelable(mSymmetricPassphrase, 0);
- dest.writeInt(mSymmetricEncryptionAlgorithm);
- dest.writeLong(mSignatureMasterKeyId);
- if (mSignatureSubKeyId != null) {
- dest.writeInt(1);
- dest.writeLong(mSignatureSubKeyId);
- } else {
- dest.writeInt(0);
- }
- dest.writeInt(mSignatureHashAlgorithm);
- dest.writeLong(mAdditionalEncryptId);
- dest.writeString(mCharset);
- dest.writeInt(mCleartextSignature ? 1 : 0);
- dest.writeInt(mDetachedSignature ? 1 : 0);
- dest.writeInt(mHiddenRecipients ? 1 : 0);
- dest.writeInt(mIntegrityProtected ? 1 : 0);
- dest.writeInt(mAddBackupHeader ? 1 : 0);
- }
-
- public String getCharset() {
- return mCharset;
- }
-
- public void setCharset(String mCharset) {
- this.mCharset = mCharset;
- }
-
- public long getAdditionalEncryptId() {
- return mAdditionalEncryptId;
- }
-
- public PgpSignEncryptInputParcel setAdditionalEncryptId(long additionalEncryptId) {
- mAdditionalEncryptId = additionalEncryptId;
- return this;
- }
-
- public int getSignatureHashAlgorithm() {
- return mSignatureHashAlgorithm;
- }
-
- public PgpSignEncryptInputParcel setSignatureHashAlgorithm(int signatureHashAlgorithm) {
- mSignatureHashAlgorithm = signatureHashAlgorithm;
- return this;
- }
-
- public Long getSignatureSubKeyId() {
- return mSignatureSubKeyId;
- }
-
- public PgpSignEncryptInputParcel setSignatureSubKeyId(long signatureSubKeyId) {
- mSignatureSubKeyId = signatureSubKeyId;
- return this;
- }
-
- public long getSignatureMasterKeyId() {
- return mSignatureMasterKeyId;
- }
-
- public PgpSignEncryptInputParcel setSignatureMasterKeyId(long signatureMasterKeyId) {
- mSignatureMasterKeyId = signatureMasterKeyId;
- return this;
- }
+ dest.writeParcelable(mInputUri, 0);
+ dest.writeParcelable(mOutputUri, 0);
+ dest.writeByteArray(mInputBytes);
- public int getSymmetricEncryptionAlgorithm() {
- return mSymmetricEncryptionAlgorithm;
+ data.writeToParcel(dest, 0);
}
- public PgpSignEncryptInputParcel setSymmetricEncryptionAlgorithm(int symmetricEncryptionAlgorithm) {
- mSymmetricEncryptionAlgorithm = symmetricEncryptionAlgorithm;
- return this;
+ public void setInputBytes(byte[] inputBytes) {
+ this.mInputBytes = inputBytes;
}
- public Passphrase getSymmetricPassphrase() {
- return mSymmetricPassphrase;
+ byte[] getInputBytes() {
+ return mInputBytes;
}
- public PgpSignEncryptInputParcel setSymmetricPassphrase(Passphrase symmetricPassphrase) {
- mSymmetricPassphrase = symmetricPassphrase;
+ public PgpSignEncryptInputParcel setInputUri(Uri uri) {
+ mInputUri = uri;
return this;
}
- public long[] getEncryptionMasterKeyIds() {
- return mEncryptionMasterKeyIds;
+ Uri getInputUri() {
+ return mInputUri;
}
- public PgpSignEncryptInputParcel setEncryptionMasterKeyIds(long[] encryptionMasterKeyIds) {
- mEncryptionMasterKeyIds = encryptionMasterKeyIds;
+ public PgpSignEncryptInputParcel setOutputUri(Uri uri) {
+ mOutputUri = uri;
return this;
}
- public int getCompressionAlgorithm() {
- return mCompressionAlgorithm;
- }
-
- public PgpSignEncryptInputParcel setCompressionAlgorithm(int compressionAlgorithm) {
- mCompressionAlgorithm = compressionAlgorithm;
- return this;
- }
-
- public boolean isEnableAsciiArmorOutput() {
- return mEnableAsciiArmorOutput;
- }
-
- public String getVersionHeader() {
- return mVersionHeader;
- }
-
- public PgpSignEncryptInputParcel setVersionHeader(String versionHeader) {
- mVersionHeader = versionHeader;
- return this;
- }
-
- public PgpSignEncryptInputParcel setEnableAsciiArmorOutput(boolean enableAsciiArmorOutput) {
- mEnableAsciiArmorOutput = enableAsciiArmorOutput;
- return this;
- }
-
- public PgpSignEncryptInputParcel setCleartextSignature(boolean cleartextSignature) {
- this.mCleartextSignature = cleartextSignature;
- return this;
- }
-
- public boolean isCleartextSignature() {
- return mCleartextSignature;
- }
-
- public PgpSignEncryptInputParcel setDetachedSignature(boolean detachedSignature) {
- this.mDetachedSignature = detachedSignature;
- return this;
- }
-
- public boolean isDetachedSignature() {
- return mDetachedSignature;
- }
-
- public PgpSignEncryptInputParcel setHiddenRecipients(boolean hiddenRecipients) {
- this.mHiddenRecipients = hiddenRecipients;
- return this;
- }
-
- public boolean isIntegrityProtected() {
- return mIntegrityProtected;
- }
-
- /**
- * Only use for testing! Never disable integrity protection!
- */
- public PgpSignEncryptInputParcel setIntegrityProtected(boolean integrityProtected) {
- this.mIntegrityProtected = integrityProtected;
- return this;
- }
-
- public PgpSignEncryptInputParcel setAddBackupHeader(boolean addBackupHeader) {
- this.mAddBackupHeader = addBackupHeader;
- return this;
+ Uri getOutputUri() {
+ return mOutputUri;
}
- public boolean isAddBackupHeader() {
- return mAddBackupHeader;
+ public void setData(PgpSignEncryptData data) {
+ this.data = data;
}
- public boolean isHiddenRecipients() {
- return mHiddenRecipients;
+ public PgpSignEncryptData getData() {
+ return data;
}
public static final Creator<PgpSignEncryptInputParcel> CREATOR = new Creator<PgpSignEncryptInputParcel>() {