Merge branch 'master' of github.com:open-keychain/open-keychain
This commit is contained in:
commit
b082fe403d
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue