mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-07 10:30:14 -05:00
Merge branch 'development' of github.com:open-keychain/open-keychain into development
This commit is contained in:
commit
be31815ee8
@ -7,6 +7,7 @@ import org.sufficientlysecure.keychain.keyimport.HkpKeyserver;
|
|||||||
import org.sufficientlysecure.keychain.keyimport.Keyserver.AddKeyException;
|
import org.sufficientlysecure.keychain.keyimport.Keyserver.AddKeyException;
|
||||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
|
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
|
||||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
||||||
import org.sufficientlysecure.keychain.pgp.Progressable;
|
import org.sufficientlysecure.keychain.pgp.Progressable;
|
||||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||||
@ -57,6 +58,10 @@ public class CertifyOperation extends BaseOperation {
|
|||||||
mProviderHelper.getCanonicalizedSecretKeyRing(parcel.mMasterKeyId);
|
mProviderHelper.getCanonicalizedSecretKeyRing(parcel.mMasterKeyId);
|
||||||
log.add(LogType.MSG_CRT_UNLOCK, 1);
|
log.add(LogType.MSG_CRT_UNLOCK, 1);
|
||||||
certificationKey = secretKeyRing.getSecretKey();
|
certificationKey = secretKeyRing.getSecretKey();
|
||||||
|
if (certificationKey.getSecretKeyType() == SecretKeyType.DIVERT_TO_CARD) {
|
||||||
|
log.add(LogType.MSG_CRT_ERROR_DIVERT, 2);
|
||||||
|
return new CertifyResult(CertifyResult.RESULT_ERROR, log);
|
||||||
|
}
|
||||||
if (!certificationKey.unlock(passphrase)) {
|
if (!certificationKey.unlock(passphrase)) {
|
||||||
log.add(LogType.MSG_CRT_ERROR_UNLOCK, 2);
|
log.add(LogType.MSG_CRT_ERROR_UNLOCK, 2);
|
||||||
return new CertifyResult(CertifyResult.RESULT_ERROR, log);
|
return new CertifyResult(CertifyResult.RESULT_ERROR, log);
|
||||||
|
@ -575,6 +575,7 @@ public abstract class OperationResult implements Parcelable {
|
|||||||
MSG_CRT_ERROR_MASTER_NOT_FOUND (LogLevel.ERROR, R.string.msg_crt_error_master_not_found),
|
MSG_CRT_ERROR_MASTER_NOT_FOUND (LogLevel.ERROR, R.string.msg_crt_error_master_not_found),
|
||||||
MSG_CRT_ERROR_NOTHING (LogLevel.ERROR, R.string.msg_crt_error_nothing),
|
MSG_CRT_ERROR_NOTHING (LogLevel.ERROR, R.string.msg_crt_error_nothing),
|
||||||
MSG_CRT_ERROR_UNLOCK (LogLevel.ERROR, R.string.msg_crt_error_unlock),
|
MSG_CRT_ERROR_UNLOCK (LogLevel.ERROR, R.string.msg_crt_error_unlock),
|
||||||
|
MSG_CRT_ERROR_DIVERT (LogLevel.ERROR, R.string.msg_crt_error_divert),
|
||||||
MSG_CRT (LogLevel.START, R.string.msg_crt),
|
MSG_CRT (LogLevel.START, R.string.msg_crt),
|
||||||
MSG_CRT_MASTER_FETCH (LogLevel.DEBUG, R.string.msg_crt_master_fetch),
|
MSG_CRT_MASTER_FETCH (LogLevel.DEBUG, R.string.msg_crt_master_fetch),
|
||||||
MSG_CRT_SAVE (LogLevel.DEBUG, R.string.msg_crt_save),
|
MSG_CRT_SAVE (LogLevel.DEBUG, R.string.msg_crt_save),
|
||||||
|
@ -23,4 +23,6 @@ public interface Progressable {
|
|||||||
void setProgress(int resourceId, int current, int total);
|
void setProgress(int resourceId, int current, int total);
|
||||||
|
|
||||||
void setProgress(int current, int total);
|
void setProgress(int current, int total);
|
||||||
|
|
||||||
|
void setPreventCancel();
|
||||||
}
|
}
|
||||||
|
@ -938,6 +938,9 @@ public class ProviderHelper {
|
|||||||
|
|
||||||
progress.setProgress(R.string.progress_con_saving, 0, 100);
|
progress.setProgress(R.string.progress_con_saving, 0, 100);
|
||||||
|
|
||||||
|
// The consolidate operation can never be cancelled!
|
||||||
|
progress.setPreventCancel();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
log.add(LogType.MSG_CON_SAVE_SECRET, indent);
|
log.add(LogType.MSG_CON_SAVE_SECRET, indent);
|
||||||
@ -947,11 +950,13 @@ public class ProviderHelper {
|
|||||||
KeyRings.PRIVKEY_DATA, KeyRings.FINGERPRINT, KeyRings.HAS_ANY_SECRET
|
KeyRings.PRIVKEY_DATA, KeyRings.FINGERPRINT, KeyRings.HAS_ANY_SECRET
|
||||||
}, KeyRings.HAS_ANY_SECRET + " = 1", null, null);
|
}, KeyRings.HAS_ANY_SECRET + " = 1", null, null);
|
||||||
|
|
||||||
if (cursor == null || !cursor.moveToFirst()) {
|
if (cursor == null) {
|
||||||
log.add(LogType.MSG_CON_ERROR_DB, indent);
|
log.add(LogType.MSG_CON_ERROR_DB, indent);
|
||||||
return new ConsolidateResult(ConsolidateResult.RESULT_ERROR, log);
|
return new ConsolidateResult(ConsolidateResult.RESULT_ERROR, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No keys existing might be a legitimate option, we write an empty file in that case
|
||||||
|
cursor.moveToFirst();
|
||||||
ParcelableFileCache<ParcelableKeyRing> cache =
|
ParcelableFileCache<ParcelableKeyRing> cache =
|
||||||
new ParcelableFileCache<ParcelableKeyRing>(mContext, "consolidate_secret.pcl");
|
new ParcelableFileCache<ParcelableKeyRing>(mContext, "consolidate_secret.pcl");
|
||||||
cache.writeCache(cursor.getCount(), new Iterator<ParcelableKeyRing>() {
|
cache.writeCache(cursor.getCount(), new Iterator<ParcelableKeyRing>() {
|
||||||
@ -1007,11 +1012,13 @@ public class ProviderHelper {
|
|||||||
KeyRings.PUBKEY_DATA, KeyRings.FINGERPRINT
|
KeyRings.PUBKEY_DATA, KeyRings.FINGERPRINT
|
||||||
}, null, null, null);
|
}, null, null, null);
|
||||||
|
|
||||||
if (cursor == null || !cursor.moveToFirst()) {
|
if (cursor == null) {
|
||||||
log.add(LogType.MSG_CON_ERROR_DB, indent);
|
log.add(LogType.MSG_CON_ERROR_DB, indent);
|
||||||
return new ConsolidateResult(ConsolidateResult.RESULT_ERROR, log);
|
return new ConsolidateResult(ConsolidateResult.RESULT_ERROR, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No keys existing might be a legitimate option, we write an empty file in that case
|
||||||
|
cursor.moveToFirst();
|
||||||
ParcelableFileCache<ParcelableKeyRing> cache =
|
ParcelableFileCache<ParcelableKeyRing> cache =
|
||||||
new ParcelableFileCache<ParcelableKeyRing>(mContext, "consolidate_public.pcl");
|
new ParcelableFileCache<ParcelableKeyRing>(mContext, "consolidate_public.pcl");
|
||||||
cache.writeCache(cursor.getCount(), new Iterator<ParcelableKeyRing>() {
|
cache.writeCache(cursor.getCount(), new Iterator<ParcelableKeyRing>() {
|
||||||
|
@ -472,8 +472,7 @@ public class KeychainIntentService extends IntentService implements Progressable
|
|||||||
|
|
||||||
// Special: consolidate on secret key import (cannot be cancelled!)
|
// Special: consolidate on secret key import (cannot be cancelled!)
|
||||||
if (result.mSecret > 0) {
|
if (result.mSecret > 0) {
|
||||||
// cannot cancel from here on out!
|
// TODO move this into the import operation
|
||||||
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_PREVENT_CANCEL);
|
|
||||||
providerHelper.consolidateDatabaseStep1(this);
|
providerHelper.consolidateDatabaseStep1(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,6 +675,11 @@ public class KeychainIntentService extends IntentService implements Progressable
|
|||||||
setProgress(null, progress, max);
|
setProgress(null, progress, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPreventCancel() {
|
||||||
|
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_PREVENT_CANCEL);
|
||||||
|
}
|
||||||
|
|
||||||
private InputData createDecryptInputData(Bundle data) throws IOException, PgpGeneralException {
|
private InputData createDecryptInputData(Bundle data) throws IOException, PgpGeneralException {
|
||||||
return createCryptInputData(data, DECRYPT_CIPHERTEXT_BYTES);
|
return createCryptInputData(data, DECRYPT_CIPHERTEXT_BYTES);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class ProgressDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
mPreventCancel = preventCancel;
|
mPreventCancel = preventCancel;
|
||||||
final Button negative = ((ProgressDialog) getDialog()).getButton(DialogInterface.BUTTON_NEGATIVE);
|
final Button negative = ((ProgressDialog) getDialog()).getButton(DialogInterface.BUTTON_NEGATIVE);
|
||||||
negative.setVisibility(preventCancel ? View.GONE : View.VISIBLE);
|
negative.setEnabled(mIsCancelled && !preventCancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,4 +60,10 @@ public class ProgressScaler implements Progressable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPreventCancel() {
|
||||||
|
if (mWrapped != null) {
|
||||||
|
mWrapped.setPreventCancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -928,6 +928,7 @@
|
|||||||
<string name="msg_crt_error_master_not_found">"Master key not found!"</string>
|
<string name="msg_crt_error_master_not_found">"Master key not found!"</string>
|
||||||
<string name="msg_crt_error_nothing">"No keys certified!"</string>
|
<string name="msg_crt_error_nothing">"No keys certified!"</string>
|
||||||
<string name="msg_crt_error_unlock">"Error unlocking master key!"</string>
|
<string name="msg_crt_error_unlock">"Error unlocking master key!"</string>
|
||||||
|
<string name="msg_crt_error_divert">"Certification with NFC is not (yet) supported!"</string>
|
||||||
<string name="msg_crt">"Certifying keyrings"</string>
|
<string name="msg_crt">"Certifying keyrings"</string>
|
||||||
<string name="msg_crt_master_fetch">"Fetching certifying master key"</string>
|
<string name="msg_crt_master_fetch">"Fetching certifying master key"</string>
|
||||||
<string name="msg_crt_save">"Saving certified key %s"</string>
|
<string name="msg_crt_save">"Saving certified key %s"</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user