diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-08-17 12:39:13 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-08-17 12:39:13 +0200 |
commit | b082fe403d3f6b0da6889516d63ffc632161d909 (patch) | |
tree | 421ddd63d1045064685be39c2082c0e668776856 /OpenKeychain/src/main/java/org | |
parent | 3c8028fc88af0b6af09d453fddc779e5972a59f9 (diff) | |
parent | a3395112e091eca4d3efafc1b9f29d782298b588 (diff) | |
download | open-keychain-b082fe403d3f6b0da6889516d63ffc632161d909.tar.gz open-keychain-b082fe403d3f6b0da6889516d63ffc632161d909.tar.bz2 open-keychain-b082fe403d3f6b0da6889516d63ffc632161d909.zip |
Merge branch 'master' of github.com:open-keychain/open-keychain
Diffstat (limited to 'OpenKeychain/src/main/java/org')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java index ecf64e1af..9aceb946c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java @@ -20,7 +20,6 @@ package org.sufficientlysecure.keychain.operations; import android.content.Context; -import android.database.Cursor; import android.net.Uri; import android.support.annotation.NonNull; @@ -39,7 +38,7 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.util.Log; -public class RevokeOperation extends BaseOperation<RevokeKeyringParcel> { +public class RevokeOperation extends BaseOperation<RevokeKeyringParcel> { public RevokeOperation(Context context, ProviderHelper providerHelper, Progressable progressable) { super(context, providerHelper, progressable); @@ -71,13 +70,15 @@ public class RevokeOperation extends BaseOperation<RevokeKeyringParcel> { return new RevokeResult(RevokeResult.RESULT_ERROR, log, masterKeyId); } - SaveKeyringParcel saveKeyringParcel = getRevokedSaveKeyringParcel(masterKeyId, - keyRing.getFingerprint()); + SaveKeyringParcel saveKeyringParcel = + new SaveKeyringParcel(masterKeyId, keyRing.getFingerprint()); // all revoke operations are made atomic as of now saveKeyringParcel.setUpdateOptions(revokeKeyringParcel.mUpload, true, revokeKeyringParcel.mKeyserver); + saveKeyringParcel.mRevokeSubKeys.add(masterKeyId); + InputPendingResult revokeAndUploadResult = new EditKeyOperation(mContext, mProviderHelper, mProgressable, mCancelled) .execute(saveKeyringParcel, cryptoInputParcel); @@ -103,43 +104,4 @@ public class RevokeOperation extends BaseOperation<RevokeKeyringParcel> { } } - private SaveKeyringParcel getRevokedSaveKeyringParcel(long masterKeyId, byte[] fingerprint) { - final String[] SUBKEYS_PROJECTION = new String[]{ - KeychainContract.Keys.KEY_ID - }; - final int INDEX_KEY_ID = 0; - - Uri keysUri = KeychainContract.Keys.buildKeysUri(masterKeyId); - Cursor subKeyCursor = - mContext.getContentResolver().query(keysUri, SUBKEYS_PROJECTION, null, null, null); - - SaveKeyringParcel saveKeyringParcel = - new SaveKeyringParcel(masterKeyId, fingerprint); - - // add all subkeys, for revocation - while (subKeyCursor != null && subKeyCursor.moveToNext()) { - saveKeyringParcel.mRevokeSubKeys.add(subKeyCursor.getLong(INDEX_KEY_ID)); - } - if (subKeyCursor != null) { - subKeyCursor.close(); - } - - final String[] USER_IDS_PROJECTION = new String[]{ - KeychainContract.UserPackets.USER_ID - }; - final int INDEX_USER_ID = 0; - - Uri userIdsUri = KeychainContract.UserPackets.buildUserIdsUri(masterKeyId); - Cursor userIdCursor = mContext.getContentResolver().query( - userIdsUri, USER_IDS_PROJECTION, null, null, null); - - while (userIdCursor != null && userIdCursor.moveToNext()) { - saveKeyringParcel.mRevokeUserIds.add(userIdCursor.getString(INDEX_USER_ID)); - } - if (userIdCursor != null) { - userIdCursor.close(); - } - - return saveKeyringParcel; - } } |