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 | |
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')
3 files changed, 37 insertions, 12 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java index a11f81658..e76dcfb49 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java @@ -22,13 +22,10 @@ import android.os.Parcel; import android.os.Parcelable; import java.io.Serializable; -import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Date; -import java.util.Map; import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute; -import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; +import org.sufficientlysecure.keychain.util.ParcelableProxy; /** @@ -54,6 +51,7 @@ public class CertifyActionsParcel implements Parcelable { mMasterKeyId = source.readLong(); // just like parcelables, this is meant for ad-hoc IPC only and is NOT portable! mLevel = CertifyLevel.values()[source.readInt()]; + keyServerUri = source.readString(); mCertifyActions = (ArrayList<CertifyAction>) source.readSerializable(); } @@ -66,6 +64,7 @@ public class CertifyActionsParcel implements Parcelable { public void writeToParcel(Parcel destination, int flags) { destination.writeLong(mMasterKeyId); destination.writeInt(mLevel.ordinal()); + destination.writeString(keyServerUri); destination.writeSerializable(mCertifyActions); } @@ -94,7 +93,7 @@ public class CertifyActionsParcel implements Parcelable { } public CertifyAction(long masterKeyId, ArrayList<String> userIds, - ArrayList<WrappedUserAttribute> attributes) { + ArrayList<WrappedUserAttribute> attributes) { mMasterKeyId = masterKeyId; mUserIds = userIds; mUserAttributes = attributes; 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; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/RequiredInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/RequiredInputParcel.java index 4eca8d8f9..e378296a5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/RequiredInputParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/RequiredInputParcel.java @@ -15,7 +15,7 @@ import java.util.Date; public class RequiredInputParcel implements Parcelable { public enum RequiredInputType { - PASSPHRASE, PASSPHRASE_SYMMETRIC, NFC_SIGN, NFC_DECRYPT, NFC_MOVE_KEY_TO_CARD + PASSPHRASE, PASSPHRASE_SYMMETRIC, NFC_SIGN, NFC_DECRYPT, NFC_MOVE_KEY_TO_CARD, ENABLE_ORBOT } public Date mSignatureTime; @@ -77,6 +77,10 @@ public class RequiredInputParcel implements Parcelable { return mSubKeyId; } + public static RequiredInputParcel createOrbotRequiredOperation() { + return new RequiredInputParcel(RequiredInputType.ENABLE_ORBOT, null, null, null, 0L, 0L); + } + public static RequiredInputParcel createNfcSignOperation( long masterKeyId, long subKeyId, byte[] inputHash, int signAlgo, Date signatureTime) { |