diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-07-04 11:57:21 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-07-04 11:57:21 +0200 |
commit | b1783fb3d2c5797aa154ff203be7a8ca854ac69b (patch) | |
tree | c5d50a4db3b3cf716905a14b49aad2f98ac12964 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java | |
parent | 0faf69e91fa5ccf3ba14267c5e2e6414e7be0324 (diff) | |
parent | aca106e8080dc58a0020b23f671daf1431674afb (diff) | |
download | open-keychain-b1783fb3d2c5797aa154ff203be7a8ca854ac69b.tar.gz open-keychain-b1783fb3d2c5797aa154ff203be7a8ca854ac69b.tar.bz2 open-keychain-b1783fb3d2c5797aa154ff203be7a8ca854ac69b.zip |
Merge pull request #1329 from open-keychain/tor-support
added proxy/tor preferences
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java index ee7caf2d8..96f54dd2f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java @@ -17,17 +17,17 @@ package org.sufficientlysecure.keychain.service.input; -import java.nio.ByteBuffer; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - import android.os.Parcel; import android.os.Parcelable; +import org.sufficientlysecure.keychain.util.ParcelableProxy; import org.sufficientlysecure.keychain.util.Passphrase; +import java.nio.ByteBuffer; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + /** * This is a base class for the input of crypto operations. */ @@ -35,6 +35,8 @@ public class CryptoInputParcel implements Parcelable { final Date mSignatureTime; final Passphrase mPassphrase; + // used to supply an explicit proxy to operations that require it + private ParcelableProxy mParcelableProxy; // this map contains both decrypted session keys and signed hashes to be // used in the crypto operation described by this parcel. @@ -43,26 +45,37 @@ public class CryptoInputParcel implements Parcelable { public CryptoInputParcel() { mSignatureTime = new Date(); mPassphrase = null; + mParcelableProxy = null; } public CryptoInputParcel(Date signatureTime, Passphrase passphrase) { mSignatureTime = signatureTime == null ? new Date() : signatureTime; mPassphrase = passphrase; + mParcelableProxy = null; } public CryptoInputParcel(Passphrase passphrase) { mSignatureTime = new Date(); mPassphrase = passphrase; + mParcelableProxy = null; } public CryptoInputParcel(Date signatureTime) { mSignatureTime = signatureTime == null ? new Date() : signatureTime; mPassphrase = null; + mParcelableProxy = null; + } + + public CryptoInputParcel(ParcelableProxy parcelableProxy) { + mSignatureTime = new Date(); // just for compatibility with parcel-ing + mPassphrase = null; + mParcelableProxy = parcelableProxy; } protected CryptoInputParcel(Parcel source) { mSignatureTime = new Date(source.readLong()); mPassphrase = source.readParcelable(getClass().getClassLoader()); + mParcelableProxy = source.readParcelable(getClass().getClassLoader()); { int count = source.readInt(); @@ -85,6 +98,7 @@ public class CryptoInputParcel implements Parcelable { public void writeToParcel(Parcel dest, int flags) { dest.writeLong(mSignatureTime.getTime()); dest.writeParcelable(mPassphrase, 0); + dest.writeParcelable(mParcelableProxy, 0); dest.writeInt(mCryptoData.size()); for (HashMap.Entry<ByteBuffer, byte[]> entry : mCryptoData.entrySet()) { @@ -93,6 +107,10 @@ public class CryptoInputParcel implements Parcelable { } } + public void addParcelableProxy(ParcelableProxy parcelableProxy) { + mParcelableProxy = parcelableProxy; + } + public void addCryptoData(byte[] hash, byte[] signedHash) { mCryptoData.put(ByteBuffer.wrap(hash), signedHash); } @@ -101,6 +119,10 @@ public class CryptoInputParcel implements Parcelable { mCryptoData.putAll(cachedSessionKeys); } + public ParcelableProxy getParcelableProxy() { + return mParcelableProxy; + } + public Map<ByteBuffer, byte[]> getCryptoData() { return mCryptoData; } |