implemented revocation on deletion
This commit is contained in:
@@ -23,9 +23,12 @@ import android.net.Uri;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||
|
||||
public class ExportKeyringParcel implements Parcelable {
|
||||
public String mKeyserver;
|
||||
public Uri mCanonicalizedPublicKeyringUri;
|
||||
public UncachedKeyRing mUncachedKeyRing;
|
||||
|
||||
public boolean mExportSecret;
|
||||
public long mMasterKeyIds[];
|
||||
@@ -45,6 +48,12 @@ public class ExportKeyringParcel implements Parcelable {
|
||||
mCanonicalizedPublicKeyringUri = keyringUri;
|
||||
}
|
||||
|
||||
public ExportKeyringParcel(String keyserver, UncachedKeyRing uncachedKeyRing) {
|
||||
mExportType = ExportType.UPLOAD_KEYSERVER;
|
||||
mKeyserver = keyserver;
|
||||
mUncachedKeyRing = uncachedKeyRing;
|
||||
}
|
||||
|
||||
public ExportKeyringParcel(long[] masterKeyIds, boolean exportSecret, String outputFile) {
|
||||
mExportType = ExportType.EXPORT_FILE;
|
||||
mMasterKeyIds = masterKeyIds;
|
||||
@@ -62,6 +71,7 @@ public class ExportKeyringParcel implements Parcelable {
|
||||
protected ExportKeyringParcel(Parcel in) {
|
||||
mKeyserver = in.readString();
|
||||
mCanonicalizedPublicKeyringUri = (Uri) in.readValue(Uri.class.getClassLoader());
|
||||
mUncachedKeyRing = (UncachedKeyRing) in.readValue(UncachedKeyRing.class.getClassLoader());
|
||||
mExportSecret = in.readByte() != 0x00;
|
||||
mOutputFile = in.readString();
|
||||
mOutputUri = (Uri) in.readValue(Uri.class.getClassLoader());
|
||||
@@ -78,6 +88,7 @@ public class ExportKeyringParcel implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(mKeyserver);
|
||||
dest.writeValue(mCanonicalizedPublicKeyringUri);
|
||||
dest.writeValue(mUncachedKeyRing);
|
||||
dest.writeByte((byte) (mExportSecret ? 0x01 : 0x00));
|
||||
dest.writeString(mOutputFile);
|
||||
dest.writeValue(mOutputUri);
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.sufficientlysecure.keychain.operations.ExportOperation;
|
||||
import org.sufficientlysecure.keychain.operations.ImportOperation;
|
||||
import org.sufficientlysecure.keychain.operations.KeybaseVerificationOperation;
|
||||
import org.sufficientlysecure.keychain.operations.PromoteKeyOperation;
|
||||
import org.sufficientlysecure.keychain.operations.RevokeOperation;
|
||||
import org.sufficientlysecure.keychain.operations.SignEncryptOperation;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify;
|
||||
@@ -114,6 +115,8 @@ public class KeychainService extends Service implements Progressable {
|
||||
} else if (inputParcel instanceof SaveKeyringParcel) {
|
||||
op = new EditKeyOperation(outerThis, new ProviderHelper(outerThis), outerThis,
|
||||
mActionCanceled);
|
||||
} else if (inputParcel instanceof RevokeKeyringParcel) {
|
||||
op = new RevokeOperation(outerThis, new ProviderHelper(outerThis), outerThis);
|
||||
} else if (inputParcel instanceof CertifyActionsParcel) {
|
||||
op = new CertifyOperation(outerThis, new ProviderHelper(outerThis), outerThis,
|
||||
mActionCanceled);
|
||||
@@ -135,7 +138,7 @@ public class KeychainService extends Service implements Progressable {
|
||||
op = new KeybaseVerificationOperation(outerThis, new ProviderHelper(outerThis),
|
||||
outerThis);
|
||||
} else {
|
||||
return;
|
||||
throw new AssertionError("Unrecognized input parcel in KeychainService!");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // this is unchecked, we make sure it's the correct op above!
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.sufficientlysecure.keychain.service;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class RevokeKeyringParcel implements Parcelable {
|
||||
|
||||
final public long mMasterKeyId;
|
||||
final public boolean mUpload;
|
||||
final public String mKeyserver;
|
||||
|
||||
public RevokeKeyringParcel(long masterKeyId, boolean upload, String keyserver) {
|
||||
mMasterKeyId = masterKeyId;
|
||||
mUpload = upload;
|
||||
mKeyserver = keyserver;
|
||||
}
|
||||
|
||||
protected RevokeKeyringParcel(Parcel in) {
|
||||
mMasterKeyId = in.readLong();
|
||||
mUpload = in.readByte() != 0x00;
|
||||
mKeyserver = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(mMasterKeyId);
|
||||
dest.writeByte((byte) (mUpload ? 0x01 : 0x00));
|
||||
dest.writeString(mKeyserver);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<RevokeKeyringParcel> CREATOR = new Parcelable.Creator<RevokeKeyringParcel>() {
|
||||
@Override
|
||||
public RevokeKeyringParcel createFromParcel(Parcel in) {
|
||||
return new RevokeKeyringParcel(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RevokeKeyringParcel[] newArray(int size) {
|
||||
return new RevokeKeyringParcel[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -65,6 +65,11 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
public Passphrase mCardPin;
|
||||
public Passphrase mCardAdminPin;
|
||||
|
||||
// private because they have to be set together with setUpdateOptions
|
||||
private boolean mUpload;
|
||||
private boolean mUploadAtomic;
|
||||
private String mKeyserver;
|
||||
|
||||
public SaveKeyringParcel() {
|
||||
reset();
|
||||
}
|
||||
@@ -86,6 +91,27 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
mRevokeSubKeys = new ArrayList<>();
|
||||
mCardPin = null;
|
||||
mCardAdminPin = null;
|
||||
mUpload = false;
|
||||
mUploadAtomic = false;
|
||||
mKeyserver = null;
|
||||
}
|
||||
|
||||
public void setUpdateOptions(boolean upload, boolean uploadAtomic, String keysever) {
|
||||
mUpload = upload;
|
||||
mUploadAtomic = uploadAtomic;
|
||||
mKeyserver = keysever;
|
||||
}
|
||||
|
||||
public boolean isUpload() {
|
||||
return mUpload;
|
||||
}
|
||||
|
||||
public boolean isUploadAtomic() {
|
||||
return mUploadAtomic;
|
||||
}
|
||||
|
||||
public String getUploadKeyserver() {
|
||||
return mKeyserver;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
@@ -234,6 +260,10 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
|
||||
mCardPin = source.readParcelable(Passphrase.class.getClassLoader());
|
||||
mCardAdminPin = source.readParcelable(Passphrase.class.getClassLoader());
|
||||
|
||||
mUpload = source.readByte() != 0;
|
||||
mUploadAtomic = source.readByte() != 0;
|
||||
mKeyserver = source.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -259,6 +289,10 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
|
||||
destination.writeParcelable(mCardPin, flags);
|
||||
destination.writeParcelable(mCardAdminPin, flags);
|
||||
|
||||
destination.writeByte((byte) (mUpload ? 1 : 0));
|
||||
destination.writeByte((byte) (mUploadAtomic ? 1 : 0));
|
||||
destination.writeString(mKeyserver);
|
||||
}
|
||||
|
||||
public static final Creator<SaveKeyringParcel> CREATOR = new Creator<SaveKeyringParcel>() {
|
||||
|
||||
@@ -36,6 +36,8 @@ public class CryptoInputParcel implements Parcelable {
|
||||
final Date mSignatureTime;
|
||||
final Passphrase mPassphrase;
|
||||
// used to supply an explicit proxy to operations that require it
|
||||
// this is not final so it can be added to an existing CryptoInputParcel
|
||||
// (e.g) CertifyOperation with upload might require both passphrase and orbot to be enabled
|
||||
private ParcelableProxy mParcelableProxy;
|
||||
|
||||
// this map contains both decrypted session keys and signed hashes to be
|
||||
@@ -45,30 +47,25 @@ 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;
|
||||
this();
|
||||
mParcelableProxy = parcelableProxy;
|
||||
}
|
||||
|
||||
|
||||
@@ -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, ENABLE_ORBOT
|
||||
PASSPHRASE, PASSPHRASE_SYMMETRIC, NFC_SIGN, NFC_DECRYPT, NFC_MOVE_KEY_TO_CARD, ENABLE_ORBOT,
|
||||
}
|
||||
|
||||
public Date mSignatureTime;
|
||||
|
||||
Reference in New Issue
Block a user