move LogLevel info into LogType enum

This commit is contained in:
Vincent Breitmoser 2014-09-15 13:59:21 +02:00
parent 36ef8a9a62
commit 9a3a032d99
19 changed files with 489 additions and 499 deletions

View File

@ -49,7 +49,6 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.results.DecryptVerifyResult; import org.sufficientlysecure.keychain.service.results.DecryptVerifyResult;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType; import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.InputData;
@ -210,11 +209,11 @@ public class PgpDecryptVerify {
return decryptVerify(in, 0); return decryptVerify(in, 0);
} catch (PGPException e) { } catch (PGPException e) {
OperationLog log = new OperationLog(); OperationLog log = new OperationLog();
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_PGP_EXCEPTION, 1); log.add(LogType.MSG_DC_ERROR_PGP_EXCEPTION, 1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} catch (IOException e) { } catch (IOException e) {
OperationLog log = new OperationLog(); OperationLog log = new OperationLog();
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_IO, 1); log.add(LogType.MSG_DC_ERROR_IO, 1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }
} }
@ -226,7 +225,7 @@ public class PgpDecryptVerify {
OperationLog log = new OperationLog(); OperationLog log = new OperationLog();
log.add(LogLevel.START, LogType.MSG_DC, indent); log.add(LogType.MSG_DC, indent);
indent += 1; indent += 1;
PGPObjectFactory pgpF = new PGPObjectFactory(in, new JcaKeyFingerprintCalculator()); PGPObjectFactory pgpF = new PGPObjectFactory(in, new JcaKeyFingerprintCalculator());
@ -243,7 +242,7 @@ public class PgpDecryptVerify {
} }
if (enc == null) { if (enc == null) {
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_INVALID_SIGLIST, indent); log.add(LogType.MSG_DC_ERROR_INVALID_SIGLIST, indent);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }
@ -270,7 +269,7 @@ public class PgpDecryptVerify {
PGPPublicKeyEncryptedData encData = (PGPPublicKeyEncryptedData) obj; PGPPublicKeyEncryptedData encData = (PGPPublicKeyEncryptedData) obj;
long subKeyId = encData.getKeyID(); long subKeyId = encData.getKeyID();
log.add(LogLevel.DEBUG, LogType.MSG_DC_ASYM, indent, log.add(LogType.MSG_DC_ASYM, indent,
PgpKeyHelper.convertKeyIdToHex(subKeyId)); PgpKeyHelper.convertKeyIdToHex(subKeyId));
CanonicalizedSecretKeyRing secretKeyRing; CanonicalizedSecretKeyRing secretKeyRing;
@ -281,19 +280,19 @@ public class PgpDecryptVerify {
); );
} catch (ProviderHelper.NotFoundException e) { } catch (ProviderHelper.NotFoundException e) {
// continue with the next packet in the while loop // continue with the next packet in the while loop
log.add(LogLevel.DEBUG, LogType.MSG_DC_ASKIP_NO_KEY, indent +1); log.add(LogType.MSG_DC_ASKIP_NO_KEY, indent +1);
continue; continue;
} }
if (secretKeyRing == null) { if (secretKeyRing == null) {
// continue with the next packet in the while loop // continue with the next packet in the while loop
log.add(LogLevel.DEBUG, LogType.MSG_DC_ASKIP_NO_KEY, indent +1); log.add(LogType.MSG_DC_ASKIP_NO_KEY, indent +1);
continue; continue;
} }
// get subkey which has been used for this encryption packet // get subkey which has been used for this encryption packet
secretEncryptionKey = secretKeyRing.getSecretKey(subKeyId); secretEncryptionKey = secretKeyRing.getSecretKey(subKeyId);
if (secretEncryptionKey == null) { if (secretEncryptionKey == null) {
// should actually never happen, so no need to be more specific. // should actually never happen, so no need to be more specific.
log.add(LogLevel.DEBUG, LogType.MSG_DC_ASKIP_NO_KEY, indent +1); log.add(LogType.MSG_DC_ASKIP_NO_KEY, indent +1);
continue; continue;
} }
@ -307,7 +306,7 @@ public class PgpDecryptVerify {
if (!mAllowedKeyIds.contains(masterKeyId)) { if (!mAllowedKeyIds.contains(masterKeyId)) {
// this key is in our db, but NOT allowed! // this key is in our db, but NOT allowed!
// continue with the next packet in the while loop // continue with the next packet in the while loop
log.add(LogLevel.DEBUG, LogType.MSG_DC_ASKIP_NOT_ALLOWED, indent +1); log.add(LogType.MSG_DC_ASKIP_NOT_ALLOWED, indent +1);
continue; continue;
} }
} }
@ -322,15 +321,15 @@ public class PgpDecryptVerify {
try { try {
// returns "" if key has no passphrase // returns "" if key has no passphrase
mPassphrase = mPassphraseCache.getCachedPassphrase(subKeyId); mPassphrase = mPassphraseCache.getCachedPassphrase(subKeyId);
log.add(LogLevel.DEBUG, LogType.MSG_DC_PASS_CACHED, indent +1); log.add(LogType.MSG_DC_PASS_CACHED, indent +1);
} catch (NoSecretKeyException e) { } catch (NoSecretKeyException e) {
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_NO_KEY, indent +1); log.add(LogType.MSG_DC_ERROR_NO_KEY, indent +1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }
// if passphrase was not cached, return here indicating that a passphrase is missing! // if passphrase was not cached, return here indicating that a passphrase is missing!
if (mPassphrase == null) { if (mPassphrase == null) {
log.add(LogLevel.INFO, LogType.MSG_DC_PENDING_PASSPHRASE, indent +1); log.add(LogType.MSG_DC_PENDING_PASSPHRASE, indent +1);
DecryptVerifyResult result = DecryptVerifyResult result =
new DecryptVerifyResult(DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE, log); new DecryptVerifyResult(DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE, log);
result.setKeyIdPassphraseNeeded(subKeyId); result.setKeyIdPassphraseNeeded(subKeyId);
@ -344,10 +343,10 @@ public class PgpDecryptVerify {
} else if (obj instanceof PGPPBEEncryptedData) { } else if (obj instanceof PGPPBEEncryptedData) {
anyPacketFound = true; anyPacketFound = true;
log.add(LogLevel.DEBUG, LogType.MSG_DC_SYM, indent); log.add(LogType.MSG_DC_SYM, indent);
if (! mAllowSymmetricDecryption) { if (! mAllowSymmetricDecryption) {
log.add(LogLevel.WARN, LogType.MSG_DC_SYM_SKIP, indent +1); log.add(LogType.MSG_DC_SYM_SKIP, indent +1);
continue; continue;
} }
@ -362,7 +361,7 @@ public class PgpDecryptVerify {
// if no passphrase is given, return here // if no passphrase is given, return here
// indicating that a passphrase is missing! // indicating that a passphrase is missing!
if (mPassphrase == null) { if (mPassphrase == null) {
log.add(LogLevel.INFO, LogType.MSG_DC_PENDING_PASSPHRASE, indent +1); log.add(LogType.MSG_DC_PENDING_PASSPHRASE, indent +1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_PENDING_SYM_PASSPHRASE, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_PENDING_SYM_PASSPHRASE, log);
} }
@ -377,16 +376,16 @@ public class PgpDecryptVerify {
if (obj instanceof PGPPublicKeyEncryptedData) { if (obj instanceof PGPPublicKeyEncryptedData) {
PGPPublicKeyEncryptedData encData = (PGPPublicKeyEncryptedData) obj; PGPPublicKeyEncryptedData encData = (PGPPublicKeyEncryptedData) obj;
long subKeyId = encData.getKeyID(); long subKeyId = encData.getKeyID();
log.add(LogLevel.DEBUG, LogType.MSG_DC_TRAIL_ASYM, indent, log.add(LogType.MSG_DC_TRAIL_ASYM, indent,
PgpKeyHelper.convertKeyIdToHex(subKeyId)); PgpKeyHelper.convertKeyIdToHex(subKeyId));
} else if (obj instanceof PGPPBEEncryptedData) { } else if (obj instanceof PGPPBEEncryptedData) {
log.add(LogLevel.WARN, LogType.MSG_DC_TRAIL_SYM, indent); log.add(LogType.MSG_DC_TRAIL_SYM, indent);
} else { } else {
log.add(LogLevel.WARN, LogType.MSG_DC_TRAIL_UNKNOWN, indent); log.add(LogType.MSG_DC_TRAIL_UNKNOWN, indent);
} }
} }
log.add(LogLevel.DEBUG, LogType.MSG_DC_PREP_STREAMS, indent); log.add(LogType.MSG_DC_PREP_STREAMS, indent);
// we made sure above one of these two would be true // we made sure above one of these two would be true
if (symmetricPacketFound) { if (symmetricPacketFound) {
@ -407,13 +406,13 @@ public class PgpDecryptVerify {
updateProgress(R.string.progress_extracting_key, currentProgress, 100); updateProgress(R.string.progress_extracting_key, currentProgress, 100);
try { try {
log.add(LogLevel.INFO, LogType.MSG_DC_UNLOCKING, indent +1); log.add(LogType.MSG_DC_UNLOCKING, indent +1);
if (!secretEncryptionKey.unlock(mPassphrase)) { if (!secretEncryptionKey.unlock(mPassphrase)) {
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_BAD_PASSPHRASE, indent +1); log.add(LogType.MSG_DC_ERROR_BAD_PASSPHRASE, indent +1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_EXTRACT_KEY, indent +1); log.add(LogType.MSG_DC_ERROR_EXTRACT_KEY, indent +1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }
@ -425,7 +424,7 @@ public class PgpDecryptVerify {
= secretEncryptionKey.getDecryptorFactory(mDecryptedSessionKey); = secretEncryptionKey.getDecryptorFactory(mDecryptedSessionKey);
clear = encryptedDataAsymmetric.getDataStream(decryptorFactory); clear = encryptedDataAsymmetric.getDataStream(decryptorFactory);
} catch (NfcSyncPublicKeyDataDecryptorFactoryBuilder.NfcInteractionNeeded e) { } catch (NfcSyncPublicKeyDataDecryptorFactoryBuilder.NfcInteractionNeeded e) {
log.add(LogLevel.INFO, LogType.MSG_DC_PENDING_NFC, indent +1); log.add(LogType.MSG_DC_PENDING_NFC, indent +1);
DecryptVerifyResult result = DecryptVerifyResult result =
new DecryptVerifyResult(DecryptVerifyResult.RESULT_PENDING_NFC, log); new DecryptVerifyResult(DecryptVerifyResult.RESULT_PENDING_NFC, log);
result.setNfcEncryptedSessionKey(e.encryptedSessionKey); result.setNfcEncryptedSessionKey(e.encryptedSessionKey);
@ -436,7 +435,7 @@ public class PgpDecryptVerify {
} else { } else {
// If we didn't find any useful data, error out // If we didn't find any useful data, error out
// no packet has been found where we have the corresponding secret key in our db // no packet has been found where we have the corresponding secret key in our db
log.add(LogLevel.ERROR, log.add(
anyPacketFound ? LogType.MSG_DC_ERROR_NO_KEY : LogType.MSG_DC_ERROR_NO_DATA, indent +1); anyPacketFound ? LogType.MSG_DC_ERROR_NO_KEY : LogType.MSG_DC_ERROR_NO_DATA, indent +1);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }
@ -448,11 +447,11 @@ public class PgpDecryptVerify {
CanonicalizedPublicKeyRing signingRing = null; CanonicalizedPublicKeyRing signingRing = null;
CanonicalizedPublicKey signingKey = null; CanonicalizedPublicKey signingKey = null;
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR, indent); log.add(LogType.MSG_DC_CLEAR, indent);
indent += 1; indent += 1;
if (dataChunk instanceof PGPCompressedData) { if (dataChunk instanceof PGPCompressedData) {
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_DECOMPRESS, indent +1); log.add(LogType.MSG_DC_CLEAR_DECOMPRESS, indent +1);
currentProgress += 2; currentProgress += 2;
updateProgress(R.string.progress_decompressing_data, currentProgress, 100); updateProgress(R.string.progress_decompressing_data, currentProgress, 100);
@ -465,7 +464,7 @@ public class PgpDecryptVerify {
PGPOnePassSignature signature = null; PGPOnePassSignature signature = null;
if (dataChunk instanceof PGPOnePassSignatureList) { if (dataChunk instanceof PGPOnePassSignatureList) {
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_SIGNATURE, indent +1); log.add(LogType.MSG_DC_CLEAR_SIGNATURE, indent +1);
currentProgress += 2; currentProgress += 2;
updateProgress(R.string.progress_processing_signature, currentProgress, 100); updateProgress(R.string.progress_processing_signature, currentProgress, 100);
@ -516,7 +515,7 @@ public class PgpDecryptVerify {
OpenPgpMetadata metadata; OpenPgpMetadata metadata;
if (dataChunk instanceof PGPLiteralData) { if (dataChunk instanceof PGPLiteralData) {
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_DATA, indent +1); log.add(LogType.MSG_DC_CLEAR_DATA, indent +1);
indent += 2; indent += 2;
currentProgress += 4; currentProgress += 4;
updateProgress(R.string.progress_decrypting, currentProgress, 100); updateProgress(R.string.progress_decrypting, currentProgress, 100);
@ -559,20 +558,20 @@ public class PgpDecryptVerify {
originalSize); originalSize);
if ( ! originalFilename.equals("")) { if ( ! originalFilename.equals("")) {
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_META_FILE, indent + 1, originalFilename); log.add(LogType.MSG_DC_CLEAR_META_FILE, indent + 1, originalFilename);
} }
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_META_MIME, indent +1, log.add(LogType.MSG_DC_CLEAR_META_MIME, indent +1,
mimeType); mimeType);
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_META_TIME, indent +1, log.add(LogType.MSG_DC_CLEAR_META_TIME, indent +1,
new Date(literalData.getModificationTime().getTime()).toString()); new Date(literalData.getModificationTime().getTime()).toString());
if (originalSize != 0) { if (originalSize != 0) {
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_META_SIZE, indent + 1, log.add(LogType.MSG_DC_CLEAR_META_SIZE, indent + 1,
Long.toString(originalSize)); Long.toString(originalSize));
} }
// return here if we want to decrypt the metadata only // return here if we want to decrypt the metadata only
if (mDecryptMetadataOnly) { if (mDecryptMetadataOnly) {
log.add(LogLevel.OK, LogType.MSG_DC_OK_META_ONLY, indent); log.add(LogType.MSG_DC_OK_META_ONLY, indent);
DecryptVerifyResult result = DecryptVerifyResult result =
new DecryptVerifyResult(DecryptVerifyResult.RESULT_OK, log); new DecryptVerifyResult(DecryptVerifyResult.RESULT_OK, log);
result.setDecryptMetadata(metadata); result.setDecryptMetadata(metadata);
@ -619,7 +618,7 @@ public class PgpDecryptVerify {
if (signature != null) { if (signature != null) {
updateProgress(R.string.progress_verifying_signature, 90, 100); updateProgress(R.string.progress_verifying_signature, 90, 100);
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_SIGNATURE_CHECK, indent); log.add(LogType.MSG_DC_CLEAR_SIGNATURE_CHECK, indent);
PGPSignatureList signatureList = (PGPSignatureList) plainFact.nextObject(); PGPSignatureList signatureList = (PGPSignatureList) plainFact.nextObject();
PGPSignature messageSignature = signatureList.get(signatureIndex); PGPSignature messageSignature = signatureList.get(signatureIndex);
@ -631,9 +630,9 @@ public class PgpDecryptVerify {
// Verify signature and check binding signatures // Verify signature and check binding signatures
boolean validSignature = signature.verify(messageSignature); boolean validSignature = signature.verify(messageSignature);
if (validSignature) { if (validSignature) {
log.add(LogLevel.DEBUG, LogType.MSG_DC_CLEAR_SIGNATURE_OK, indent +1); log.add(LogType.MSG_DC_CLEAR_SIGNATURE_OK, indent +1);
} else { } else {
log.add(LogLevel.WARN, LogType.MSG_DC_CLEAR_SIGNATURE_BAD, indent +1); log.add(LogType.MSG_DC_CLEAR_SIGNATURE_BAD, indent +1);
} }
signatureResultBuilder.setValidSignature(validSignature); signatureResultBuilder.setValidSignature(validSignature);
} }
@ -648,9 +647,9 @@ public class PgpDecryptVerify {
updateProgress(R.string.progress_verifying_integrity, 95, 100); updateProgress(R.string.progress_verifying_integrity, 95, 100);
if (encryptedData.verify()) { if (encryptedData.verify()) {
log.add(LogLevel.INFO, LogType.MSG_DC_INTEGRITY_CHECK_OK, indent); log.add(LogType.MSG_DC_INTEGRITY_CHECK_OK, indent);
} else { } else {
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_INTEGRITY_CHECK, indent); log.add(LogType.MSG_DC_ERROR_INTEGRITY_CHECK, indent);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }
} else { } else {
@ -661,14 +660,14 @@ public class PgpDecryptVerify {
// Handle missing integrity protection like failed integrity protection! // Handle missing integrity protection like failed integrity protection!
// The MDC packet can be stripped by an attacker! // The MDC packet can be stripped by an attacker!
if (!signatureResultBuilder.isValidSignature()) { if (!signatureResultBuilder.isValidSignature()) {
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_INTEGRITY_CHECK, indent); log.add(LogType.MSG_DC_ERROR_INTEGRITY_CHECK, indent);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }
} }
updateProgress(R.string.progress_done, 100, 100); updateProgress(R.string.progress_done, 100, 100);
log.add(LogLevel.OK, LogType.MSG_DC_OK, indent); log.add(LogType.MSG_DC_OK, indent);
// Return a positive result, with metadata and verification info // Return a positive result, with metadata and verification info
DecryptVerifyResult result = DecryptVerifyResult result =
@ -724,7 +723,7 @@ public class PgpDecryptVerify {
PGPSignatureList sigList = (PGPSignatureList) pgpFact.nextObject(); PGPSignatureList sigList = (PGPSignatureList) pgpFact.nextObject();
if (sigList == null) { if (sigList == null) {
log.add(LogLevel.ERROR, LogType.MSG_DC_ERROR_INVALID_SIGLIST, 0); log.add(LogType.MSG_DC_ERROR_INVALID_SIGLIST, 0);
return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log);
} }

View File

@ -33,7 +33,6 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType; import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.service.results.ImportKeyResult; import org.sufficientlysecure.keychain.service.results.ImportKeyResult;
@ -209,7 +208,7 @@ public class PgpImportExport {
} }
} }
if (mCancelled != null && mCancelled.get()) { if (mCancelled != null && mCancelled.get()) {
log.add(LogLevel.CANCELLED, LogType.MSG_OPERATION_CANCELLED, 0); log.add(LogType.MSG_OPERATION_CANCELLED, 0);
resultType |= ImportKeyResult.RESULT_CANCELLED; resultType |= ImportKeyResult.RESULT_CANCELLED;
} }

View File

@ -47,7 +47,6 @@ import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.service.results.OperationResult; import org.sufficientlysecure.keychain.service.results.OperationResult;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType; import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.service.results.EditKeyResult; import org.sufficientlysecure.keychain.service.results.EditKeyResult;
@ -192,16 +191,16 @@ public class PgpKeyOperation {
// Some safety checks // Some safety checks
if (add.mAlgorithm == Algorithm.ECDH || add.mAlgorithm == Algorithm.ECDSA) { if (add.mAlgorithm == Algorithm.ECDH || add.mAlgorithm == Algorithm.ECDSA) {
if (add.mCurve == null) { if (add.mCurve == null) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_NO_CURVE, indent); log.add(LogType.MSG_CR_ERROR_NO_CURVE, indent);
return null; return null;
} }
} else { } else {
if (add.mKeySize == null) { if (add.mKeySize == null) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_NO_KEYSIZE, indent); log.add(LogType.MSG_CR_ERROR_NO_KEYSIZE, indent);
return null; return null;
} }
if (add.mKeySize < 512) { if (add.mKeySize < 512) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_KEYSIZE_512, indent); log.add(LogType.MSG_CR_ERROR_KEYSIZE_512, indent);
return null; return null;
} }
} }
@ -212,7 +211,7 @@ public class PgpKeyOperation {
switch (add.mAlgorithm) { switch (add.mAlgorithm) {
case DSA: { case DSA: {
if ((add.mFlags & (PGPKeyFlags.CAN_ENCRYPT_COMMS | PGPKeyFlags.CAN_ENCRYPT_STORAGE)) > 0) { if ((add.mFlags & (PGPKeyFlags.CAN_ENCRYPT_COMMS | PGPKeyFlags.CAN_ENCRYPT_STORAGE)) > 0) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_FLAGS_DSA, indent); log.add(LogType.MSG_CR_ERROR_FLAGS_DSA, indent);
return null; return null;
} }
progress(R.string.progress_generating_dsa, 30); progress(R.string.progress_generating_dsa, 30);
@ -224,7 +223,7 @@ public class PgpKeyOperation {
case ELGAMAL: { case ELGAMAL: {
if ((add.mFlags & (PGPKeyFlags.CAN_SIGN | PGPKeyFlags.CAN_CERTIFY)) > 0) { if ((add.mFlags & (PGPKeyFlags.CAN_SIGN | PGPKeyFlags.CAN_CERTIFY)) > 0) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_FLAGS_ELGAMAL, indent); log.add(LogType.MSG_CR_ERROR_FLAGS_ELGAMAL, indent);
return null; return null;
} }
progress(R.string.progress_generating_elgamal, 30); progress(R.string.progress_generating_elgamal, 30);
@ -250,7 +249,7 @@ public class PgpKeyOperation {
case ECDSA: { case ECDSA: {
if ((add.mFlags & (PGPKeyFlags.CAN_ENCRYPT_COMMS | PGPKeyFlags.CAN_ENCRYPT_STORAGE)) > 0) { if ((add.mFlags & (PGPKeyFlags.CAN_ENCRYPT_COMMS | PGPKeyFlags.CAN_ENCRYPT_STORAGE)) > 0) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_FLAGS_ECDSA, indent); log.add(LogType.MSG_CR_ERROR_FLAGS_ECDSA, indent);
return null; return null;
} }
progress(R.string.progress_generating_ecdsa, 30); progress(R.string.progress_generating_ecdsa, 30);
@ -265,7 +264,7 @@ public class PgpKeyOperation {
case ECDH: { case ECDH: {
// make sure there are no sign or certify flags set // make sure there are no sign or certify flags set
if ((add.mFlags & (PGPKeyFlags.CAN_SIGN | PGPKeyFlags.CAN_CERTIFY)) > 0) { if ((add.mFlags & (PGPKeyFlags.CAN_SIGN | PGPKeyFlags.CAN_CERTIFY)) > 0) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_FLAGS_ECDH, indent); log.add(LogType.MSG_CR_ERROR_FLAGS_ECDH, indent);
return null; return null;
} }
progress(R.string.progress_generating_ecdh, 30); progress(R.string.progress_generating_ecdh, 30);
@ -278,7 +277,7 @@ public class PgpKeyOperation {
} }
default: { default: {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_UNKNOWN_ALGO, indent); log.add(LogType.MSG_CR_ERROR_UNKNOWN_ALGO, indent);
return null; return null;
} }
} }
@ -289,13 +288,13 @@ public class PgpKeyOperation {
} catch(NoSuchProviderException e) { } catch(NoSuchProviderException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch(NoSuchAlgorithmException e) { } catch(NoSuchAlgorithmException e) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_UNKNOWN_ALGO, indent); log.add(LogType.MSG_CR_ERROR_UNKNOWN_ALGO, indent);
return null; return null;
} catch(InvalidAlgorithmParameterException e) { } catch(InvalidAlgorithmParameterException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch(PGPException e) { } catch(PGPException e) {
Log.e(Constants.TAG, "internal pgp error", e); Log.e(Constants.TAG, "internal pgp error", e);
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_INTERNAL_PGP, indent); log.add(LogType.MSG_CR_ERROR_INTERNAL_PGP, indent);
return null; return null;
} }
} }
@ -307,28 +306,28 @@ public class PgpKeyOperation {
try { try {
log.add(LogLevel.START, LogType.MSG_CR, indent); log.add(LogType.MSG_CR, indent);
progress(R.string.progress_building_key, 0); progress(R.string.progress_building_key, 0);
indent += 1; indent += 1;
if (saveParcel.mAddSubKeys.isEmpty()) { if (saveParcel.mAddSubKeys.isEmpty()) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_NO_MASTER, indent); log.add(LogType.MSG_CR_ERROR_NO_MASTER, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
if (saveParcel.mAddUserIds.isEmpty()) { if (saveParcel.mAddUserIds.isEmpty()) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_NO_USER_ID, indent); log.add(LogType.MSG_CR_ERROR_NO_USER_ID, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
SubkeyAdd add = saveParcel.mAddSubKeys.remove(0); SubkeyAdd add = saveParcel.mAddSubKeys.remove(0);
if ((add.mFlags & KeyFlags.CERTIFY_OTHER) != KeyFlags.CERTIFY_OTHER) { if ((add.mFlags & KeyFlags.CERTIFY_OTHER) != KeyFlags.CERTIFY_OTHER) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_NO_CERTIFY, indent); log.add(LogType.MSG_CR_ERROR_NO_CERTIFY, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
if (add.mExpiry == null) { if (add.mExpiry == null) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_NULL_EXPIRY, indent); log.add(LogType.MSG_CR_ERROR_NULL_EXPIRY, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -363,7 +362,7 @@ public class PgpKeyOperation {
return internal(sKR, masterSecretKey, add.mFlags, add.mExpiry, saveParcel, "", log); return internal(sKR, masterSecretKey, add.mFlags, add.mExpiry, saveParcel, "", log);
} catch (PGPException e) { } catch (PGPException e) {
log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_INTERNAL_PGP, indent); log.add(LogType.MSG_CR_ERROR_INTERNAL_PGP, indent);
Log.e(Constants.TAG, "pgp error encoding key", e); Log.e(Constants.TAG, "pgp error encoding key", e);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} catch (IOException e) { } catch (IOException e) {
@ -405,14 +404,14 @@ public class PgpKeyOperation {
* 6. If requested, change passphrase * 6. If requested, change passphrase
*/ */
log.add(LogLevel.START, LogType.MSG_MF, indent, log.add(LogType.MSG_MF, indent,
PgpKeyHelper.convertKeyIdToHex(wsKR.getMasterKeyId())); PgpKeyHelper.convertKeyIdToHex(wsKR.getMasterKeyId()));
indent += 1; indent += 1;
progress(R.string.progress_building_key, 0); progress(R.string.progress_building_key, 0);
// Make sure this is called with a proper SaveKeyringParcel // Make sure this is called with a proper SaveKeyringParcel
if (saveParcel.mMasterKeyId == null || saveParcel.mMasterKeyId != wsKR.getMasterKeyId()) { if (saveParcel.mMasterKeyId == null || saveParcel.mMasterKeyId != wsKR.getMasterKeyId()) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_KEYID, indent); log.add(LogType.MSG_MF_ERROR_KEYID, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -423,7 +422,7 @@ public class PgpKeyOperation {
// Make sure the fingerprint matches // Make sure the fingerprint matches
if (saveParcel.mFingerprint == null || !Arrays.equals(saveParcel.mFingerprint, if (saveParcel.mFingerprint == null || !Arrays.equals(saveParcel.mFingerprint,
masterSecretKey.getPublicKey().getFingerprint())) { masterSecretKey.getPublicKey().getFingerprint())) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_FINGERPRINT, indent); log.add(LogType.MSG_MF_ERROR_FINGERPRINT, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -451,7 +450,7 @@ public class PgpKeyOperation {
// 1. Unlock private key // 1. Unlock private key
progress(R.string.progress_modify_unlock, 10); progress(R.string.progress_modify_unlock, 10);
log.add(LogLevel.DEBUG, LogType.MSG_MF_UNLOCK, indent); log.add(LogType.MSG_MF_UNLOCK, indent);
PGPPrivateKey masterPrivateKey; PGPPrivateKey masterPrivateKey;
{ {
try { try {
@ -459,7 +458,7 @@ public class PgpKeyOperation {
Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(passphrase.toCharArray()); Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(passphrase.toCharArray());
masterPrivateKey = masterSecretKey.extractPrivateKey(keyDecryptor); masterPrivateKey = masterSecretKey.extractPrivateKey(keyDecryptor);
} catch (PGPException e) { } catch (PGPException e) {
log.add(LogLevel.ERROR, LogType.MSG_MF_UNLOCK_ERROR, indent + 1); log.add(LogType.MSG_MF_UNLOCK_ERROR, indent + 1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
} }
@ -468,7 +467,7 @@ public class PgpKeyOperation {
// Check if we were cancelled // Check if we were cancelled
if (checkCancelled()) { if (checkCancelled()) {
log.add(LogLevel.CANCELLED, LogType.MSG_OPERATION_CANCELLED, indent); log.add(LogType.MSG_OPERATION_CANCELLED, indent);
return new EditKeyResult(EditKeyResult.RESULT_CANCELLED, log, null); return new EditKeyResult(EditKeyResult.RESULT_CANCELLED, log, null);
} }
@ -482,10 +481,10 @@ public class PgpKeyOperation {
progress(R.string.progress_modify_adduid, (i - 1) * (100 / saveParcel.mAddUserIds.size())); progress(R.string.progress_modify_adduid, (i - 1) * (100 / saveParcel.mAddUserIds.size()));
String userId = saveParcel.mAddUserIds.get(i); String userId = saveParcel.mAddUserIds.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_UID_ADD, indent, userId); log.add(LogType.MSG_MF_UID_ADD, indent, userId);
if (userId.equals("")) { if (userId.equals("")) {
log.add(LogLevel.ERROR, LogType.MSG_MF_UID_ERROR_EMPTY, indent + 1); log.add(LogType.MSG_MF_UID_ERROR_EMPTY, indent + 1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -497,7 +496,7 @@ public class PgpKeyOperation {
for (PGPSignature cert : new IterableIterator<PGPSignature>(it)) { for (PGPSignature cert : new IterableIterator<PGPSignature>(it)) {
if (cert.getKeyID() != masterPublicKey.getKeyID()) { if (cert.getKeyID() != masterPublicKey.getKeyID()) {
// foreign certificate?! error error error // foreign certificate?! error error error
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_INTEGRITY, indent); log.add(LogType.MSG_MF_ERROR_INTEGRITY, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
if (cert.getSignatureType() == PGPSignature.CERTIFICATION_REVOCATION if (cert.getSignatureType() == PGPSignature.CERTIFICATION_REVOCATION
@ -527,7 +526,7 @@ public class PgpKeyOperation {
progress(R.string.progress_modify_revokeuid, (i - 1) * (100 / saveParcel.mRevokeUserIds.size())); progress(R.string.progress_modify_revokeuid, (i - 1) * (100 / saveParcel.mRevokeUserIds.size()));
String userId = saveParcel.mRevokeUserIds.get(i); String userId = saveParcel.mRevokeUserIds.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_UID_REVOKE, indent, userId); log.add(LogType.MSG_MF_UID_REVOKE, indent, userId);
// Make sure the user id exists (yes these are 10 LoC in Java!) // Make sure the user id exists (yes these are 10 LoC in Java!)
boolean exists = false; boolean exists = false;
@ -539,7 +538,7 @@ public class PgpKeyOperation {
} }
} }
if (!exists) { if (!exists) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_NOEXIST_REVOKE, indent); log.add(LogType.MSG_MF_ERROR_NOEXIST_REVOKE, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -557,7 +556,7 @@ public class PgpKeyOperation {
// keep track if we actually changed one // keep track if we actually changed one
boolean ok = false; boolean ok = false;
log.add(LogLevel.INFO, LogType.MSG_MF_UID_PRIMARY, indent); log.add(LogType.MSG_MF_UID_PRIMARY, indent);
indent += 1; indent += 1;
// we work on the modifiedPublicKey here, to respect new or newly revoked uids // we work on the modifiedPublicKey here, to respect new or newly revoked uids
@ -570,7 +569,7 @@ public class PgpKeyOperation {
modifiedPublicKey.getSignaturesForID(userId))) { modifiedPublicKey.getSignaturesForID(userId))) {
if (cert.getKeyID() != masterPublicKey.getKeyID()) { if (cert.getKeyID() != masterPublicKey.getKeyID()) {
// foreign certificate?! error error error // foreign certificate?! error error error
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_INTEGRITY, indent); log.add(LogType.MSG_MF_ERROR_INTEGRITY, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
// we know from canonicalization that if there is any revocation here, it // we know from canonicalization that if there is any revocation here, it
@ -591,7 +590,7 @@ public class PgpKeyOperation {
if (currentCert == null) { if (currentCert == null) {
// no certificate found?! error error error // no certificate found?! error error error
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_INTEGRITY, indent); log.add(LogType.MSG_MF_ERROR_INTEGRITY, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -599,7 +598,7 @@ public class PgpKeyOperation {
if (isRevoked) { if (isRevoked) {
// revoked user ids cannot be primary! // revoked user ids cannot be primary!
if (userId.equals(saveParcel.mChangePrimaryUserId)) { if (userId.equals(saveParcel.mChangePrimaryUserId)) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_REVOKED_PRIMARY, indent); log.add(LogType.MSG_MF_ERROR_REVOKED_PRIMARY, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
continue; continue;
@ -614,7 +613,7 @@ public class PgpKeyOperation {
continue; continue;
} }
// otherwise, generate new non-primary certification // otherwise, generate new non-primary certification
log.add(LogLevel.DEBUG, LogType.MSG_MF_PRIMARY_REPLACE_OLD, indent); log.add(LogType.MSG_MF_PRIMARY_REPLACE_OLD, indent);
modifiedPublicKey = PGPPublicKey.removeCertification( modifiedPublicKey = PGPPublicKey.removeCertification(
modifiedPublicKey, userId, currentCert); modifiedPublicKey, userId, currentCert);
PGPSignature newCert = generateUserIdSignature( PGPSignature newCert = generateUserIdSignature(
@ -630,7 +629,7 @@ public class PgpKeyOperation {
// if it should be // if it should be
if (userId.equals(saveParcel.mChangePrimaryUserId)) { if (userId.equals(saveParcel.mChangePrimaryUserId)) {
// add shiny new primary user id certificate // add shiny new primary user id certificate
log.add(LogLevel.DEBUG, LogType.MSG_MF_PRIMARY_NEW, indent); log.add(LogType.MSG_MF_PRIMARY_NEW, indent);
modifiedPublicKey = PGPPublicKey.removeCertification( modifiedPublicKey = PGPPublicKey.removeCertification(
modifiedPublicKey, userId, currentCert); modifiedPublicKey, userId, currentCert);
PGPSignature newCert = generateUserIdSignature( PGPSignature newCert = generateUserIdSignature(
@ -648,7 +647,7 @@ public class PgpKeyOperation {
indent -= 1; indent -= 1;
if (!ok) { if (!ok) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_NOEXIST_PRIMARY, indent); log.add(LogType.MSG_MF_ERROR_NOEXIST_PRIMARY, indent);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
} }
@ -664,7 +663,7 @@ public class PgpKeyOperation {
// Check if we were cancelled - again // Check if we were cancelled - again
if (checkCancelled()) { if (checkCancelled()) {
log.add(LogLevel.CANCELLED, LogType.MSG_OPERATION_CANCELLED, indent); log.add(LogType.MSG_OPERATION_CANCELLED, indent);
return new EditKeyResult(EditKeyResult.RESULT_CANCELLED, log, null); return new EditKeyResult(EditKeyResult.RESULT_CANCELLED, log, null);
} }
@ -674,12 +673,12 @@ public class PgpKeyOperation {
progress(R.string.progress_modify_subkeychange, (i-1) * (100 / saveParcel.mChangeSubKeys.size())); progress(R.string.progress_modify_subkeychange, (i-1) * (100 / saveParcel.mChangeSubKeys.size()));
SaveKeyringParcel.SubkeyChange change = saveParcel.mChangeSubKeys.get(i); SaveKeyringParcel.SubkeyChange change = saveParcel.mChangeSubKeys.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_CHANGE, log.add(LogType.MSG_MF_SUBKEY_CHANGE,
indent, PgpKeyHelper.convertKeyIdToHex(change.mKeyId)); indent, PgpKeyHelper.convertKeyIdToHex(change.mKeyId));
PGPSecretKey sKey = sKR.getSecretKey(change.mKeyId); PGPSecretKey sKey = sKR.getSecretKey(change.mKeyId);
if (sKey == null) { if (sKey == null) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_SUBKEY_MISSING, log.add(LogType.MSG_MF_ERROR_SUBKEY_MISSING,
indent + 1, PgpKeyHelper.convertKeyIdToHex(change.mKeyId)); indent + 1, PgpKeyHelper.convertKeyIdToHex(change.mKeyId));
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -687,7 +686,7 @@ public class PgpKeyOperation {
// expiry must not be in the past // expiry must not be in the past
if (change.mExpiry != null && change.mExpiry != 0 && if (change.mExpiry != null && change.mExpiry != 0 &&
new Date(change.mExpiry*1000).before(new Date())) { new Date(change.mExpiry*1000).before(new Date())) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_PAST_EXPIRY, log.add(LogType.MSG_MF_ERROR_PAST_EXPIRY,
indent + 1, PgpKeyHelper.convertKeyIdToHex(change.mKeyId)); indent + 1, PgpKeyHelper.convertKeyIdToHex(change.mKeyId));
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -698,7 +697,7 @@ public class PgpKeyOperation {
long expiry = change.mExpiry == null ? masterKeyExpiry : change.mExpiry; long expiry = change.mExpiry == null ? masterKeyExpiry : change.mExpiry;
if ((flags & KeyFlags.CERTIFY_OTHER) != KeyFlags.CERTIFY_OTHER) { if ((flags & KeyFlags.CERTIFY_OTHER) != KeyFlags.CERTIFY_OTHER) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_NO_CERTIFY, indent + 1); log.add(LogType.MSG_MF_ERROR_NO_CERTIFY, indent + 1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -755,12 +754,12 @@ public class PgpKeyOperation {
progress(R.string.progress_modify_subkeyrevoke, (i-1) * (100 / saveParcel.mRevokeSubKeys.size())); progress(R.string.progress_modify_subkeyrevoke, (i-1) * (100 / saveParcel.mRevokeSubKeys.size()));
long revocation = saveParcel.mRevokeSubKeys.get(i); long revocation = saveParcel.mRevokeSubKeys.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_REVOKE, log.add(LogType.MSG_MF_SUBKEY_REVOKE,
indent, PgpKeyHelper.convertKeyIdToHex(revocation)); indent, PgpKeyHelper.convertKeyIdToHex(revocation));
PGPSecretKey sKey = sKR.getSecretKey(revocation); PGPSecretKey sKey = sKR.getSecretKey(revocation);
if (sKey == null) { if (sKey == null) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_SUBKEY_MISSING, log.add(LogType.MSG_MF_ERROR_SUBKEY_MISSING,
indent+1, PgpKeyHelper.convertKeyIdToHex(revocation)); indent+1, PgpKeyHelper.convertKeyIdToHex(revocation));
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -780,12 +779,12 @@ public class PgpKeyOperation {
progress(R.string.progress_modify_subkeystrip, (i-1) * (100 / saveParcel.mStripSubKeys.size())); progress(R.string.progress_modify_subkeystrip, (i-1) * (100 / saveParcel.mStripSubKeys.size()));
long strip = saveParcel.mStripSubKeys.get(i); long strip = saveParcel.mStripSubKeys.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_STRIP, log.add(LogType.MSG_MF_SUBKEY_STRIP,
indent, PgpKeyHelper.convertKeyIdToHex(strip)); indent, PgpKeyHelper.convertKeyIdToHex(strip));
PGPSecretKey sKey = sKR.getSecretKey(strip); PGPSecretKey sKey = sKR.getSecretKey(strip);
if (sKey == null) { if (sKey == null) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_SUBKEY_MISSING, log.add(LogType.MSG_MF_ERROR_SUBKEY_MISSING,
indent+1, PgpKeyHelper.convertKeyIdToHex(strip)); indent+1, PgpKeyHelper.convertKeyIdToHex(strip));
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -804,22 +803,22 @@ public class PgpKeyOperation {
// Check if we were cancelled - again. This operation is expensive so we do it each loop. // Check if we were cancelled - again. This operation is expensive so we do it each loop.
if (checkCancelled()) { if (checkCancelled()) {
log.add(LogLevel.CANCELLED, LogType.MSG_OPERATION_CANCELLED, indent); log.add(LogType.MSG_OPERATION_CANCELLED, indent);
return new EditKeyResult(EditKeyResult.RESULT_CANCELLED, log, null); return new EditKeyResult(EditKeyResult.RESULT_CANCELLED, log, null);
} }
progress(R.string.progress_modify_subkeyadd, (i-1) * (100 / saveParcel.mAddSubKeys.size())); progress(R.string.progress_modify_subkeyadd, (i-1) * (100 / saveParcel.mAddSubKeys.size()));
SaveKeyringParcel.SubkeyAdd add = saveParcel.mAddSubKeys.get(i); SaveKeyringParcel.SubkeyAdd add = saveParcel.mAddSubKeys.get(i);
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_NEW, indent, log.add(LogType.MSG_MF_SUBKEY_NEW, indent,
PgpKeyHelper.getAlgorithmInfo(add.mAlgorithm, add.mKeySize, add.mCurve) ); PgpKeyHelper.getAlgorithmInfo(add.mAlgorithm, add.mKeySize, add.mCurve) );
if (add.mExpiry == null) { if (add.mExpiry == null) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_NULL_EXPIRY, indent +1); log.add(LogType.MSG_MF_ERROR_NULL_EXPIRY, indent +1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
if (add.mExpiry > 0L && new Date(add.mExpiry*1000).before(new Date())) { if (add.mExpiry > 0L && new Date(add.mExpiry*1000).before(new Date())) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_PAST_EXPIRY, indent +1); log.add(LogType.MSG_MF_ERROR_PAST_EXPIRY, indent +1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -831,7 +830,7 @@ public class PgpKeyOperation {
PGPKeyPair keyPair = createKey(add, log, indent); PGPKeyPair keyPair = createKey(add, log, indent);
subProgressPop(); subProgressPop();
if (keyPair == null) { if (keyPair == null) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_PGP, indent +1); log.add(LogType.MSG_MF_ERROR_PGP, indent +1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
@ -856,7 +855,7 @@ public class PgpKeyOperation {
sKey = new PGPSecretKey(keyPair.getPrivateKey(), pKey, sha1Calc, false, keyEncryptor); sKey = new PGPSecretKey(keyPair.getPrivateKey(), pKey, sha1Calc, false, keyEncryptor);
} }
log.add(LogLevel.DEBUG, LogType.MSG_MF_SUBKEY_NEW_ID, log.add(LogType.MSG_MF_SUBKEY_NEW_ID,
indent+1, PgpKeyHelper.convertKeyIdToHex(sKey.getKeyID())); indent+1, PgpKeyHelper.convertKeyIdToHex(sKey.getKeyID()));
sKR = PGPSecretKeyRing.insertSecretKey(sKR, sKey); sKR = PGPSecretKeyRing.insertSecretKey(sKR, sKey);
@ -866,14 +865,14 @@ public class PgpKeyOperation {
// Check if we were cancelled - again. This operation is expensive so we do it each loop. // Check if we were cancelled - again. This operation is expensive so we do it each loop.
if (checkCancelled()) { if (checkCancelled()) {
log.add(LogLevel.CANCELLED, LogType.MSG_OPERATION_CANCELLED, indent); log.add(LogType.MSG_OPERATION_CANCELLED, indent);
return new EditKeyResult(EditKeyResult.RESULT_CANCELLED, log, null); return new EditKeyResult(EditKeyResult.RESULT_CANCELLED, log, null);
} }
// 6. If requested, change passphrase // 6. If requested, change passphrase
if (saveParcel.mNewPassphrase != null) { if (saveParcel.mNewPassphrase != null) {
progress(R.string.progress_modify_passphrase, 90); progress(R.string.progress_modify_passphrase, 90);
log.add(LogLevel.INFO, LogType.MSG_MF_PASSPHRASE, indent); log.add(LogType.MSG_MF_PASSPHRASE, indent);
indent += 1; indent += 1;
PGPDigestCalculator encryptorHashCalc = new JcaPGPDigestCalculatorProviderBuilder().build() PGPDigestCalculator encryptorHashCalc = new JcaPGPDigestCalculatorProviderBuilder().build()
@ -888,7 +887,7 @@ public class PgpKeyOperation {
// noinspection unchecked // noinspection unchecked
for (PGPSecretKey sKey : new IterableIterator<PGPSecretKey>(sKR.getSecretKeys())) { for (PGPSecretKey sKey : new IterableIterator<PGPSecretKey>(sKR.getSecretKeys())) {
log.add(LogLevel.DEBUG, LogType.MSG_MF_PASSPHRASE_KEY, indent, log.add(LogType.MSG_MF_PASSPHRASE_KEY, indent,
PgpKeyHelper.convertKeyIdToHex(sKey.getKeyID())); PgpKeyHelper.convertKeyIdToHex(sKey.getKeyID()));
boolean ok = false; boolean ok = false;
@ -901,14 +900,14 @@ public class PgpKeyOperation {
// if this is the master key, error! // if this is the master key, error!
if (sKey.getKeyID() == masterPublicKey.getKeyID()) { if (sKey.getKeyID() == masterPublicKey.getKeyID()) {
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_PASSPHRASE_MASTER, indent+1); log.add(LogType.MSG_MF_ERROR_PASSPHRASE_MASTER, indent+1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
// being in here means decrypt failed, likely due to a bad passphrase try // being in here means decrypt failed, likely due to a bad passphrase try
// again with an empty passphrase, maybe we can salvage this // again with an empty passphrase, maybe we can salvage this
try { try {
log.add(LogLevel.DEBUG, LogType.MSG_MF_PASSPHRASE_EMPTY_RETRY, indent+1); log.add(LogType.MSG_MF_PASSPHRASE_EMPTY_RETRY, indent+1);
PBESecretKeyDecryptor emptyDecryptor = PBESecretKeyDecryptor emptyDecryptor =
new JcePBESecretKeyDecryptorBuilder().setProvider( new JcePBESecretKeyDecryptorBuilder().setProvider(
Constants.BOUNCY_CASTLE_PROVIDER_NAME).build("".toCharArray()); Constants.BOUNCY_CASTLE_PROVIDER_NAME).build("".toCharArray());
@ -921,7 +920,7 @@ public class PgpKeyOperation {
if (!ok) { if (!ok) {
// for a subkey, it's merely a warning // for a subkey, it's merely a warning
log.add(LogLevel.WARN, LogType.MSG_MF_PASSPHRASE_FAIL, indent+1, log.add(LogType.MSG_MF_PASSPHRASE_FAIL, indent+1,
PgpKeyHelper.convertKeyIdToHex(sKey.getKeyID())); PgpKeyHelper.convertKeyIdToHex(sKey.getKeyID()));
continue; continue;
} }
@ -935,20 +934,20 @@ public class PgpKeyOperation {
} catch (IOException e) { } catch (IOException e) {
Log.e(Constants.TAG, "encountered IOException while modifying key", e); Log.e(Constants.TAG, "encountered IOException while modifying key", e);
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_ENCODE, indent+1); log.add(LogType.MSG_MF_ERROR_ENCODE, indent+1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} catch (PGPException e) { } catch (PGPException e) {
Log.e(Constants.TAG, "encountered pgp error while modifying key", e); Log.e(Constants.TAG, "encountered pgp error while modifying key", e);
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_PGP, indent+1); log.add(LogType.MSG_MF_ERROR_PGP, indent+1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} catch (SignatureException e) { } catch (SignatureException e) {
Log.e(Constants.TAG, "encountered SignatureException while modifying key", e); Log.e(Constants.TAG, "encountered SignatureException while modifying key", e);
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_SIG, indent+1); log.add(LogType.MSG_MF_ERROR_SIG, indent+1);
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null); return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);
} }
progress(R.string.progress_done, 100); progress(R.string.progress_done, 100);
log.add(LogLevel.OK, LogType.MSG_MF_SUCCESS, indent); log.add(LogType.MSG_MF_SUCCESS, indent);
return new EditKeyResult(OperationResult.RESULT_OK, log, new UncachedKeyRing(sKR)); return new EditKeyResult(OperationResult.RESULT_OK, log, new UncachedKeyRing(sKR));
} }
@ -961,7 +960,7 @@ public class PgpKeyOperation {
// keep track if we actually changed one // keep track if we actually changed one
boolean ok = false; boolean ok = false;
log.add(LogLevel.DEBUG, LogType.MSG_MF_MASTER, indent); log.add(LogType.MSG_MF_MASTER, indent);
indent += 1; indent += 1;
PGPPublicKey modifiedPublicKey = masterPublicKey; PGPPublicKey modifiedPublicKey = masterPublicKey;
@ -976,7 +975,7 @@ public class PgpKeyOperation {
modifiedPublicKey.getSignaturesForID(userId))) { modifiedPublicKey.getSignaturesForID(userId))) {
if (cert.getKeyID() != masterPublicKey.getKeyID()) { if (cert.getKeyID() != masterPublicKey.getKeyID()) {
// foreign certificate?! error error error // foreign certificate?! error error error
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_INTEGRITY, indent); log.add(LogType.MSG_MF_ERROR_INTEGRITY, indent);
return null; return null;
} }
// we know from canonicalization that if there is any revocation here, it // we know from canonicalization that if there is any revocation here, it
@ -997,7 +996,7 @@ public class PgpKeyOperation {
if (currentCert == null) { if (currentCert == null) {
// no certificate found?! error error error // no certificate found?! error error error
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_INTEGRITY, indent); log.add(LogType.MSG_MF_ERROR_INTEGRITY, indent);
return null; return null;
} }
@ -1021,7 +1020,7 @@ public class PgpKeyOperation {
if (!ok) { if (!ok) {
// might happen, theoretically, if there is a key with no uid.. // might happen, theoretically, if there is a key with no uid..
log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_MASTER_NONE, indent); log.add(LogType.MSG_MF_ERROR_MASTER_NONE, indent);
return null; return null;
} }

View File

@ -36,7 +36,6 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType; import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.service.results.SignEncryptResult; import org.sufficientlysecure.keychain.service.results.SignEncryptResult;
@ -258,7 +257,7 @@ public class PgpSignEncrypt {
int indent = 0; int indent = 0;
OperationLog log = new OperationLog(); OperationLog log = new OperationLog();
log.add(LogLevel.START, LogType.MSG_SE, indent); log.add(LogType.MSG_SE, indent);
indent += 1; indent += 1;
boolean enableSignature = mSignatureMasterKeyId != Constants.key.none; boolean enableSignature = mSignatureMasterKeyId != Constants.key.none;
@ -295,7 +294,7 @@ public class PgpSignEncrypt {
// If we weren't handed a passphrase, throw early // If we weren't handed a passphrase, throw early
if (mSignaturePassphrase == null) { if (mSignaturePassphrase == null) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_NO_PASSPHRASE, indent); log.add(LogType.MSG_SE_ERROR_NO_PASSPHRASE, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} }
@ -308,13 +307,13 @@ public class PgpSignEncrypt {
signingKey = signingKeyRing.getSecretKey(signKeyId); signingKey = signingKeyRing.getSecretKey(signKeyId);
// make sure it's a signing key alright! // make sure it's a signing key alright!
} catch (ProviderHelper.NotFoundException e) { } catch (ProviderHelper.NotFoundException e) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_SIGN_KEY, indent); log.add(LogType.MSG_SE_ERROR_SIGN_KEY, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} }
// Make sure we are allowed to sign here! // Make sure we are allowed to sign here!
if (!signingKey.canSign()) { if (!signingKey.canSign()) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_KEY_SIGN, indent); log.add(LogType.MSG_SE_ERROR_KEY_SIGN, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} }
@ -322,11 +321,11 @@ public class PgpSignEncrypt {
try { try {
if (!signingKey.unlock(mSignaturePassphrase)) { if (!signingKey.unlock(mSignaturePassphrase)) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_BAD_PASSPHRASE, indent); log.add(LogType.MSG_SE_ERROR_BAD_PASSPHRASE, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} }
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_UNLOCK, indent); log.add(LogType.MSG_SE_ERROR_UNLOCK, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} }
@ -352,13 +351,13 @@ public class PgpSignEncrypt {
if (mSymmetricPassphrase != null) { if (mSymmetricPassphrase != null) {
// Symmetric encryption // Symmetric encryption
log.add(LogLevel.DEBUG, LogType.MSG_SE_SYMMETRIC, indent); log.add(LogType.MSG_SE_SYMMETRIC, indent);
JcePBEKeyEncryptionMethodGenerator symmetricEncryptionGenerator = JcePBEKeyEncryptionMethodGenerator symmetricEncryptionGenerator =
new JcePBEKeyEncryptionMethodGenerator(mSymmetricPassphrase.toCharArray()); new JcePBEKeyEncryptionMethodGenerator(mSymmetricPassphrase.toCharArray());
cPk.addMethod(symmetricEncryptionGenerator); cPk.addMethod(symmetricEncryptionGenerator);
} else { } else {
log.add(LogLevel.INFO, LogType.MSG_SE_ASYMMETRIC, indent); log.add(LogType.MSG_SE_ASYMMETRIC, indent);
// Asymmetric encryption // Asymmetric encryption
for (long id : mEncryptionMasterKeyIds) { for (long id : mEncryptionMasterKeyIds) {
@ -367,13 +366,13 @@ public class PgpSignEncrypt {
KeyRings.buildUnifiedKeyRingUri(id)); KeyRings.buildUnifiedKeyRingUri(id));
CanonicalizedPublicKey key = keyRing.getEncryptionSubKey(); CanonicalizedPublicKey key = keyRing.getEncryptionSubKey();
cPk.addMethod(key.getPubKeyEncryptionGenerator()); cPk.addMethod(key.getPubKeyEncryptionGenerator());
log.add(LogLevel.DEBUG, LogType.MSG_SE_KEY_OK, indent + 1, log.add(LogType.MSG_SE_KEY_OK, indent + 1,
PgpKeyHelper.convertKeyIdToHex(id)); PgpKeyHelper.convertKeyIdToHex(id));
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
log.add(LogLevel.WARN, LogType.MSG_SE_KEY_WARN, indent +1, log.add(LogType.MSG_SE_KEY_WARN, indent +1,
PgpKeyHelper.convertKeyIdToHex(id)); PgpKeyHelper.convertKeyIdToHex(id));
} catch (ProviderHelper.NotFoundException e) { } catch (ProviderHelper.NotFoundException e) {
log.add(LogLevel.WARN, LogType.MSG_SE_KEY_UNKNOWN, indent +1, log.add(LogType.MSG_SE_KEY_UNKNOWN, indent +1,
PgpKeyHelper.convertKeyIdToHex(id)); PgpKeyHelper.convertKeyIdToHex(id));
} }
} }
@ -390,7 +389,7 @@ public class PgpSignEncrypt {
signatureGenerator = signingKey.getSignatureGenerator( signatureGenerator = signingKey.getSignatureGenerator(
mSignatureHashAlgorithm, cleartext, mNfcSignedHash, mNfcCreationTimestamp); mSignatureHashAlgorithm, cleartext, mNfcSignedHash, mNfcCreationTimestamp);
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_NFC, indent); log.add(LogType.MSG_SE_ERROR_NFC, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} }
} }
@ -407,7 +406,7 @@ public class PgpSignEncrypt {
if (enableEncryption) { if (enableEncryption) {
/* actual encryption */ /* actual encryption */
updateProgress(R.string.progress_encrypting, 8, 100); updateProgress(R.string.progress_encrypting, 8, 100);
log.add(LogLevel.DEBUG, enableSignature log.add(enableSignature
? LogType.MSG_SE_SIGCRYPTING ? LogType.MSG_SE_SIGCRYPTING
: LogType.MSG_SE_ENCRYPTING, : LogType.MSG_SE_ENCRYPTING,
indent); indent);
@ -416,7 +415,7 @@ public class PgpSignEncrypt {
encryptionOut = cPk.open(out, new byte[1 << 16]); encryptionOut = cPk.open(out, new byte[1 << 16]);
if (enableCompression) { if (enableCompression) {
log.add(LogLevel.DEBUG, LogType.MSG_SE_COMPRESSING, indent); log.add(LogType.MSG_SE_COMPRESSING, indent);
compressGen = new PGPCompressedDataGenerator(mCompressionId); compressGen = new PGPCompressedDataGenerator(mCompressionId);
bcpgOut = new BCPGOutputStream(compressGen.open(encryptionOut)); bcpgOut = new BCPGOutputStream(compressGen.open(encryptionOut));
} else { } else {
@ -463,7 +462,7 @@ public class PgpSignEncrypt {
/* cleartext signature: sign-only of ascii text */ /* cleartext signature: sign-only of ascii text */
updateProgress(R.string.progress_signing, 8, 100); updateProgress(R.string.progress_signing, 8, 100);
log.add(LogLevel.DEBUG, LogType.MSG_SE_SIGNING, indent); log.add(LogType.MSG_SE_SIGNING, indent);
// write -----BEGIN PGP SIGNED MESSAGE----- // write -----BEGIN PGP SIGNED MESSAGE-----
armorOut.beginClearText(mSignatureHashAlgorithm); armorOut.beginClearText(mSignatureHashAlgorithm);
@ -498,7 +497,7 @@ public class PgpSignEncrypt {
/* sign-only binary (files/data stream) */ /* sign-only binary (files/data stream) */
updateProgress(R.string.progress_signing, 8, 100); updateProgress(R.string.progress_signing, 8, 100);
log.add(LogLevel.DEBUG, LogType.MSG_SE_ENCRYPTING, indent); log.add(LogType.MSG_SE_ENCRYPTING, indent);
InputStream in = mData.getInputStream(); InputStream in = mData.getInputStream();
@ -533,7 +532,7 @@ public class PgpSignEncrypt {
literalGen.close(); literalGen.close();
} else { } else {
pOut = null; pOut = null;
log.add(LogLevel.WARN, LogType.MSG_SE_CLEARSIGN_ONLY, indent); log.add(LogType.MSG_SE_CLEARSIGN_ONLY, indent);
} }
if (enableSignature) { if (enableSignature) {
@ -542,7 +541,7 @@ public class PgpSignEncrypt {
signatureGenerator.generate().encode(pOut); signatureGenerator.generate().encode(pOut);
} catch (NfcSyncPGPContentSignerBuilder.NfcInteractionNeeded e) { } catch (NfcSyncPGPContentSignerBuilder.NfcInteractionNeeded e) {
// this secret key diverts to a OpenPGP card, throw exception with hash that will be signed // this secret key diverts to a OpenPGP card, throw exception with hash that will be signed
log.add(LogLevel.OK, LogType.MSG_SE_PENDING_NFC, indent); log.add(LogType.MSG_SE_PENDING_NFC, indent);
SignEncryptResult result = SignEncryptResult result =
new SignEncryptResult(SignEncryptResult.RESULT_PENDING_NFC, log); new SignEncryptResult(SignEncryptResult.RESULT_PENDING_NFC, log);
result.setNfcData(e.hashToSign, e.hashAlgo, e.creationTimestamp); result.setNfcData(e.hashToSign, e.hashAlgo, e.creationTimestamp);
@ -568,19 +567,19 @@ public class PgpSignEncrypt {
mOutStream.close(); mOutStream.close();
} catch (SignatureException e) { } catch (SignatureException e) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_SIG, indent); log.add(LogType.MSG_SE_ERROR_SIG, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} catch (PGPException e) { } catch (PGPException e) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_PGP, indent); log.add(LogType.MSG_SE_ERROR_PGP, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} catch (IOException e) { } catch (IOException e) {
log.add(LogLevel.ERROR, LogType.MSG_SE_ERROR_IO, indent); log.add(LogType.MSG_SE_ERROR_IO, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log);
} }
updateProgress(R.string.progress_done, 100, 100); updateProgress(R.string.progress_done, 100, 100);
log.add(LogLevel.OK, LogType.MSG_SE_OK, indent); log.add(LogType.MSG_SE_OK, indent);
return new SignEncryptResult(SignEncryptResult.RESULT_OK, log); return new SignEncryptResult(SignEncryptResult.RESULT_OK, log);
} }

View File

@ -36,7 +36,6 @@ import org.spongycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
import org.spongycastle.util.Strings; import org.spongycastle.util.Strings;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType; import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.util.IterableIterator; import org.sufficientlysecure.keychain.util.IterableIterator;
@ -260,13 +259,13 @@ public class UncachedKeyRing {
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
public CanonicalizedKeyRing canonicalize(OperationLog log, int indent) { public CanonicalizedKeyRing canonicalize(OperationLog log, int indent) {
log.add(LogLevel.START, isSecret() ? LogType.MSG_KC_SECRET : LogType.MSG_KC_PUBLIC, log.add(isSecret() ? LogType.MSG_KC_SECRET : LogType.MSG_KC_PUBLIC,
indent, PgpKeyHelper.convertKeyIdToHex(getMasterKeyId())); indent, PgpKeyHelper.convertKeyIdToHex(getMasterKeyId()));
indent += 1; indent += 1;
// do not accept v3 keys // do not accept v3 keys
if (getVersion() <= 3) { if (getVersion() <= 3) {
log.add(LogLevel.ERROR, LogType.MSG_KC_ERROR_V3, indent); log.add(LogType.MSG_KC_ERROR_V3, indent);
return null; return null;
} }
@ -279,13 +278,13 @@ public class UncachedKeyRing {
final long masterKeyId = masterKey.getKeyID(); final long masterKeyId = masterKey.getKeyID();
if (Arrays.binarySearch(KNOWN_ALGORITHMS, masterKey.getAlgorithm()) < 0) { if (Arrays.binarySearch(KNOWN_ALGORITHMS, masterKey.getAlgorithm()) < 0) {
log.add(LogLevel.ERROR, LogType.MSG_KC_ERROR_MASTER_ALGO, indent, log.add(LogType.MSG_KC_ERROR_MASTER_ALGO, indent,
Integer.toString(masterKey.getAlgorithm())); Integer.toString(masterKey.getAlgorithm()));
return null; return null;
} }
{ {
log.add(LogLevel.DEBUG, LogType.MSG_KC_MASTER, log.add(LogType.MSG_KC_MASTER,
indent, PgpKeyHelper.convertKeyIdToHex(masterKey.getKeyID())); indent, PgpKeyHelper.convertKeyIdToHex(masterKey.getKeyID()));
indent += 1; indent += 1;
@ -300,7 +299,7 @@ public class UncachedKeyRing {
|| type == PGPSignature.CASUAL_CERTIFICATION || type == PGPSignature.CASUAL_CERTIFICATION
|| type == PGPSignature.POSITIVE_CERTIFICATION || type == PGPSignature.POSITIVE_CERTIFICATION
|| type == PGPSignature.CERTIFICATION_REVOCATION) { || type == PGPSignature.CERTIFICATION_REVOCATION) {
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TYPE_UID, indent); log.add(LogType.MSG_KC_REVOKE_BAD_TYPE_UID, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, zert);
badCerts += 1; badCerts += 1;
continue; continue;
@ -309,7 +308,7 @@ public class UncachedKeyRing {
if (type != PGPSignature.KEY_REVOCATION) { if (type != PGPSignature.KEY_REVOCATION) {
// Unknown type, just remove // Unknown type, just remove
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TYPE, indent, "0x" + Integer.toString(type, 16)); log.add(LogType.MSG_KC_REVOKE_BAD_TYPE, indent, "0x" + Integer.toString(type, 16));
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, zert);
badCerts += 1; badCerts += 1;
continue; continue;
@ -317,7 +316,7 @@ public class UncachedKeyRing {
if (cert.getCreationTime().after(now)) { if (cert.getCreationTime().after(now)) {
// Creation date in the future? No way! // Creation date in the future? No way!
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TIME, indent); log.add(LogType.MSG_KC_REVOKE_BAD_TIME, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, zert);
badCerts += 1; badCerts += 1;
continue; continue;
@ -325,7 +324,7 @@ public class UncachedKeyRing {
if (cert.isLocal()) { if (cert.isLocal()) {
// Creation date in the future? No way! // Creation date in the future? No way!
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_LOCAL, indent); log.add(LogType.MSG_KC_REVOKE_BAD_LOCAL, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, zert);
badCerts += 1; badCerts += 1;
continue; continue;
@ -334,13 +333,13 @@ public class UncachedKeyRing {
try { try {
cert.init(masterKey); cert.init(masterKey);
if (!cert.verifySignature(masterKey)) { if (!cert.verifySignature(masterKey)) {
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD, indent); log.add(LogType.MSG_KC_REVOKE_BAD, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, zert);
badCerts += 1; badCerts += 1;
continue; continue;
} }
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_ERR, indent); log.add(LogType.MSG_KC_REVOKE_BAD_ERR, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, zert);
badCerts += 1; badCerts += 1;
continue; continue;
@ -351,12 +350,12 @@ public class UncachedKeyRing {
revocation = zert; revocation = zert;
// more revocations? at least one is superfluous, then. // more revocations? at least one is superfluous, then.
} else if (revocation.getCreationTime().before(zert.getCreationTime())) { } else if (revocation.getCreationTime().before(zert.getCreationTime())) {
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, indent); log.add(LogType.MSG_KC_REVOKE_DUP, indent);
modified = PGPPublicKey.removeCertification(modified, revocation); modified = PGPPublicKey.removeCertification(modified, revocation);
redundantCerts += 1; redundantCerts += 1;
revocation = zert; revocation = zert;
} else { } else {
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, indent); log.add(LogType.MSG_KC_REVOKE_DUP, indent);
modified = PGPPublicKey.removeCertification(modified, zert); modified = PGPPublicKey.removeCertification(modified, zert);
redundantCerts += 1; redundantCerts += 1;
} }
@ -368,7 +367,7 @@ public class UncachedKeyRing {
// check for duplicate user ids // check for duplicate user ids
if (processedUserIds.contains(rawUserId)) { if (processedUserIds.contains(rawUserId)) {
log.add(LogLevel.WARN, LogType.MSG_KC_UID_DUP, log.add(LogType.MSG_KC_UID_DUP,
indent, userId); indent, userId);
// strip out the first found user id with this name // strip out the first found user id with this name
modified = PGPPublicKey.removeCertification(modified, rawUserId); modified = PGPPublicKey.removeCertification(modified, rawUserId);
@ -392,7 +391,7 @@ public class UncachedKeyRing {
&& type != PGPSignature.CASUAL_CERTIFICATION && type != PGPSignature.CASUAL_CERTIFICATION
&& type != PGPSignature.POSITIVE_CERTIFICATION && type != PGPSignature.POSITIVE_CERTIFICATION
&& type != PGPSignature.CERTIFICATION_REVOCATION) { && type != PGPSignature.CERTIFICATION_REVOCATION) {
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_TYPE, log.add(LogType.MSG_KC_UID_BAD_TYPE,
indent, "0x" + Integer.toString(zert.getSignatureType(), 16)); indent, "0x" + Integer.toString(zert.getSignatureType(), 16));
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
badCerts += 1; badCerts += 1;
@ -401,7 +400,7 @@ public class UncachedKeyRing {
if (cert.getCreationTime().after(now)) { if (cert.getCreationTime().after(now)) {
// Creation date in the future? No way! // Creation date in the future? No way!
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_TIME, indent); log.add(LogType.MSG_KC_UID_BAD_TIME, indent);
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
badCerts += 1; badCerts += 1;
continue; continue;
@ -409,7 +408,7 @@ public class UncachedKeyRing {
if (cert.isLocal()) { if (cert.isLocal()) {
// Creation date in the future? No way! // Creation date in the future? No way!
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_LOCAL, indent); log.add(LogType.MSG_KC_UID_BAD_LOCAL, indent);
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
badCerts += 1; badCerts += 1;
continue; continue;
@ -419,7 +418,7 @@ public class UncachedKeyRing {
if (certId != masterKeyId) { if (certId != masterKeyId) {
// never mind any further for public keys, but remove them from secret ones // never mind any further for public keys, but remove them from secret ones
if (isSecret()) { if (isSecret()) {
log.add(LogLevel.WARN, LogType.MSG_KC_UID_FOREIGN, log.add(LogType.MSG_KC_UID_FOREIGN,
indent, PgpKeyHelper.convertKeyIdToHex(certId)); indent, PgpKeyHelper.convertKeyIdToHex(certId));
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
badCerts += 1; badCerts += 1;
@ -431,7 +430,7 @@ public class UncachedKeyRing {
try { try {
cert.init(masterKey); cert.init(masterKey);
if (!cert.verifySignature(masterKey, rawUserId)) { if (!cert.verifySignature(masterKey, rawUserId)) {
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD, log.add(LogType.MSG_KC_UID_BAD,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
badCerts += 1; badCerts += 1;
@ -439,10 +438,10 @@ public class UncachedKeyRing {
} }
// warn user if the signature was made with bad encoding // warn user if the signature was made with bad encoding
if (!cert.verifySignature(masterKey, userId)) { if (!cert.verifySignature(masterKey, userId)) {
log.add(LogLevel.WARN, LogType.MSG_KC_UID_WARN_ENCODING, indent); log.add(LogType.MSG_KC_UID_WARN_ENCODING, indent);
} }
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_ERR, log.add(LogType.MSG_KC_UID_BAD_ERR,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
badCerts += 1; badCerts += 1;
@ -457,13 +456,13 @@ public class UncachedKeyRing {
if (selfCert == null) { if (selfCert == null) {
selfCert = zert; selfCert = zert;
} else if (selfCert.getCreationTime().before(cert.getCreationTime())) { } else if (selfCert.getCreationTime().before(cert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_CERT_DUP, log.add(LogType.MSG_KC_UID_CERT_DUP,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId, selfCert); modified = PGPPublicKey.removeCertification(modified, rawUserId, selfCert);
redundantCerts += 1; redundantCerts += 1;
selfCert = zert; selfCert = zert;
} else { } else {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_CERT_DUP, log.add(LogType.MSG_KC_UID_CERT_DUP,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
redundantCerts += 1; redundantCerts += 1;
@ -471,7 +470,7 @@ public class UncachedKeyRing {
// If there is a revocation certificate, and it's older than this, drop it // If there is a revocation certificate, and it's older than this, drop it
if (revocation != null if (revocation != null
&& revocation.getCreationTime().before(selfCert.getCreationTime())) { && revocation.getCreationTime().before(selfCert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_OLD, log.add(LogType.MSG_KC_UID_REVOKE_OLD,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId, revocation); modified = PGPPublicKey.removeCertification(modified, rawUserId, revocation);
revocation = null; revocation = null;
@ -482,7 +481,7 @@ public class UncachedKeyRing {
case PGPSignature.CERTIFICATION_REVOCATION: case PGPSignature.CERTIFICATION_REVOCATION:
// If this is older than the (latest) self cert, drop it // If this is older than the (latest) self cert, drop it
if (selfCert != null && selfCert.getCreationTime().after(zert.getCreationTime())) { if (selfCert != null && selfCert.getCreationTime().after(zert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_OLD, log.add(LogType.MSG_KC_UID_REVOKE_OLD,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
redundantCerts += 1; redundantCerts += 1;
@ -493,13 +492,13 @@ public class UncachedKeyRing {
revocation = zert; revocation = zert;
// more revocations? at least one is superfluous, then. // more revocations? at least one is superfluous, then.
} else if (revocation.getCreationTime().before(cert.getCreationTime())) { } else if (revocation.getCreationTime().before(cert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_DUP, log.add(LogType.MSG_KC_UID_REVOKE_DUP,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId, revocation); modified = PGPPublicKey.removeCertification(modified, rawUserId, revocation);
redundantCerts += 1; redundantCerts += 1;
revocation = zert; revocation = zert;
} else { } else {
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_DUP, log.add(LogType.MSG_KC_UID_REVOKE_DUP,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId, zert); modified = PGPPublicKey.removeCertification(modified, rawUserId, zert);
redundantCerts += 1; redundantCerts += 1;
@ -511,7 +510,7 @@ public class UncachedKeyRing {
// If no valid certificate (if only a revocation) remains, drop it // If no valid certificate (if only a revocation) remains, drop it
if (selfCert == null && revocation == null) { if (selfCert == null && revocation == null) {
log.add(LogLevel.ERROR, LogType.MSG_KC_UID_REMOVE, log.add(LogType.MSG_KC_UID_REMOVE,
indent, userId); indent, userId);
modified = PGPPublicKey.removeCertification(modified, rawUserId); modified = PGPPublicKey.removeCertification(modified, rawUserId);
} }
@ -519,7 +518,7 @@ public class UncachedKeyRing {
// If NO user ids remain, error out! // If NO user ids remain, error out!
if (modified == null || !modified.getUserIDs().hasNext()) { if (modified == null || !modified.getUserIDs().hasNext()) {
log.add(LogLevel.ERROR, LogType.MSG_KC_ERROR_NO_UID, indent); log.add(LogType.MSG_KC_ERROR_NO_UID, indent);
return null; return null;
} }
@ -535,14 +534,14 @@ public class UncachedKeyRing {
if (key.isMasterKey()) { if (key.isMasterKey()) {
continue; continue;
} }
log.add(LogLevel.DEBUG, LogType.MSG_KC_SUB, log.add(LogType.MSG_KC_SUB,
indent, PgpKeyHelper.convertKeyIdToHex(key.getKeyID())); indent, PgpKeyHelper.convertKeyIdToHex(key.getKeyID()));
indent += 1; indent += 1;
if (Arrays.binarySearch(KNOWN_ALGORITHMS, key.getAlgorithm()) < 0) { if (Arrays.binarySearch(KNOWN_ALGORITHMS, key.getAlgorithm()) < 0) {
ring = removeSubKey(ring, key); ring = removeSubKey(ring, key);
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_UNKNOWN_ALGO, indent, log.add(LogType.MSG_KC_SUB_UNKNOWN_ALGO, indent,
Integer.toString(key.getAlgorithm())); Integer.toString(key.getAlgorithm()));
indent -= 1; indent -= 1;
continue; continue;
@ -561,27 +560,27 @@ public class UncachedKeyRing {
// filter out bad key types... // filter out bad key types...
if (cert.getKeyId() != masterKey.getKeyID()) { if (cert.getKeyId() != masterKey.getKeyID()) {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_KEYID, indent); log.add(LogType.MSG_KC_SUB_BAD_KEYID, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
if (type != PGPSignature.SUBKEY_BINDING && type != PGPSignature.SUBKEY_REVOCATION) { if (type != PGPSignature.SUBKEY_BINDING && type != PGPSignature.SUBKEY_REVOCATION) {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_TYPE, indent, "0x" + Integer.toString(type, 16)); log.add(LogType.MSG_KC_SUB_BAD_TYPE, indent, "0x" + Integer.toString(type, 16));
badCerts += 1; badCerts += 1;
continue; continue;
} }
if (cert.getCreationTime().after(now)) { if (cert.getCreationTime().after(now)) {
// Creation date in the future? No way! // Creation date in the future? No way!
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_TIME, indent); log.add(LogType.MSG_KC_SUB_BAD_TIME, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
if (cert.isLocal()) { if (cert.isLocal()) {
// Creation date in the future? No way! // Creation date in the future? No way!
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_LOCAL, indent); log.add(LogType.MSG_KC_SUB_BAD_LOCAL, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
@ -592,12 +591,12 @@ public class UncachedKeyRing {
try { try {
cert.init(masterKey); cert.init(masterKey);
if (!cert.verifySignature(masterKey, key)) { if (!cert.verifySignature(masterKey, key)) {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD, indent); log.add(LogType.MSG_KC_SUB_BAD, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_ERR, indent); log.add(LogType.MSG_KC_SUB_BAD_ERR, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
@ -620,20 +619,20 @@ public class UncachedKeyRing {
if (subsig.verifySignature(masterKey, key)) { if (subsig.verifySignature(masterKey, key)) {
ok = true; ok = true;
} else { } else {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_BAD, indent); log.add(LogType.MSG_KC_SUB_PRIMARY_BAD, indent);
badCerts += 1; badCerts += 1;
continue uids; continue uids;
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_BAD_ERR, indent); log.add(LogType.MSG_KC_SUB_PRIMARY_BAD_ERR, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
// if it doesn't, get rid of this! // if it doesn't, get rid of this!
if (!ok) { if (!ok) {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_NONE, indent); log.add(LogType.MSG_KC_SUB_PRIMARY_NONE, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
@ -643,7 +642,7 @@ public class UncachedKeyRing {
// if we already have a cert, and this one is older: skip it // if we already have a cert, and this one is older: skip it
if (selfCert != null && cert.getCreationTime().before(selfCert.getCreationTime())) { if (selfCert != null && cert.getCreationTime().before(selfCert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_SUB_DUP, indent); log.add(LogType.MSG_KC_SUB_DUP, indent);
redundantCerts += 1; redundantCerts += 1;
continue; continue;
} }
@ -651,7 +650,7 @@ public class UncachedKeyRing {
selfCert = zert; selfCert = zert;
// if this is newer than a possibly existing revocation, drop that one // if this is newer than a possibly existing revocation, drop that one
if (revocation != null && selfCert.getCreationTime().after(revocation.getCreationTime())) { if (revocation != null && selfCert.getCreationTime().after(revocation.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_SUB_REVOKE_DUP, indent); log.add(LogType.MSG_KC_SUB_REVOKE_DUP, indent);
redundantCerts += 1; redundantCerts += 1;
revocation = null; revocation = null;
} }
@ -663,19 +662,19 @@ public class UncachedKeyRing {
try { try {
cert.init(masterKey); cert.init(masterKey);
if (!cert.verifySignature(masterKey, key)) { if (!cert.verifySignature(masterKey, key)) {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_REVOKE_BAD, indent); log.add(LogType.MSG_KC_SUB_REVOKE_BAD, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_REVOKE_BAD_ERR, indent); log.add(LogType.MSG_KC_SUB_REVOKE_BAD_ERR, indent);
badCerts += 1; badCerts += 1;
continue; continue;
} }
// if there is a certification that is newer than this revocation, don't bother // if there is a certification that is newer than this revocation, don't bother
if (selfCert != null && selfCert.getCreationTime().after(cert.getCreationTime())) { if (selfCert != null && selfCert.getCreationTime().after(cert.getCreationTime())) {
log.add(LogLevel.DEBUG, LogType.MSG_KC_SUB_REVOKE_DUP, indent); log.add(LogType.MSG_KC_SUB_REVOKE_DUP, indent);
redundantCerts += 1; redundantCerts += 1;
continue; continue;
} }
@ -688,7 +687,7 @@ public class UncachedKeyRing {
if (selfCert == null) { if (selfCert == null) {
ring = removeSubKey(ring, key); ring = removeSubKey(ring, key);
log.add(LogLevel.ERROR, LogType.MSG_KC_SUB_NO_CERT, log.add(LogType.MSG_KC_SUB_NO_CERT,
indent, PgpKeyHelper.convertKeyIdToHex(key.getKeyID())); indent, PgpKeyHelper.convertKeyIdToHex(key.getKeyID()));
indent -= 1; indent -= 1;
continue; continue;
@ -707,16 +706,16 @@ public class UncachedKeyRing {
if (badCerts > 0 && redundantCerts > 0) { if (badCerts > 0 && redundantCerts > 0) {
// multi plural would make this complex, just leaving this as is... // multi plural would make this complex, just leaving this as is...
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS_BAD_AND_RED, log.add(LogType.MSG_KC_SUCCESS_BAD_AND_RED,
indent, Integer.toString(badCerts), Integer.toString(redundantCerts)); indent, Integer.toString(badCerts), Integer.toString(redundantCerts));
} else if (badCerts > 0) { } else if (badCerts > 0) {
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS_BAD, log.add(LogType.MSG_KC_SUCCESS_BAD,
indent, badCerts); indent, badCerts);
} else if (redundantCerts > 0) { } else if (redundantCerts > 0) {
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS_REDUNDANT, log.add(LogType.MSG_KC_SUCCESS_REDUNDANT,
indent, redundantCerts); indent, redundantCerts);
} else { } else {
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS, indent); log.add(LogType.MSG_KC_SUCCESS, indent);
} }
return isSecret() ? new CanonicalizedSecretKeyRing((PGPSecretKeyRing) ring, 1) return isSecret() ? new CanonicalizedSecretKeyRing((PGPSecretKeyRing) ring, 1)
@ -736,7 +735,7 @@ public class UncachedKeyRing {
*/ */
public UncachedKeyRing merge(UncachedKeyRing other, OperationLog log, int indent) { public UncachedKeyRing merge(UncachedKeyRing other, OperationLog log, int indent) {
log.add(LogLevel.DEBUG, isSecret() ? LogType.MSG_MG_SECRET : LogType.MSG_MG_PUBLIC, log.add(isSecret() ? LogType.MSG_MG_SECRET : LogType.MSG_MG_PUBLIC,
indent, PgpKeyHelper.convertKeyIdToHex(getMasterKeyId())); indent, PgpKeyHelper.convertKeyIdToHex(getMasterKeyId()));
indent += 1; indent += 1;
@ -744,7 +743,7 @@ public class UncachedKeyRing {
if (getMasterKeyId() != masterKeyId if (getMasterKeyId() != masterKeyId
|| !Arrays.equals(getFingerprint(), other.getFingerprint())) { || !Arrays.equals(getFingerprint(), other.getFingerprint())) {
log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_HETEROGENEOUS, indent); log.add(LogType.MSG_MG_ERROR_HETEROGENEOUS, indent);
return null; return null;
} }
@ -783,7 +782,7 @@ public class UncachedKeyRing {
final PGPPublicKey resultKey = result.getPublicKey(key.getKeyID()); final PGPPublicKey resultKey = result.getPublicKey(key.getKeyID());
if (resultKey == null) { if (resultKey == null) {
log.add(LogLevel.DEBUG, LogType.MSG_MG_NEW_SUBKEY, indent); log.add(LogType.MSG_MG_NEW_SUBKEY, indent);
// special case: if both rings are secret, copy over the secret key // special case: if both rings are secret, copy over the secret key
if (isSecret() && other.isSecret()) { if (isSecret() && other.isSecret()) {
PGPSecretKey sKey = ((PGPSecretKeyRing) candidate).getSecretKey(key.getKeyID()); PGPSecretKey sKey = ((PGPSecretKeyRing) candidate).getSecretKey(key.getKeyID());
@ -854,16 +853,16 @@ public class UncachedKeyRing {
} }
if (newCerts > 0) { if (newCerts > 0) {
log.add(LogLevel.DEBUG, LogType.MSG_MG_FOUND_NEW, indent, log.add(LogType.MSG_MG_FOUND_NEW, indent,
Integer.toString(newCerts)); Integer.toString(newCerts));
} else { } else {
log.add(LogLevel.DEBUG, LogType.MSG_MG_UNCHANGED, indent); log.add(LogType.MSG_MG_UNCHANGED, indent);
} }
return new UncachedKeyRing(result); return new UncachedKeyRing(result);
} catch (IOException e) { } catch (IOException e) {
log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_ENCODE, indent); log.add(LogType.MSG_MG_ERROR_ENCODE, indent);
return null; return null;
} }

View File

@ -124,12 +124,12 @@ public class ProviderHelper {
public void log(LogLevel level, LogType type) { public void log(LogLevel level, LogType type) {
if(mLog != null) { if(mLog != null) {
mLog.add(level, type, mIndent); mLog.add(type, mIndent);
} }
} }
public void log(LogLevel level, LogType type, Object... parameters) { public void log(LogLevel level, LogType type, Object... parameters) {
if(mLog != null) { if(mLog != null) {
mLog.add(level, type, mIndent, parameters); mLog.add(type, mIndent, parameters);
} }
} }
@ -527,7 +527,7 @@ public class ProviderHelper {
} }
} catch (IOException e) { } catch (IOException e) {
log(LogLevel.ERROR, LogType.MSG_IP_FAIL_IO_EXC); log(LogLevel.ERROR, LogType.MSG_IP_ERROR_IO_EXC);
Log.e(Constants.TAG, "IOException during import", e); Log.e(Constants.TAG, "IOException during import", e);
return SaveKeyringResult.RESULT_ERROR; return SaveKeyringResult.RESULT_ERROR;
} finally { } finally {
@ -554,11 +554,11 @@ public class ProviderHelper {
return result; return result;
} catch (RemoteException e) { } catch (RemoteException e) {
log(LogLevel.ERROR, LogType.MSG_IP_FAIL_REMOTE_EX); log(LogLevel.ERROR, LogType.MSG_IP_ERROR_REMOTE_EX);
Log.e(Constants.TAG, "RemoteException during import", e); Log.e(Constants.TAG, "RemoteException during import", e);
return SaveKeyringResult.RESULT_ERROR; return SaveKeyringResult.RESULT_ERROR;
} catch (OperationApplicationException e) { } catch (OperationApplicationException e) {
log(LogLevel.ERROR, LogType.MSG_IP_FAIL_OP_EXC); log(LogLevel.ERROR, LogType.MSG_IP_ERROR_OP_EXC);
Log.e(Constants.TAG, "OperationApplicationException during import", e); Log.e(Constants.TAG, "OperationApplicationException during import", e);
return SaveKeyringResult.RESULT_ERROR; return SaveKeyringResult.RESULT_ERROR;
} }
@ -613,7 +613,7 @@ public class ProviderHelper {
} }
} catch (IOException e) { } catch (IOException e) {
Log.e(Constants.TAG, "Failed to encode key!", e); Log.e(Constants.TAG, "Failed to encode key!", e);
log(LogLevel.ERROR, LogType.MSG_IS_FAIL_IO_EXC); log(LogLevel.ERROR, LogType.MSG_IS_ERROR_IO_EXC);
return SaveKeyringResult.RESULT_ERROR; return SaveKeyringResult.RESULT_ERROR;
} }
@ -771,7 +771,7 @@ public class ProviderHelper {
return new SaveKeyringResult(result, mLog, canSecretRing); return new SaveKeyringResult(result, mLog, canSecretRing);
} catch (IOException e) { } catch (IOException e) {
log(LogLevel.ERROR, LogType.MSG_IP_FAIL_IO_EXC); log(LogLevel.ERROR, LogType.MSG_IP_ERROR_IO_EXC);
return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog, null); return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog, null);
} finally { } finally {
mIndent -= 1; mIndent -= 1;
@ -865,7 +865,7 @@ public class ProviderHelper {
return new SaveKeyringResult(result, mLog, canSecretRing); return new SaveKeyringResult(result, mLog, canSecretRing);
} catch (IOException e) { } catch (IOException e) {
log(LogLevel.ERROR, LogType.MSG_IS_FAIL_IO_EXC); log(LogLevel.ERROR, LogType.MSG_IS_ERROR_IO_EXC);
return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog, null); return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog, null);
} finally { } finally {
mIndent -= 1; mIndent -= 1;

View File

@ -56,7 +56,6 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainDatabase; import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.results.OperationResult; import org.sufficientlysecure.keychain.service.results.OperationResult;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType; import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog; import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
import org.sufficientlysecure.keychain.service.results.ConsolidateResult; import org.sufficientlysecure.keychain.service.results.ConsolidateResult;
@ -462,7 +461,7 @@ public class KeychainIntentService extends IntentService implements Progressable
OperationLog log = modifyResult.getLog(); OperationLog log = modifyResult.getLog();
// If it wasn't added before, add log entry // If it wasn't added before, add log entry
if (!modifyResult.cancelled()) { if (!modifyResult.cancelled()) {
log.add(LogLevel.CANCELLED, LogType.MSG_OPERATION_CANCELLED, 0); log.add(LogType.MSG_OPERATION_CANCELLED, 0);
} }
// If so, just stop without saving // If so, just stop without saving
SaveKeyringResult saveResult = new SaveKeyringResult( SaveKeyringResult saveResult = new SaveKeyringResult(

View File

@ -49,8 +49,6 @@ import java.util.List;
* list (ie, enum) of all possible log types, which should in all cases be tied * list (ie, enum) of all possible log types, which should in all cases be tied
* to string resource ids. * to string resource ids.
* *
* TODO ideally, this class should be abstract, and all actual results of a specific subclass
*
*/ */
public abstract class OperationResult implements Parcelable { public abstract class OperationResult implements Parcelable {
@ -100,13 +98,11 @@ public abstract class OperationResult implements Parcelable {
/** One entry in the log. */ /** One entry in the log. */
public static class LogEntryParcel implements Parcelable { public static class LogEntryParcel implements Parcelable {
public final LogLevel mLevel;
public final LogType mType; public final LogType mType;
public final Object[] mParameters; public final Object[] mParameters;
public final int mIndent; public final int mIndent;
public LogEntryParcel(LogLevel level, LogType type, int indent, Object... parameters) { public LogEntryParcel(LogType type, int indent, Object... parameters) {
mLevel = level;
mType = type; mType = type;
mParameters = parameters; mParameters = parameters;
mIndent = indent; mIndent = indent;
@ -114,7 +110,6 @@ public abstract class OperationResult implements Parcelable {
} }
public LogEntryParcel(Parcel source) { public LogEntryParcel(Parcel source) {
mLevel = LogLevel.values()[source.readInt()];
mType = LogType.values()[source.readInt()]; mType = LogType.values()[source.readInt()];
mParameters = (Object[]) source.readSerializable(); mParameters = (Object[]) source.readSerializable();
mIndent = source.readInt(); mIndent = source.readInt();
@ -127,7 +122,6 @@ public abstract class OperationResult implements Parcelable {
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mLevel.ordinal());
dest.writeInt(mType.ordinal()); dest.writeInt(mType.ordinal());
dest.writeSerializable(mParameters); dest.writeSerializable(mParameters);
dest.writeInt(mIndent); dest.writeInt(mIndent);
@ -146,7 +140,7 @@ public abstract class OperationResult implements Parcelable {
@Override @Override
public String toString() { public String toString() {
return "LogEntryParcel{" + return "LogEntryParcel{" +
"mLevel=" + mLevel + "mLevel=" + mType.mLevel +
", mType=" + mType + ", mType=" + mType +
", mParameters=" + Arrays.toString(mParameters) + ", mParameters=" + Arrays.toString(mParameters) +
", mIndent=" + mIndent + ", mIndent=" + mIndent +
@ -224,286 +218,288 @@ public abstract class OperationResult implements Parcelable {
*/ */
public static enum LogType { public static enum LogType {
MSG_INTERNAL_ERROR (R.string.msg_internal_error), MSG_INTERNAL_ERROR (LogLevel.ERROR, R.string.msg_internal_error),
MSG_OPERATION_CANCELLED (R.string.msg_cancelled), MSG_OPERATION_CANCELLED (LogLevel.CANCELLED, R.string.msg_cancelled),
// import public // import public
MSG_IP(R.string.msg_ip), MSG_IP(LogLevel.START, R.string.msg_ip),
MSG_IP_APPLY_BATCH (R.string.msg_ip_apply_batch), MSG_IP_APPLY_BATCH (LogLevel.DEBUG, R.string.msg_ip_apply_batch),
MSG_IP_BAD_TYPE_SECRET (R.string.msg_ip_bad_type_secret), MSG_IP_BAD_TYPE_SECRET (LogLevel.WARN, R.string.msg_ip_bad_type_secret),
MSG_IP_DELETE_OLD_FAIL (R.string.msg_ip_delete_old_fail), MSG_IP_DELETE_OLD_FAIL (LogLevel.DEBUG, R.string.msg_ip_delete_old_fail),
MSG_IP_DELETE_OLD_OK (R.string.msg_ip_delete_old_ok), MSG_IP_DELETE_OLD_OK (LogLevel.DEBUG, R.string.msg_ip_delete_old_ok),
MSG_IP_ENCODE_FAIL (R.string.msg_ip_encode_fail), MSG_IP_ENCODE_FAIL (LogLevel.DEBUG, R.string.msg_ip_encode_fail),
MSG_IP_FAIL_IO_EXC (R.string.msg_ip_fail_io_exc), MSG_IP_ERROR_IO_EXC (LogLevel.ERROR, R.string.msg_ip_error_io_exc),
MSG_IP_FAIL_OP_EXC (R.string.msg_ip_fail_op_exc), MSG_IP_ERROR_OP_EXC (LogLevel.ERROR, R.string.msg_ip_error_op_exc),
MSG_IP_FAIL_REMOTE_EX (R.string.msg_ip_fail_remote_ex), MSG_IP_ERROR_REMOTE_EX (LogLevel.ERROR, R.string.msg_ip_error_remote_ex),
MSG_IP_INSERT_KEYRING (R.string.msg_ip_insert_keyring), MSG_IP_INSERT_KEYRING (LogLevel.DEBUG, R.string.msg_ip_insert_keyring),
MSG_IP_INSERT_SUBKEYS (R.string.msg_ip_insert_keys), MSG_IP_INSERT_SUBKEYS (LogLevel.DEBUG, R.string.msg_ip_insert_keys),
MSG_IP_PREPARE (R.string.msg_ip_prepare), MSG_IP_PREPARE (LogLevel.DEBUG, R.string.msg_ip_prepare),
MSG_IP_REINSERT_SECRET (R.string.msg_ip_reinsert_secret), MSG_IP_REINSERT_SECRET (LogLevel.DEBUG, R.string.msg_ip_reinsert_secret),
MSG_IP_MASTER (R.string.msg_ip_master), MSG_IP_MASTER (LogLevel.DEBUG, R.string.msg_ip_master),
MSG_IP_MASTER_EXPIRED (R.string.msg_ip_master_expired), MSG_IP_MASTER_EXPIRED (LogLevel.DEBUG, R.string.msg_ip_master_expired),
MSG_IP_MASTER_EXPIRES (R.string.msg_ip_master_expires), MSG_IP_MASTER_EXPIRES (LogLevel.DEBUG, R.string.msg_ip_master_expires),
MSG_IP_MASTER_FLAGS_CES (R.string.msg_ip_master_flags_ces), MSG_IP_MASTER_FLAGS_CES (LogLevel.DEBUG, R.string.msg_ip_master_flags_ces),
MSG_IP_MASTER_FLAGS_CEX (R.string.msg_ip_master_flags_cex), MSG_IP_MASTER_FLAGS_CEX (LogLevel.DEBUG, R.string.msg_ip_master_flags_cex),
MSG_IP_MASTER_FLAGS_CXS (R.string.msg_ip_master_flags_cxs), MSG_IP_MASTER_FLAGS_CXS (LogLevel.DEBUG, R.string.msg_ip_master_flags_cxs),
MSG_IP_MASTER_FLAGS_XES (R.string.msg_ip_master_flags_xes), MSG_IP_MASTER_FLAGS_XES (LogLevel.DEBUG, R.string.msg_ip_master_flags_xes),
MSG_IP_MASTER_FLAGS_CXX (R.string.msg_ip_master_flags_cxx), MSG_IP_MASTER_FLAGS_CXX (LogLevel.DEBUG, R.string.msg_ip_master_flags_cxx),
MSG_IP_MASTER_FLAGS_XEX (R.string.msg_ip_master_flags_xex), MSG_IP_MASTER_FLAGS_XEX (LogLevel.DEBUG, R.string.msg_ip_master_flags_xex),
MSG_IP_MASTER_FLAGS_XXS (R.string.msg_ip_master_flags_xxs), MSG_IP_MASTER_FLAGS_XXS (LogLevel.DEBUG, R.string.msg_ip_master_flags_xxs),
MSG_IP_MASTER_FLAGS_XXX (R.string.msg_ip_master_flags_xxx), MSG_IP_MASTER_FLAGS_XXX (LogLevel.DEBUG, R.string.msg_ip_master_flags_xxx),
MSG_IP_SUBKEY (R.string.msg_ip_subkey), MSG_IP_SUBKEY (LogLevel.DEBUG, R.string.msg_ip_subkey),
MSG_IP_SUBKEY_EXPIRED (R.string.msg_ip_subkey_expired), MSG_IP_SUBKEY_EXPIRED (LogLevel.DEBUG, R.string.msg_ip_subkey_expired),
MSG_IP_SUBKEY_EXPIRES (R.string.msg_ip_subkey_expires), MSG_IP_SUBKEY_EXPIRES (LogLevel.DEBUG, R.string.msg_ip_subkey_expires),
MSG_IP_SUBKEY_FLAGS_CES (R.string.msg_ip_subkey_flags_ces), MSG_IP_SUBKEY_FLAGS_CES (LogLevel.DEBUG, R.string.msg_ip_subkey_flags_ces),
MSG_IP_SUBKEY_FLAGS_CEX (R.string.msg_ip_subkey_flags_cex), MSG_IP_SUBKEY_FLAGS_CEX (LogLevel.DEBUG, R.string.msg_ip_subkey_flags_cex),
MSG_IP_SUBKEY_FLAGS_CXS (R.string.msg_ip_subkey_flags_cxs), MSG_IP_SUBKEY_FLAGS_CXS (LogLevel.DEBUG, R.string.msg_ip_subkey_flags_cxs),
MSG_IP_SUBKEY_FLAGS_XES (R.string.msg_ip_subkey_flags_xes), MSG_IP_SUBKEY_FLAGS_XES (LogLevel.DEBUG, R.string.msg_ip_subkey_flags_xes),
MSG_IP_SUBKEY_FLAGS_CXX (R.string.msg_ip_subkey_flags_cxx), MSG_IP_SUBKEY_FLAGS_CXX (LogLevel.DEBUG, R.string.msg_ip_subkey_flags_cxx),
MSG_IP_SUBKEY_FLAGS_XEX (R.string.msg_ip_subkey_flags_xex), MSG_IP_SUBKEY_FLAGS_XEX (LogLevel.DEBUG, R.string.msg_ip_subkey_flags_xex),
MSG_IP_SUBKEY_FLAGS_XXS (R.string.msg_ip_subkey_flags_xxs), MSG_IP_SUBKEY_FLAGS_XXS (LogLevel.DEBUG, R.string.msg_ip_subkey_flags_xxs),
MSG_IP_SUBKEY_FLAGS_XXX (R.string.msg_ip_subkey_flags_xxx), MSG_IP_SUBKEY_FLAGS_XXX (LogLevel.DEBUG, R.string.msg_ip_subkey_flags_xxx),
MSG_IP_SUCCESS (R.string.msg_ip_success), MSG_IP_SUCCESS (LogLevel.OK, R.string.msg_ip_success),
MSG_IP_SUCCESS_IDENTICAL (R.string.msg_ip_success_identical), MSG_IP_SUCCESS_IDENTICAL (LogLevel.OK, R.string.msg_ip_success_identical),
MSG_IP_UID_CERT_BAD (R.string.msg_ip_uid_cert_bad), MSG_IP_UID_CERT_BAD (LogLevel.WARN, R.string.msg_ip_uid_cert_bad),
MSG_IP_UID_CERT_ERROR (R.string.msg_ip_uid_cert_error), MSG_IP_UID_CERT_ERROR (LogLevel.ERROR, R.string.msg_ip_uid_cert_error),
MSG_IP_UID_CERT_GOOD (R.string.msg_ip_uid_cert_good), MSG_IP_UID_CERT_GOOD (LogLevel.DEBUG, R.string.msg_ip_uid_cert_good),
MSG_IP_UID_CERTS_UNKNOWN (R.plurals.msg_ip_uid_certs_unknown), MSG_IP_UID_CERTS_UNKNOWN (LogLevel.DEBUG, R.plurals.msg_ip_uid_certs_unknown),
MSG_IP_UID_CLASSIFYING_ZERO (R.string.msg_ip_uid_classifying_zero), MSG_IP_UID_CLASSIFYING_ZERO (LogLevel.DEBUG, R.string.msg_ip_uid_classifying_zero),
MSG_IP_UID_CLASSIFYING (R.plurals.msg_ip_uid_classifying), MSG_IP_UID_CLASSIFYING (LogLevel.DEBUG, R.plurals.msg_ip_uid_classifying),
MSG_IP_UID_REORDER(R.string.msg_ip_uid_reorder), MSG_IP_UID_REORDER(LogLevel.DEBUG, R.string.msg_ip_uid_reorder),
MSG_IP_UID_PROCESSING (R.string.msg_ip_uid_processing), MSG_IP_UID_PROCESSING (LogLevel.DEBUG, R.string.msg_ip_uid_processing),
MSG_IP_UID_REVOKED (R.string.msg_ip_uid_revoked), MSG_IP_UID_REVOKED (LogLevel.DEBUG, R.string.msg_ip_uid_revoked),
// import secret // import secret
MSG_IS(R.string.msg_is), MSG_IS(LogLevel.START, R.string.msg_is),
MSG_IS_BAD_TYPE_PUBLIC (R.string.msg_is_bad_type_public), MSG_IS_BAD_TYPE_PUBLIC (LogLevel.WARN, R.string.msg_is_bad_type_public),
MSG_IS_DB_EXCEPTION (R.string.msg_is_db_exception), MSG_IS_DB_EXCEPTION (LogLevel.DEBUG, R.string.msg_is_db_exception),
MSG_IS_FAIL_IO_EXC (R.string.msg_is_io_exc), MSG_IS_ERROR_IO_EXC(LogLevel.DEBUG, R.string.msg_is_error_io_exc),
MSG_IS_IMPORTING_SUBKEYS (R.string.msg_is_importing_subkeys), MSG_IS_IMPORTING_SUBKEYS (LogLevel.DEBUG, R.string.msg_is_importing_subkeys),
MSG_IS_PUBRING_GENERATE (R.string.msg_is_pubring_generate), MSG_IS_PUBRING_GENERATE (LogLevel.DEBUG, R.string.msg_is_pubring_generate),
MSG_IS_SUBKEY_NONEXISTENT (R.string.msg_is_subkey_nonexistent), MSG_IS_SUBKEY_NONEXISTENT (LogLevel.DEBUG, R.string.msg_is_subkey_nonexistent),
MSG_IS_SUBKEY_OK (R.string.msg_is_subkey_ok), MSG_IS_SUBKEY_OK (LogLevel.OK, R.string.msg_is_subkey_ok),
MSG_IS_SUBKEY_STRIPPED (R.string.msg_is_subkey_stripped), MSG_IS_SUBKEY_STRIPPED (LogLevel.DEBUG, R.string.msg_is_subkey_stripped),
MSG_IS_SUBKEY_DIVERT (R.string.msg_is_subkey_divert), MSG_IS_SUBKEY_DIVERT (LogLevel.DEBUG, R.string.msg_is_subkey_divert),
MSG_IS_SUBKEY_EMPTY (R.string.msg_is_subkey_empty), MSG_IS_SUBKEY_EMPTY (LogLevel.DEBUG, R.string.msg_is_subkey_empty),
MSG_IS_SUCCESS_IDENTICAL (R.string.msg_is_success_identical), MSG_IS_SUCCESS_IDENTICAL (LogLevel.OK, R.string.msg_is_success_identical),
MSG_IS_SUCCESS (R.string.msg_is_success), MSG_IS_SUCCESS (LogLevel.OK, R.string.msg_is_success),
// keyring canonicalization // keyring canonicalization
MSG_KC_PUBLIC (R.string.msg_kc_public), MSG_KC_PUBLIC (LogLevel.DEBUG, R.string.msg_kc_public),
MSG_KC_SECRET (R.string.msg_kc_secret), MSG_KC_SECRET (LogLevel.DEBUG, R.string.msg_kc_secret),
MSG_KC_ERROR_V3 (R.string.msg_kc_error_v3), MSG_KC_ERROR_V3 (LogLevel.ERROR, R.string.msg_kc_error_v3),
MSG_KC_ERROR_NO_UID (R.string.msg_kc_error_no_uid), MSG_KC_ERROR_NO_UID (LogLevel.ERROR, R.string.msg_kc_error_no_uid),
MSG_KC_ERROR_MASTER_ALGO (R.string.msg_kc_error_master_algo), MSG_KC_ERROR_MASTER_ALGO (LogLevel.ERROR, R.string.msg_kc_error_master_algo),
MSG_KC_MASTER (R.string.msg_kc_master), MSG_KC_MASTER (LogLevel.DEBUG, R.string.msg_kc_master),
MSG_KC_REVOKE_BAD_ERR (R.string.msg_kc_revoke_bad_err), MSG_KC_REVOKE_BAD_ERR (LogLevel.WARN, R.string.msg_kc_revoke_bad_err),
MSG_KC_REVOKE_BAD_LOCAL (R.string.msg_kc_revoke_bad_local), MSG_KC_REVOKE_BAD_LOCAL (LogLevel.WARN, R.string.msg_kc_revoke_bad_local),
MSG_KC_REVOKE_BAD_TIME (R.string.msg_kc_revoke_bad_time), MSG_KC_REVOKE_BAD_TIME (LogLevel.WARN, R.string.msg_kc_revoke_bad_time),
MSG_KC_REVOKE_BAD_TYPE (R.string.msg_kc_revoke_bad_type), MSG_KC_REVOKE_BAD_TYPE (LogLevel.WARN, R.string.msg_kc_revoke_bad_type),
MSG_KC_REVOKE_BAD_TYPE_UID (R.string.msg_kc_revoke_bad_type_uid), MSG_KC_REVOKE_BAD_TYPE_UID (LogLevel.WARN, R.string.msg_kc_revoke_bad_type_uid),
MSG_KC_REVOKE_BAD (R.string.msg_kc_revoke_bad), MSG_KC_REVOKE_BAD (LogLevel.WARN, R.string.msg_kc_revoke_bad),
MSG_KC_REVOKE_DUP (R.string.msg_kc_revoke_dup), MSG_KC_REVOKE_DUP (LogLevel.DEBUG, R.string.msg_kc_revoke_dup),
MSG_KC_SUB (R.string.msg_kc_sub), MSG_KC_SUB (LogLevel.DEBUG, R.string.msg_kc_sub),
MSG_KC_SUB_BAD(R.string.msg_kc_sub_bad), MSG_KC_SUB_BAD(LogLevel.WARN, R.string.msg_kc_sub_bad),
MSG_KC_SUB_BAD_ERR(R.string.msg_kc_sub_bad_err), MSG_KC_SUB_BAD_ERR(LogLevel.WARN, R.string.msg_kc_sub_bad_err),
MSG_KC_SUB_BAD_LOCAL(R.string.msg_kc_sub_bad_local), MSG_KC_SUB_BAD_LOCAL(LogLevel.WARN, R.string.msg_kc_sub_bad_local),
MSG_KC_SUB_BAD_KEYID(R.string.msg_kc_sub_bad_keyid), MSG_KC_SUB_BAD_KEYID(LogLevel.WARN, R.string.msg_kc_sub_bad_keyid),
MSG_KC_SUB_BAD_TIME(R.string.msg_kc_sub_bad_time), MSG_KC_SUB_BAD_TIME(LogLevel.WARN, R.string.msg_kc_sub_bad_time),
MSG_KC_SUB_BAD_TYPE(R.string.msg_kc_sub_bad_type), MSG_KC_SUB_BAD_TYPE(LogLevel.WARN, R.string.msg_kc_sub_bad_type),
MSG_KC_SUB_DUP (R.string.msg_kc_sub_dup), MSG_KC_SUB_DUP (LogLevel.DEBUG, R.string.msg_kc_sub_dup),
MSG_KC_SUB_PRIMARY_BAD(R.string.msg_kc_sub_primary_bad), MSG_KC_SUB_PRIMARY_BAD(LogLevel.WARN, R.string.msg_kc_sub_primary_bad),
MSG_KC_SUB_PRIMARY_BAD_ERR(R.string.msg_kc_sub_primary_bad_err), MSG_KC_SUB_PRIMARY_BAD_ERR(LogLevel.WARN, R.string.msg_kc_sub_primary_bad_err),
MSG_KC_SUB_PRIMARY_NONE(R.string.msg_kc_sub_primary_none), MSG_KC_SUB_PRIMARY_NONE(LogLevel.DEBUG, R.string.msg_kc_sub_primary_none),
MSG_KC_SUB_NO_CERT(R.string.msg_kc_sub_no_cert), MSG_KC_SUB_NO_CERT(LogLevel.DEBUG, R.string.msg_kc_sub_no_cert),
MSG_KC_SUB_REVOKE_BAD_ERR (R.string.msg_kc_sub_revoke_bad_err), MSG_KC_SUB_REVOKE_BAD_ERR (LogLevel.WARN, R.string.msg_kc_sub_revoke_bad_err),
MSG_KC_SUB_REVOKE_BAD (R.string.msg_kc_sub_revoke_bad), MSG_KC_SUB_REVOKE_BAD (LogLevel.WARN, R.string.msg_kc_sub_revoke_bad),
MSG_KC_SUB_REVOKE_DUP (R.string.msg_kc_sub_revoke_dup), MSG_KC_SUB_REVOKE_DUP (LogLevel.DEBUG, R.string.msg_kc_sub_revoke_dup),
MSG_KC_SUB_UNKNOWN_ALGO (R.string.msg_kc_sub_unknown_algo), MSG_KC_SUB_UNKNOWN_ALGO (LogLevel.WARN, R.string.msg_kc_sub_unknown_algo),
MSG_KC_SUCCESS_BAD (R.plurals.msg_kc_success_bad), MSG_KC_SUCCESS_BAD (LogLevel.OK, R.plurals.msg_kc_success_bad),
MSG_KC_SUCCESS_BAD_AND_RED (R.string.msg_kc_success_bad_and_red), MSG_KC_SUCCESS_BAD_AND_RED (LogLevel.OK, R.string.msg_kc_success_bad_and_red),
MSG_KC_SUCCESS_REDUNDANT (R.plurals.msg_kc_success_redundant), MSG_KC_SUCCESS_REDUNDANT (LogLevel.OK, R.plurals.msg_kc_success_redundant),
MSG_KC_SUCCESS (R.string.msg_kc_success), MSG_KC_SUCCESS (LogLevel.OK, R.string.msg_kc_success),
MSG_KC_UID_BAD_ERR (R.string.msg_kc_uid_bad_err), MSG_KC_UID_BAD_ERR (LogLevel.WARN, R.string.msg_kc_uid_bad_err),
MSG_KC_UID_BAD_LOCAL (R.string.msg_kc_uid_bad_local), MSG_KC_UID_BAD_LOCAL (LogLevel.WARN, R.string.msg_kc_uid_bad_local),
MSG_KC_UID_BAD_TIME (R.string.msg_kc_uid_bad_time), MSG_KC_UID_BAD_TIME (LogLevel.WARN, R.string.msg_kc_uid_bad_time),
MSG_KC_UID_BAD_TYPE (R.string.msg_kc_uid_bad_type), MSG_KC_UID_BAD_TYPE (LogLevel.WARN, R.string.msg_kc_uid_bad_type),
MSG_KC_UID_BAD (R.string.msg_kc_uid_bad), MSG_KC_UID_BAD (LogLevel.WARN, R.string.msg_kc_uid_bad),
MSG_KC_UID_CERT_DUP (R.string.msg_kc_uid_cert_dup), MSG_KC_UID_CERT_DUP (LogLevel.DEBUG, R.string.msg_kc_uid_cert_dup),
MSG_KC_UID_DUP (R.string.msg_kc_uid_dup), MSG_KC_UID_DUP (LogLevel.DEBUG, R.string.msg_kc_uid_dup),
MSG_KC_UID_FOREIGN (R.string.msg_kc_uid_foreign), MSG_KC_UID_FOREIGN (LogLevel.DEBUG, R.string.msg_kc_uid_foreign),
MSG_KC_UID_NO_CERT (R.string.msg_kc_uid_no_cert), MSG_KC_UID_NO_CERT (LogLevel.DEBUG, R.string.msg_kc_uid_no_cert),
MSG_KC_UID_REVOKE_DUP (R.string.msg_kc_uid_revoke_dup), MSG_KC_UID_REVOKE_DUP (LogLevel.DEBUG, R.string.msg_kc_uid_revoke_dup),
MSG_KC_UID_REVOKE_OLD (R.string.msg_kc_uid_revoke_old), MSG_KC_UID_REVOKE_OLD (LogLevel.DEBUG, R.string.msg_kc_uid_revoke_old),
MSG_KC_UID_REMOVE (R.string.msg_kc_uid_remove), MSG_KC_UID_REMOVE (LogLevel.DEBUG, R.string.msg_kc_uid_remove),
MSG_KC_UID_WARN_ENCODING (R.string.msg_kc_uid_warn_encoding), MSG_KC_UID_WARN_ENCODING (LogLevel.WARN, R.string.msg_kc_uid_warn_encoding),
// keyring consolidation // keyring consolidation
MSG_MG_ERROR_SECRET_DUMMY(R.string.msg_mg_error_secret_dummy), MSG_MG_ERROR_SECRET_DUMMY(LogLevel.ERROR, R.string.msg_mg_error_secret_dummy),
MSG_MG_ERROR_ENCODE(R.string.msg_mg_error_encode), MSG_MG_ERROR_ENCODE(LogLevel.ERROR, R.string.msg_mg_error_encode),
MSG_MG_ERROR_HETEROGENEOUS(R.string.msg_mg_error_heterogeneous), MSG_MG_ERROR_HETEROGENEOUS(LogLevel.ERROR, R.string.msg_mg_error_heterogeneous),
MSG_MG_PUBLIC (R.string.msg_mg_public), MSG_MG_PUBLIC (LogLevel.START, R.string.msg_mg_public),
MSG_MG_SECRET (R.string.msg_mg_secret), MSG_MG_SECRET (LogLevel.START, R.string.msg_mg_secret),
MSG_MG_NEW_SUBKEY (R.string.msg_mg_new_subkey), MSG_MG_NEW_SUBKEY (LogLevel.DEBUG, R.string.msg_mg_new_subkey),
MSG_MG_FOUND_NEW (R.string.msg_mg_found_new), MSG_MG_FOUND_NEW (LogLevel.OK, R.string.msg_mg_found_new),
MSG_MG_UNCHANGED (R.string.msg_mg_unchanged), MSG_MG_UNCHANGED (LogLevel.OK, R.string.msg_mg_unchanged),
// secret key create // secret key create
MSG_CR (R.string.msg_cr), MSG_CR (LogLevel.START, R.string.msg_cr),
MSG_CR_ERROR_NO_MASTER (R.string.msg_cr_error_no_master), MSG_CR_ERROR_NO_MASTER (LogLevel.ERROR, R.string.msg_cr_error_no_master),
MSG_CR_ERROR_NO_USER_ID (R.string.msg_cr_error_no_user_id), MSG_CR_ERROR_NO_USER_ID (LogLevel.ERROR, R.string.msg_cr_error_no_user_id),
MSG_CR_ERROR_NO_CERTIFY (R.string.msg_cr_error_no_certify), MSG_CR_ERROR_NO_CERTIFY (LogLevel.ERROR, R.string.msg_cr_error_no_certify),
MSG_CR_ERROR_NULL_EXPIRY(R.string.msg_cr_error_null_expiry), MSG_CR_ERROR_NULL_EXPIRY(LogLevel.ERROR, R.string.msg_cr_error_null_expiry),
MSG_CR_ERROR_KEYSIZE_512 (R.string.msg_cr_error_keysize_512), MSG_CR_ERROR_KEYSIZE_512 (LogLevel.ERROR, R.string.msg_cr_error_keysize_512),
MSG_CR_ERROR_NO_KEYSIZE (R.string.msg_cr_error_no_keysize), MSG_CR_ERROR_NO_KEYSIZE (LogLevel.ERROR, R.string.msg_cr_error_no_keysize),
MSG_CR_ERROR_NO_CURVE (R.string.msg_cr_error_no_curve), MSG_CR_ERROR_NO_CURVE (LogLevel.ERROR, R.string.msg_cr_error_no_curve),
MSG_CR_ERROR_UNKNOWN_ALGO (R.string.msg_cr_error_unknown_algo), MSG_CR_ERROR_UNKNOWN_ALGO (LogLevel.ERROR, R.string.msg_cr_error_unknown_algo),
MSG_CR_ERROR_INTERNAL_PGP (R.string.msg_cr_error_internal_pgp), MSG_CR_ERROR_INTERNAL_PGP (LogLevel.ERROR, R.string.msg_cr_error_internal_pgp),
MSG_CR_ERROR_FLAGS_DSA (R.string.msg_cr_error_flags_dsa), MSG_CR_ERROR_FLAGS_DSA (LogLevel.ERROR, R.string.msg_cr_error_flags_dsa),
MSG_CR_ERROR_FLAGS_ELGAMAL (R.string.msg_cr_error_flags_elgamal), MSG_CR_ERROR_FLAGS_ELGAMAL (LogLevel.ERROR, R.string.msg_cr_error_flags_elgamal),
MSG_CR_ERROR_FLAGS_ECDSA (R.string.msg_cr_error_flags_ecdsa), MSG_CR_ERROR_FLAGS_ECDSA (LogLevel.ERROR, R.string.msg_cr_error_flags_ecdsa),
MSG_CR_ERROR_FLAGS_ECDH (R.string.msg_cr_error_flags_ecdh), MSG_CR_ERROR_FLAGS_ECDH (LogLevel.ERROR, R.string.msg_cr_error_flags_ecdh),
// secret key modify // secret key modify
MSG_MF (R.string.msg_mr), MSG_MF (LogLevel.START, R.string.msg_mr),
MSG_MF_ERROR_ENCODE (R.string.msg_mf_error_encode), MSG_MF_ERROR_ENCODE (LogLevel.ERROR, R.string.msg_mf_error_encode),
MSG_MF_ERROR_FINGERPRINT (R.string.msg_mf_error_fingerprint), MSG_MF_ERROR_FINGERPRINT (LogLevel.ERROR, R.string.msg_mf_error_fingerprint),
MSG_MF_ERROR_KEYID (R.string.msg_mf_error_keyid), MSG_MF_ERROR_KEYID (LogLevel.ERROR, R.string.msg_mf_error_keyid),
MSG_MF_ERROR_INTEGRITY (R.string.msg_mf_error_integrity), MSG_MF_ERROR_INTEGRITY (LogLevel.ERROR, R.string.msg_mf_error_integrity),
MSG_MF_ERROR_MASTER_NONE(R.string.msg_mf_error_master_none), MSG_MF_ERROR_MASTER_NONE(LogLevel.ERROR, R.string.msg_mf_error_master_none),
MSG_MF_ERROR_NO_CERTIFY (R.string.msg_cr_error_no_certify), MSG_MF_ERROR_NO_CERTIFY (LogLevel.ERROR, R.string.msg_cr_error_no_certify),
MSG_MF_ERROR_NOEXIST_PRIMARY (R.string.msg_mf_error_noexist_primary), MSG_MF_ERROR_NOEXIST_PRIMARY (LogLevel.ERROR, R.string.msg_mf_error_noexist_primary),
MSG_MF_ERROR_NOEXIST_REVOKE (R.string.msg_mf_error_noexist_revoke), MSG_MF_ERROR_NOEXIST_REVOKE (LogLevel.ERROR, R.string.msg_mf_error_noexist_revoke),
MSG_MF_ERROR_NULL_EXPIRY (R.string.msg_mf_error_null_expiry), MSG_MF_ERROR_NULL_EXPIRY (LogLevel.ERROR, R.string.msg_mf_error_null_expiry),
MSG_MF_ERROR_PASSPHRASE_MASTER(R.string.msg_mf_error_passphrase_master), MSG_MF_ERROR_PASSPHRASE_MASTER(LogLevel.ERROR, R.string.msg_mf_error_passphrase_master),
MSG_MF_ERROR_PAST_EXPIRY(R.string.msg_mf_error_past_expiry), MSG_MF_ERROR_PAST_EXPIRY(LogLevel.ERROR, R.string.msg_mf_error_past_expiry),
MSG_MF_ERROR_PGP (R.string.msg_mf_error_pgp), MSG_MF_ERROR_PGP (LogLevel.ERROR, R.string.msg_mf_error_pgp),
MSG_MF_ERROR_REVOKED_PRIMARY (R.string.msg_mf_error_revoked_primary), MSG_MF_ERROR_REVOKED_PRIMARY (LogLevel.ERROR, R.string.msg_mf_error_revoked_primary),
MSG_MF_ERROR_SIG (R.string.msg_mf_error_sig), MSG_MF_ERROR_SIG (LogLevel.ERROR, R.string.msg_mf_error_sig),
MSG_MF_ERROR_SUBKEY_MISSING(R.string.msg_mf_error_subkey_missing), MSG_MF_ERROR_SUBKEY_MISSING(LogLevel.ERROR, R.string.msg_mf_error_subkey_missing),
MSG_MF_MASTER (R.string.msg_mf_master), MSG_MF_MASTER (LogLevel.DEBUG, R.string.msg_mf_master),
MSG_MF_PASSPHRASE (R.string.msg_mf_passphrase), MSG_MF_PASSPHRASE (LogLevel.INFO, R.string.msg_mf_passphrase),
MSG_MF_PASSPHRASE_KEY (R.string.msg_mf_passphrase_key), MSG_MF_PASSPHRASE_KEY (LogLevel.DEBUG, R.string.msg_mf_passphrase_key),
MSG_MF_PASSPHRASE_EMPTY_RETRY (R.string.msg_mf_passphrase_empty_retry), MSG_MF_PASSPHRASE_EMPTY_RETRY (LogLevel.DEBUG, R.string.msg_mf_passphrase_empty_retry),
MSG_MF_PASSPHRASE_FAIL (R.string.msg_mf_passphrase_fail), MSG_MF_PASSPHRASE_FAIL (LogLevel.DEBUG, R.string.msg_mf_passphrase_fail),
MSG_MF_PRIMARY_REPLACE_OLD (R.string.msg_mf_primary_replace_old), MSG_MF_PRIMARY_REPLACE_OLD (LogLevel.DEBUG, R.string.msg_mf_primary_replace_old),
MSG_MF_PRIMARY_NEW (R.string.msg_mf_primary_new), MSG_MF_PRIMARY_NEW (LogLevel.DEBUG, R.string.msg_mf_primary_new),
MSG_MF_SUBKEY_CHANGE (R.string.msg_mf_subkey_change), MSG_MF_SUBKEY_CHANGE (LogLevel.INFO, R.string.msg_mf_subkey_change),
MSG_MF_SUBKEY_NEW_ID (R.string.msg_mf_subkey_new_id), MSG_MF_SUBKEY_NEW_ID (LogLevel.DEBUG, R.string.msg_mf_subkey_new_id),
MSG_MF_SUBKEY_NEW (R.string.msg_mf_subkey_new), MSG_MF_SUBKEY_NEW (LogLevel.INFO, R.string.msg_mf_subkey_new),
MSG_MF_SUBKEY_REVOKE (R.string.msg_mf_subkey_revoke), MSG_MF_SUBKEY_REVOKE (LogLevel.INFO, R.string.msg_mf_subkey_revoke),
MSG_MF_SUBKEY_STRIP (R.string.msg_mf_subkey_strip), MSG_MF_SUBKEY_STRIP (LogLevel.INFO, R.string.msg_mf_subkey_strip),
MSG_MF_SUCCESS (R.string.msg_mf_success), MSG_MF_SUCCESS (LogLevel.OK, R.string.msg_mf_success),
MSG_MF_UID_ADD (R.string.msg_mf_uid_add), MSG_MF_UID_ADD (LogLevel.INFO, R.string.msg_mf_uid_add),
MSG_MF_UID_PRIMARY (R.string.msg_mf_uid_primary), MSG_MF_UID_PRIMARY (LogLevel.INFO, R.string.msg_mf_uid_primary),
MSG_MF_UID_REVOKE (R.string.msg_mf_uid_revoke), MSG_MF_UID_REVOKE (LogLevel.INFO, R.string.msg_mf_uid_revoke),
MSG_MF_UID_ERROR_EMPTY (R.string.msg_mf_uid_error_empty), MSG_MF_UID_ERROR_EMPTY (LogLevel.ERROR, R.string.msg_mf_uid_error_empty),
MSG_MF_UNLOCK_ERROR (R.string.msg_mf_unlock_error), MSG_MF_UNLOCK_ERROR (LogLevel.ERROR, R.string.msg_mf_unlock_error),
MSG_MF_UNLOCK (R.string.msg_mf_unlock), MSG_MF_UNLOCK (LogLevel.DEBUG, R.string.msg_mf_unlock),
// consolidate // consolidate
MSG_CON_CRITICAL_IN (R.string.msg_con_critical_in), MSG_CON_CRITICAL_IN (LogLevel.DEBUG, R.string.msg_con_critical_in),
MSG_CON_CRITICAL_OUT (R.string.msg_con_critical_out), MSG_CON_CRITICAL_OUT (LogLevel.DEBUG, R.string.msg_con_critical_out),
MSG_CON_DB_CLEAR (R.string.msg_con_db_clear), MSG_CON_DB_CLEAR (LogLevel.DEBUG, R.string.msg_con_db_clear),
MSG_CON_DELETE_PUBLIC (R.string.msg_con_delete_public), MSG_CON_DELETE_PUBLIC (LogLevel.DEBUG, R.string.msg_con_delete_public),
MSG_CON_DELETE_SECRET (R.string.msg_con_delete_secret), MSG_CON_DELETE_SECRET (LogLevel.DEBUG, R.string.msg_con_delete_secret),
MSG_CON_ERROR_BAD_STATE (R.string.msg_con_error_bad_state), MSG_CON_ERROR_BAD_STATE (LogLevel.ERROR, R.string.msg_con_error_bad_state),
MSG_CON_ERROR_CONCURRENT(R.string.msg_con_error_concurrent), MSG_CON_ERROR_CONCURRENT(LogLevel.ERROR, R.string.msg_con_error_concurrent),
MSG_CON_ERROR_DB (R.string.msg_con_error_db), MSG_CON_ERROR_DB (LogLevel.ERROR, R.string.msg_con_error_db),
MSG_CON_ERROR_IO_PUBLIC (R.string.msg_con_error_io_public), MSG_CON_ERROR_IO_PUBLIC (LogLevel.ERROR, R.string.msg_con_error_io_public),
MSG_CON_ERROR_IO_SECRET (R.string.msg_con_error_io_secret), MSG_CON_ERROR_IO_SECRET (LogLevel.ERROR, R.string.msg_con_error_io_secret),
MSG_CON_ERROR_PUBLIC (R.string.msg_con_error_public), MSG_CON_ERROR_PUBLIC (LogLevel.ERROR, R.string.msg_con_error_public),
MSG_CON_ERROR_SECRET (R.string.msg_con_error_secret), MSG_CON_ERROR_SECRET (LogLevel.ERROR, R.string.msg_con_error_secret),
MSG_CON_RECOVER (R.plurals.msg_con_recover), MSG_CON_RECOVER (LogLevel.DEBUG, R.plurals.msg_con_recover),
MSG_CON_RECOVER_UNKNOWN (R.string.msg_con_recover_unknown), MSG_CON_RECOVER_UNKNOWN (LogLevel.DEBUG, R.string.msg_con_recover_unknown),
MSG_CON_REIMPORT_PUBLIC (R.plurals.msg_con_reimport_public), MSG_CON_REIMPORT_PUBLIC (LogLevel.DEBUG, R.plurals.msg_con_reimport_public),
MSG_CON_REIMPORT_PUBLIC_SKIP (R.string.msg_con_reimport_public_skip), MSG_CON_REIMPORT_PUBLIC_SKIP (LogLevel.DEBUG, R.string.msg_con_reimport_public_skip),
MSG_CON_REIMPORT_SECRET (R.plurals.msg_con_reimport_secret), MSG_CON_REIMPORT_SECRET (LogLevel.DEBUG, R.plurals.msg_con_reimport_secret),
MSG_CON_REIMPORT_SECRET_SKIP (R.string.msg_con_reimport_secret_skip), MSG_CON_REIMPORT_SECRET_SKIP (LogLevel.DEBUG, R.string.msg_con_reimport_secret_skip),
MSG_CON (R.string.msg_con), MSG_CON (LogLevel.START, R.string.msg_con),
MSG_CON_SAVE_PUBLIC (R.string.msg_con_save_public), MSG_CON_SAVE_PUBLIC (LogLevel.DEBUG, R.string.msg_con_save_public),
MSG_CON_SAVE_SECRET (R.string.msg_con_save_secret), MSG_CON_SAVE_SECRET (LogLevel.DEBUG, R.string.msg_con_save_secret),
MSG_CON_SUCCESS (R.string.msg_con_success), MSG_CON_SUCCESS (LogLevel.OK, R.string.msg_con_success),
MSG_CON_WARN_DELETE_PUBLIC (R.string.msg_con_warn_delete_public), MSG_CON_WARN_DELETE_PUBLIC (LogLevel.WARN, R.string.msg_con_warn_delete_public),
MSG_CON_WARN_DELETE_SECRET (R.string.msg_con_warn_delete_secret), MSG_CON_WARN_DELETE_SECRET (LogLevel.WARN, R.string.msg_con_warn_delete_secret),
// messages used in UI code // messages used in UI code
MSG_EK_ERROR_DIVERT (R.string.msg_ek_error_divert), MSG_EK_ERROR_DIVERT (LogLevel.ERROR, R.string.msg_ek_error_divert),
MSG_EK_ERROR_DUMMY (R.string.msg_ek_error_dummy), MSG_EK_ERROR_DUMMY (LogLevel.ERROR, R.string.msg_ek_error_dummy),
MSG_EK_ERROR_NOT_FOUND (R.string.msg_ek_error_not_found), MSG_EK_ERROR_NOT_FOUND (LogLevel.ERROR, R.string.msg_ek_error_not_found),
// decryptverify // decryptverify
MSG_DC_ASKIP_NO_KEY (R.string.msg_dc_askip_no_key), MSG_DC_ASKIP_NO_KEY (LogLevel.DEBUG, R.string.msg_dc_askip_no_key),
MSG_DC_ASKIP_NOT_ALLOWED (R.string.msg_dc_askip_not_allowed), MSG_DC_ASKIP_NOT_ALLOWED (LogLevel.DEBUG, R.string.msg_dc_askip_not_allowed),
MSG_DC_ASYM (R.string.msg_dc_asym), MSG_DC_ASYM (LogLevel.DEBUG, R.string.msg_dc_asym),
MSG_DC_CLEAR_DATA (R.string.msg_dc_clear_data), MSG_DC_CLEAR_DATA (LogLevel.DEBUG, R.string.msg_dc_clear_data),
MSG_DC_CLEAR_DECOMPRESS (R.string.msg_dc_clear_decompress), MSG_DC_CLEAR_DECOMPRESS (LogLevel.DEBUG, R.string.msg_dc_clear_decompress),
MSG_DC_CLEAR_META_FILE (R.string.msg_dc_clear_meta_file), MSG_DC_CLEAR_META_FILE (LogLevel.DEBUG, R.string.msg_dc_clear_meta_file),
MSG_DC_CLEAR_META_MIME (R.string.msg_dc_clear_meta_mime), MSG_DC_CLEAR_META_MIME (LogLevel.DEBUG, R.string.msg_dc_clear_meta_mime),
MSG_DC_CLEAR_META_SIZE (R.string.msg_dc_clear_meta_size), MSG_DC_CLEAR_META_SIZE (LogLevel.DEBUG, R.string.msg_dc_clear_meta_size),
MSG_DC_CLEAR_META_TIME (R.string.msg_dc_clear_meta_time), MSG_DC_CLEAR_META_TIME (LogLevel.DEBUG, R.string.msg_dc_clear_meta_time),
MSG_DC_CLEAR (R.string.msg_dc_clear), MSG_DC_CLEAR (LogLevel.DEBUG, R.string.msg_dc_clear),
MSG_DC_CLEAR_SIGNATURE_BAD (R.string.msg_dc_clear_signature_bad), MSG_DC_CLEAR_SIGNATURE_BAD (LogLevel.WARN, R.string.msg_dc_clear_signature_bad),
MSG_DC_CLEAR_SIGNATURE_CHECK (R.string.msg_dc_clear_signature_check), MSG_DC_CLEAR_SIGNATURE_CHECK (LogLevel.DEBUG, R.string.msg_dc_clear_signature_check),
MSG_DC_CLEAR_SIGNATURE_OK (R.string.msg_dc_clear_signature_ok), MSG_DC_CLEAR_SIGNATURE_OK (LogLevel.OK, R.string.msg_dc_clear_signature_ok),
MSG_DC_CLEAR_SIGNATURE (R.string.msg_dc_clear_signature), MSG_DC_CLEAR_SIGNATURE (LogLevel.DEBUG, R.string.msg_dc_clear_signature),
MSG_DC_ERROR_BAD_PASSPHRASE (R.string.msg_dc_error_bad_passphrase), MSG_DC_ERROR_BAD_PASSPHRASE (LogLevel.ERROR, R.string.msg_dc_error_bad_passphrase),
MSG_DC_ERROR_EXTRACT_KEY (R.string.msg_dc_error_extract_key), MSG_DC_ERROR_EXTRACT_KEY (LogLevel.ERROR, R.string.msg_dc_error_extract_key),
MSG_DC_ERROR_INTEGRITY_CHECK (R.string.msg_dc_error_integrity_check), MSG_DC_ERROR_INTEGRITY_CHECK (LogLevel.ERROR, R.string.msg_dc_error_integrity_check),
MSG_DC_ERROR_INVALID_SIGLIST(R.string.msg_dc_error_invalid_siglist), MSG_DC_ERROR_INVALID_SIGLIST(LogLevel.ERROR, R.string.msg_dc_error_invalid_siglist),
MSG_DC_ERROR_IO (R.string.msg_dc_error_io), MSG_DC_ERROR_IO (LogLevel.ERROR, R.string.msg_dc_error_io),
MSG_DC_ERROR_NO_DATA (R.string.msg_dc_error_no_data), MSG_DC_ERROR_NO_DATA (LogLevel.ERROR, R.string.msg_dc_error_no_data),
MSG_DC_ERROR_NO_KEY (R.string.msg_dc_error_no_key), MSG_DC_ERROR_NO_KEY (LogLevel.ERROR, R.string.msg_dc_error_no_key),
MSG_DC_ERROR_PGP_EXCEPTION (R.string.msg_dc_error_pgp_exception), MSG_DC_ERROR_PGP_EXCEPTION (LogLevel.ERROR, R.string.msg_dc_error_pgp_exception),
MSG_DC_INTEGRITY_CHECK_OK (R.string.msg_dc_integrity_check_ok), MSG_DC_INTEGRITY_CHECK_OK (LogLevel.INFO, R.string.msg_dc_integrity_check_ok),
MSG_DC_OK_META_ONLY (R.string.msg_dc_ok_meta_only), MSG_DC_OK_META_ONLY (LogLevel.OK, R.string.msg_dc_ok_meta_only),
MSG_DC_OK (R.string.msg_dc_ok), MSG_DC_OK (LogLevel.OK, R.string.msg_dc_ok),
MSG_DC_PASS_CACHED (R.string.msg_dc_pass_cached), MSG_DC_PASS_CACHED (LogLevel.DEBUG, R.string.msg_dc_pass_cached),
MSG_DC_PENDING_NFC (R.string.msg_dc_pending_nfc), MSG_DC_PENDING_NFC (LogLevel.INFO, R.string.msg_dc_pending_nfc),
MSG_DC_PENDING_PASSPHRASE (R.string.msg_dc_pending_passphrase), MSG_DC_PENDING_PASSPHRASE (LogLevel.INFO, R.string.msg_dc_pending_passphrase),
MSG_DC_PREP_STREAMS (R.string.msg_dc_prep_streams), MSG_DC_PREP_STREAMS (LogLevel.DEBUG, R.string.msg_dc_prep_streams),
MSG_DC (R.string.msg_dc), MSG_DC (LogLevel.DEBUG, R.string.msg_dc),
MSG_DC_SYM (R.string.msg_dc_sym), MSG_DC_SYM (LogLevel.DEBUG, R.string.msg_dc_sym),
MSG_DC_SYM_SKIP (R.string.msg_dc_sym_skip), MSG_DC_SYM_SKIP (LogLevel.DEBUG, R.string.msg_dc_sym_skip),
MSG_DC_TRAIL_ASYM (R.string.msg_dc_trail_asym), MSG_DC_TRAIL_ASYM (LogLevel.DEBUG, R.string.msg_dc_trail_asym),
MSG_DC_TRAIL_SYM (R.string.msg_dc_trail_sym), MSG_DC_TRAIL_SYM (LogLevel.DEBUG, R.string.msg_dc_trail_sym),
MSG_DC_TRAIL_UNKNOWN (R.string.msg_dc_trail_unknown), MSG_DC_TRAIL_UNKNOWN (LogLevel.DEBUG, R.string.msg_dc_trail_unknown),
MSG_DC_UNLOCKING (R.string.msg_dc_unlocking), MSG_DC_UNLOCKING (LogLevel.INFO, R.string.msg_dc_unlocking),
// signencrypt // signencrypt
MSG_SE_ASYMMETRIC (R.string.msg_se_asymmetric), MSG_SE_ASYMMETRIC (LogLevel.INFO, R.string.msg_se_asymmetric),
MSG_SE_CLEARSIGN_ONLY (R.string.msg_se_clearsign_only), MSG_SE_CLEARSIGN_ONLY (LogLevel.DEBUG, R.string.msg_se_clearsign_only),
MSG_SE_COMPRESSING (R.string.msg_se_compressing), MSG_SE_COMPRESSING (LogLevel.DEBUG, R.string.msg_se_compressing),
MSG_SE_ENCRYPTING (R.string.msg_se_encrypting), MSG_SE_ENCRYPTING (LogLevel.DEBUG, R.string.msg_se_encrypting),
MSG_SE_ERROR_BAD_PASSPHRASE (R.string.msg_se_error_bad_passphrase), MSG_SE_ERROR_BAD_PASSPHRASE (LogLevel.ERROR, R.string.msg_se_error_bad_passphrase),
MSG_SE_ERROR_IO (R.string.msg_se_error_io), MSG_SE_ERROR_IO (LogLevel.ERROR, R.string.msg_se_error_io),
MSG_SE_ERROR_SIGN_KEY(R.string.msg_se_error_sign_key), MSG_SE_ERROR_SIGN_KEY(LogLevel.ERROR, R.string.msg_se_error_sign_key),
MSG_SE_ERROR_KEY_SIGN (R.string.msg_se_error_key_sign), MSG_SE_ERROR_KEY_SIGN (LogLevel.ERROR, R.string.msg_se_error_key_sign),
MSG_SE_ERROR_NFC (R.string.msg_se_error_nfc), MSG_SE_ERROR_NFC (LogLevel.ERROR, R.string.msg_se_error_nfc),
MSG_SE_ERROR_NO_PASSPHRASE (R.string.msg_se_error_no_passphrase), MSG_SE_ERROR_NO_PASSPHRASE (LogLevel.ERROR, R.string.msg_se_error_no_passphrase),
MSG_SE_ERROR_PGP (R.string.msg_se_error_pgp), MSG_SE_ERROR_PGP (LogLevel.ERROR, R.string.msg_se_error_pgp),
MSG_SE_ERROR_SIG (R.string.msg_se_error_sig), MSG_SE_ERROR_SIG (LogLevel.ERROR, R.string.msg_se_error_sig),
MSG_SE_ERROR_UNLOCK (R.string.msg_se_error_unlock), MSG_SE_ERROR_UNLOCK (LogLevel.ERROR, R.string.msg_se_error_unlock),
MSG_SE_KEY_OK (R.string.msg_se_key_ok), MSG_SE_KEY_OK (LogLevel.OK, R.string.msg_se_key_ok),
MSG_SE_KEY_UNKNOWN (R.string.msg_se_key_unknown), MSG_SE_KEY_UNKNOWN (LogLevel.DEBUG, R.string.msg_se_key_unknown),
MSG_SE_KEY_WARN (R.string.msg_se_key_warn), MSG_SE_KEY_WARN (LogLevel.WARN, R.string.msg_se_key_warn),
MSG_SE_OK (R.string.msg_se_ok), MSG_SE_OK (LogLevel.OK, R.string.msg_se_ok),
MSG_SE_PENDING_NFC (R.string.msg_se_pending_nfc), MSG_SE_PENDING_NFC (LogLevel.INFO, R.string.msg_se_pending_nfc),
MSG_SE (R.string.msg_se), MSG_SE (LogLevel.DEBUG, R.string.msg_se),
MSG_SE_SIGNING (R.string.msg_se_signing), MSG_SE_SIGNING (LogLevel.DEBUG, R.string.msg_se_signing),
MSG_SE_SIGCRYPTING (R.string.msg_se_sigcrypting), MSG_SE_SIGCRYPTING (LogLevel.DEBUG, R.string.msg_se_sigcrypting),
MSG_SE_SYMMETRIC (R.string.msg_se_symmetric), MSG_SE_SYMMETRIC (LogLevel.INFO, R.string.msg_se_symmetric),
MSG_CRT_UPLOAD_SUCCESS (R.string.msg_crt_upload_success), MSG_CRT_UPLOAD_SUCCESS (LogLevel.OK, R.string.msg_crt_upload_success),
MSG_CRT_SUCCESS (R.string.msg_crt_success), MSG_CRT_SUCCESS (LogLevel.OK, R.string.msg_crt_success),
MSG_ACC_SAVED (R.string.api_settings_save) MSG_ACC_SAVED (LogLevel.INFO, R.string.api_settings_save)
; ;
private final int mMsgId; public final int mMsgId;
LogType(int msgId) { public final LogLevel mLevel;
LogType(LogLevel level, int msgId) {
mLevel = level;
mMsgId = msgId; mMsgId = msgId;
} }
public int getMsgId() { public int getMsgId() {
@ -540,12 +536,12 @@ public abstract class OperationResult implements Parcelable {
private final List<LogEntryParcel> mParcels = new ArrayList<LogEntryParcel>(); private final List<LogEntryParcel> mParcels = new ArrayList<LogEntryParcel>();
/// Simple convenience method /// Simple convenience method
public void add(LogLevel level, LogType type, int indent, Object... parameters) { public void add(LogType type, int indent, Object... parameters) {
mParcels.add(new OperationResult.LogEntryParcel(level, type, indent, parameters)); mParcels.add(new OperationResult.LogEntryParcel(type, indent, parameters));
} }
public void add(LogLevel level, LogType type, int indent) { public void add(LogType type, int indent) {
mParcels.add(new OperationResult.LogEntryParcel(level, type, indent, (Object[]) null)); mParcels.add(new OperationResult.LogEntryParcel(type, indent, (Object[]) null));
} }
public boolean containsType(LogType type) { public boolean containsType(LogType type) {
@ -559,7 +555,7 @@ public abstract class OperationResult implements Parcelable {
public boolean containsWarnings() { public boolean containsWarnings() {
for(LogEntryParcel entry : new IterableIterator<LogEntryParcel>(mParcels.iterator())) { for(LogEntryParcel entry : new IterableIterator<LogEntryParcel>(mParcels.iterator())) {
if (entry.mLevel == LogLevel.WARN || entry.mLevel == LogLevel.ERROR) { if (entry.mType.mLevel == LogLevel.WARN || entry.mType.mLevel == LogLevel.ERROR) {
return true; return true;
} }
} }

View File

@ -37,7 +37,7 @@ public class SingletonResult extends OperationResult {
public SingletonResult(int result, LogLevel level, LogType reason) { public SingletonResult(int result, LogLevel level, LogType reason) {
super(result, new OperationLog()); super(result, new OperationLog());
// Prepare the log // Prepare the log
mLog.add(level, reason, 0); mLog.add(reason, 0);
} }
@Override @Override

View File

@ -66,7 +66,7 @@ public class LogDisplayFragment extends ListFragment implements OnTouchListener
return; return;
} }
mResult = intent.<OperationResult>getParcelableExtra(EXTRA_RESULT); mResult = intent.getParcelableExtra(EXTRA_RESULT);
if (mResult == null) { if (mResult == null) {
getActivity().finish(); getActivity().finish();
return; return;
@ -142,7 +142,7 @@ public class LogDisplayFragment extends ListFragment implements OnTouchListener
(float) 8, getResources().getDisplayMetrics()); (float) 8, getResources().getDisplayMetrics());
// we can't use addAll for a LogLevel.DEBUG shortcut here, unfortunately :( // we can't use addAll for a LogLevel.DEBUG shortcut here, unfortunately :(
for (LogEntryParcel e : log) { for (LogEntryParcel e : log) {
if (e.mLevel.ordinal() >= level.ordinal()) { if (e.mType.mLevel.ordinal() >= level.ordinal()) {
add(e); add(e);
} }
} }
@ -183,9 +183,9 @@ public class LogDisplayFragment extends ListFragment implements OnTouchListener
ih.mText.setText(getResources().getString(entry.mType.getMsgId(), ih.mText.setText(getResources().getString(entry.mType.getMsgId(),
entry.mParameters)); entry.mParameters));
} }
ih.mText.setTextColor(entry.mLevel == LogLevel.DEBUG ? Color.GRAY : Color.BLACK); ih.mText.setTextColor(entry.mType.mLevel == LogLevel.DEBUG ? Color.GRAY : Color.BLACK);
convertView.setPadding((entry.mIndent) * dipFactor, 0, 0, 0); convertView.setPadding((entry.mIndent) * dipFactor, 0, 0, 0);
switch (entry.mLevel) { switch (entry.mType.mLevel) {
case DEBUG: ih.mImg.setBackgroundColor(Color.GRAY); break; case DEBUG: ih.mImg.setBackgroundColor(Color.GRAY); break;
case INFO: ih.mImg.setBackgroundColor(Color.BLACK); break; case INFO: ih.mImg.setBackgroundColor(Color.BLACK); break;
case WARN: ih.mImg.setBackgroundColor(Color.YELLOW); break; case WARN: ih.mImg.setBackgroundColor(Color.YELLOW); break;

View File

@ -433,8 +433,8 @@
<!--Import Public log entries--> <!--Import Public log entries-->
<string name="msg_ip_delete_old_ok">Alte Schlüssel aus der Datenbank löschen</string> <string name="msg_ip_delete_old_ok">Alte Schlüssel aus der Datenbank löschen</string>
<string name="msg_ip_encode_fail">Die Anwendung ist wegen Kodierungsfehler fehlgeschlagen</string> <string name="msg_ip_encode_fail">Die Anwendung ist wegen Kodierungsfehler fehlgeschlagen</string>
<string name="msg_ip_fail_io_exc">Die Anwendung ist wegen eines Eingabe/Ausgabe-Fehlers fehlgeschlagen</string> <string name="msg_ip_error_io_exc">Die Anwendung ist wegen eines Eingabe/Ausgabe-Fehlers fehlgeschlagen</string>
<string name="msg_ip_fail_remote_ex">Die Anwendung ist wegen internen Fehler fehlgeschlagen</string> <string name="msg_ip_error_remote_ex">Die Anwendung ist wegen internen Fehler fehlgeschlagen</string>
<string name="msg_ip">Importiere öffentlichen Schlüsselbund %s</string> <string name="msg_ip">Importiere öffentlichen Schlüsselbund %s</string>
<string name="msg_ip_insert_keyring">Schlüsselbund-daten werden kodiert</string> <string name="msg_ip_insert_keyring">Schlüsselbund-daten werden kodiert</string>
<string name="msg_ip_insert_keys">Analysiere Schlüssel</string> <string name="msg_ip_insert_keys">Analysiere Schlüssel</string>

View File

@ -490,9 +490,9 @@
<string name="msg_ip_delete_old_fail">No se borró ninguna clave antigua (¿crear una nueva?)</string> <string name="msg_ip_delete_old_fail">No se borró ninguna clave antigua (¿crear una nueva?)</string>
<string name="msg_ip_delete_old_ok">Clave antigua borrada de la base de datos</string> <string name="msg_ip_delete_old_ok">Clave antigua borrada de la base de datos</string>
<string name="msg_ip_encode_fail">La operación falló debido a un error de codificación</string> <string name="msg_ip_encode_fail">La operación falló debido a un error de codificación</string>
<string name="msg_ip_fail_io_exc">La operación falló debido a un error de E/S</string> <string name="msg_ip_error_io_exc">La operación falló debido a un error de E/S</string>
<string name="msg_ip_fail_op_exc">La operación falló debido a un error de la base de datos</string> <string name="msg_ip_error_op_exc">La operación falló debido a un error de la base de datos</string>
<string name="msg_ip_fail_remote_ex">La operación falló debido a un error interno</string> <string name="msg_ip_error_remote_ex">La operación falló debido a un error interno</string>
<string name="msg_ip">Importando juego de claves públicas %s</string> <string name="msg_ip">Importando juego de claves públicas %s</string>
<string name="msg_ip_insert_keyring">Codificando datos del juego de claves (keyring)</string> <string name="msg_ip_insert_keyring">Codificando datos del juego de claves (keyring)</string>
<string name="msg_ip_insert_keys">Analizando claves</string> <string name="msg_ip_insert_keys">Analizando claves</string>
@ -543,7 +543,7 @@
<string name="msg_is">Importando clave secreta (privada) %s</string> <string name="msg_is">Importando clave secreta (privada) %s</string>
<string name="msg_is_db_exception">¡Error de base de datos!</string> <string name="msg_is_db_exception">¡Error de base de datos!</string>
<string name="msg_is_importing_subkeys">Procesando subclaves secretas</string> <string name="msg_is_importing_subkeys">Procesando subclaves secretas</string>
<string name="msg_is_io_exc">Error codificando el juego de claves</string> <string name="msg_is_error_io_exc">Error codificando el juego de claves</string>
<string name="msg_is_pubring_generate">Generando un juego de claves públicas desde el juego de claves secretas (privadas)</string> <string name="msg_is_pubring_generate">Generando un juego de claves públicas desde el juego de claves secretas (privadas)</string>
<string name="msg_is_subkey_nonexistent">La subclave %s no está disponible en la clave secreta (privada)</string> <string name="msg_is_subkey_nonexistent">La subclave %s no está disponible en la clave secreta (privada)</string>
<string name="msg_is_subkey_ok">Subclave secreta (privada) %s marcada como disponible</string> <string name="msg_is_subkey_ok">Subclave secreta (privada) %s marcada como disponible</string>

View File

@ -490,9 +490,9 @@
<string name="msg_ip_delete_old_fail">Aucune ancienne clef de supprimée (création d\'une nouvelle ?)</string> <string name="msg_ip_delete_old_fail">Aucune ancienne clef de supprimée (création d\'une nouvelle ?)</string>
<string name="msg_ip_delete_old_ok">L\'ancienne clef a été supprimée de la base de données</string> <string name="msg_ip_delete_old_ok">L\'ancienne clef a été supprimée de la base de données</string>
<string name="msg_ip_encode_fail">Échec de l\'opération causé par une erreur d\'encodage</string> <string name="msg_ip_encode_fail">Échec de l\'opération causé par une erreur d\'encodage</string>
<string name="msg_ip_fail_io_exc">Échec de l\'opération causé par une erreur d\'e/s</string> <string name="msg_ip_error_io_exc">Échec de l\'opération causé par une erreur d\'e/s</string>
<string name="msg_ip_fail_op_exc">Échec de l\'opération causé par une erreur de base de données</string> <string name="msg_ip_error_op_exc">Échec de l\'opération causé par une erreur de base de données</string>
<string name="msg_ip_fail_remote_ex">Échec de l\'opération causé par une erreur interne</string> <string name="msg_ip_error_remote_ex">Échec de l\'opération causé par une erreur interne</string>
<string name="msg_ip">Importation du trousseau public %s</string> <string name="msg_ip">Importation du trousseau public %s</string>
<string name="msg_ip_insert_keyring">Encodage des données du trousseau</string> <string name="msg_ip_insert_keyring">Encodage des données du trousseau</string>
<string name="msg_ip_insert_keys">Analyse des clefs</string> <string name="msg_ip_insert_keys">Analyse des clefs</string>
@ -543,7 +543,7 @@
<string name="msg_is">Importation de la clef secrète %s</string> <string name="msg_is">Importation de la clef secrète %s</string>
<string name="msg_is_db_exception">Erreur de base de données!</string> <string name="msg_is_db_exception">Erreur de base de données!</string>
<string name="msg_is_importing_subkeys">Traitement des sous-clefs secrètes</string> <string name="msg_is_importing_subkeys">Traitement des sous-clefs secrètes</string>
<string name="msg_is_io_exc">Erreur lors de l\'encodage du trousseau</string> <string name="msg_is_error_io_exc">Erreur lors de l\'encodage du trousseau</string>
<string name="msg_is_pubring_generate">Génération du trousseau public à partir du trousseau secret</string> <string name="msg_is_pubring_generate">Génération du trousseau public à partir du trousseau secret</string>
<string name="msg_is_subkey_nonexistent">La sous-clef %s n\'est pas disponible dans la clef secrète</string> <string name="msg_is_subkey_nonexistent">La sous-clef %s n\'est pas disponible dans la clef secrète</string>
<string name="msg_is_subkey_ok">Marquer la sous-clef secrète %s comme disponible</string> <string name="msg_is_subkey_ok">Marquer la sous-clef secrète %s comme disponible</string>

View File

@ -425,9 +425,9 @@
<string name="msg_ip_delete_old_fail">Nessuna vecchia chiave cancellata (stai creando una nuova?)</string> <string name="msg_ip_delete_old_fail">Nessuna vecchia chiave cancellata (stai creando una nuova?)</string>
<string name="msg_ip_delete_old_ok">Cancellate vecchie chiavi dal database</string> <string name="msg_ip_delete_old_ok">Cancellate vecchie chiavi dal database</string>
<string name="msg_ip_encode_fail">Operazione fallita a causa di un errore di codifica</string> <string name="msg_ip_encode_fail">Operazione fallita a causa di un errore di codifica</string>
<string name="msg_ip_fail_io_exc">Operazione fallita a causa di un errore di i/o</string> <string name="msg_ip_error_io_exc">Operazione fallita a causa di un errore di i/o</string>
<string name="msg_ip_fail_op_exc">Operazione fallita a causa di un errore della banca dati</string> <string name="msg_ip_error_op_exc">Operazione fallita a causa di un errore della banca dati</string>
<string name="msg_ip_fail_remote_ex">Operazione fallita a causa di un errore interno</string> <string name="msg_ip_error_remote_ex">Operazione fallita a causa di un errore interno</string>
<string name="msg_ip">Importazione portachiavi pubblico %s</string> <string name="msg_ip">Importazione portachiavi pubblico %s</string>
<string name="msg_ip_insert_keyring">Codifica dati del portachiavi</string> <string name="msg_ip_insert_keyring">Codifica dati del portachiavi</string>
<string name="msg_ip_insert_keys">Elaborazione chiavi</string> <string name="msg_ip_insert_keys">Elaborazione chiavi</string>
@ -478,7 +478,7 @@
<string name="msg_is">Importazione chiave segreta %s</string> <string name="msg_is">Importazione chiave segreta %s</string>
<string name="msg_is_db_exception">Errore Banca Dati!</string> <string name="msg_is_db_exception">Errore Banca Dati!</string>
<string name="msg_is_importing_subkeys">Elaborazione sottochiavi segrete</string> <string name="msg_is_importing_subkeys">Elaborazione sottochiavi segrete</string>
<string name="msg_is_io_exc">Errore codifica portachiavi</string> <string name="msg_is_error_io_exc">Errore codifica portachiavi</string>
<string name="msg_is_pubring_generate">Generazione portachiavi pubblico da portachiavi privato</string> <string name="msg_is_pubring_generate">Generazione portachiavi pubblico da portachiavi privato</string>
<string name="msg_is_success_identical">Il portachiavi non contiene nuovi dati, nulla da eseguire</string> <string name="msg_is_success_identical">Il portachiavi non contiene nuovi dati, nulla da eseguire</string>
<string name="msg_is_success">Portachiavi segreto importato con successo</string> <string name="msg_is_success">Portachiavi segreto importato con successo</string>

View File

@ -498,9 +498,9 @@
<string name="msg_ip_delete_old_fail">削除された古い鍵はありません (新しく作りますか?)</string> <string name="msg_ip_delete_old_fail">削除された古い鍵はありません (新しく作りますか?)</string>
<string name="msg_ip_delete_old_ok">データベースから古い鍵を削除しました</string> <string name="msg_ip_delete_old_ok">データベースから古い鍵を削除しました</string>
<string name="msg_ip_encode_fail">エンコードエラーにより操作が失敗しました</string> <string name="msg_ip_encode_fail">エンコードエラーにより操作が失敗しました</string>
<string name="msg_ip_fail_io_exc">I/Oエラーにより操作が失敗しました</string> <string name="msg_ip_error_io_exc">I/Oエラーにより操作が失敗しました</string>
<string name="msg_ip_fail_op_exc">データベースエラーにより操作が失敗しました</string> <string name="msg_ip_error_op_exc">データベースエラーにより操作が失敗しました</string>
<string name="msg_ip_fail_remote_ex">内部エラーにより操作が失敗しました</string> <string name="msg_ip_error_remote_ex">内部エラーにより操作が失敗しました</string>
<string name="msg_ip">公開鍵の鍵輪 %s をインポート</string> <string name="msg_ip">公開鍵の鍵輪 %s をインポート</string>
<string name="msg_ip_insert_keyring">鍵輪データのエンコード中</string> <string name="msg_ip_insert_keyring">鍵輪データのエンコード中</string>
<string name="msg_ip_insert_keys">鍵の解析中</string> <string name="msg_ip_insert_keys">鍵の解析中</string>
@ -549,7 +549,7 @@
<string name="msg_is">秘密鍵 %s のインポート中</string> <string name="msg_is">秘密鍵 %s のインポート中</string>
<string name="msg_is_db_exception">データベースエラー!</string> <string name="msg_is_db_exception">データベースエラー!</string>
<string name="msg_is_importing_subkeys">秘密鍵の副鍵の処理中</string> <string name="msg_is_importing_subkeys">秘密鍵の副鍵の処理中</string>
<string name="msg_is_io_exc">鍵輪のエンコードエラー</string> <string name="msg_is_error_io_exc">鍵輪のエンコードエラー</string>
<string name="msg_is_pubring_generate">秘密鍵の鍵輪から公開鍵の鍵輪を生成中</string> <string name="msg_is_pubring_generate">秘密鍵の鍵輪から公開鍵の鍵輪を生成中</string>
<string name="msg_is_subkey_nonexistent">秘密鍵の副鍵 %s が利用不可能</string> <string name="msg_is_subkey_nonexistent">秘密鍵の副鍵 %s が利用不可能</string>
<string name="msg_is_subkey_ok">秘密鍵の副鍵 %s を利用可能としてマーク</string> <string name="msg_is_subkey_ok">秘密鍵の副鍵 %s を利用可能としてマーク</string>

View File

@ -409,8 +409,8 @@
<string name="msg_ip_delete_old_fail">Старый ключ не удален (создать новый?)</string> <string name="msg_ip_delete_old_fail">Старый ключ не удален (создать новый?)</string>
<string name="msg_ip_delete_old_ok">Старый ключ удален из базы</string> <string name="msg_ip_delete_old_ok">Старый ключ удален из базы</string>
<string name="msg_ip_encode_fail">Действие прервано из-за ошибки кодировки</string> <string name="msg_ip_encode_fail">Действие прервано из-за ошибки кодировки</string>
<string name="msg_ip_fail_io_exc">Действие прервано из-за ошибки ввода/вывода</string> <string name="msg_ip_error_io_exc">Действие прервано из-за ошибки ввода/вывода</string>
<string name="msg_ip_fail_remote_ex">Действие прервано из-за внутренней ошибки</string> <string name="msg_ip_error_remote_ex">Действие прервано из-за внутренней ошибки</string>
<string name="msg_ip">Импорт связки публичных ключей %s</string> <string name="msg_ip">Импорт связки публичных ключей %s</string>
<string name="msg_ip_insert_keys">Разбор ключей</string> <string name="msg_ip_insert_keys">Разбор ключей</string>
<string name="msg_ip_prepare">Подготовка операций</string> <string name="msg_ip_prepare">Подготовка операций</string>

View File

@ -410,8 +410,8 @@
<string name="msg_ip_delete_old_fail">Noben star ključ ni bil izbrisan (ustvarim novega?)</string> <string name="msg_ip_delete_old_fail">Noben star ključ ni bil izbrisan (ustvarim novega?)</string>
<string name="msg_ip_delete_old_ok">Star ključ je bil izbrisan iz baze</string> <string name="msg_ip_delete_old_ok">Star ključ je bil izbrisan iz baze</string>
<string name="msg_ip_encode_fail">Operacija ni uspela zaradi napake</string> <string name="msg_ip_encode_fail">Operacija ni uspela zaradi napake</string>
<string name="msg_ip_fail_io_exc">Operacija ni uspela zaradi napake pri branju/pisanju</string> <string name="msg_ip_error_io_exc">Operacija ni uspela zaradi napake pri branju/pisanju</string>
<string name="msg_ip_fail_remote_ex">Operacija ni uspela zaradi notranje napake</string> <string name="msg_ip_error_remote_ex">Operacija ni uspela zaradi notranje napake</string>
<string name="msg_ip">Uvažam javno zbirko ključev %s</string> <string name="msg_ip">Uvažam javno zbirko ključev %s</string>
<string name="msg_ip_insert_keyring">Šifriram podatke zbirke klučev</string> <string name="msg_ip_insert_keyring">Šifriram podatke zbirke klučev</string>
<string name="msg_ip_prepare">Pripravljam </string> <string name="msg_ip_prepare">Pripravljam </string>

View File

@ -439,9 +439,9 @@
<string name="msg_ip_delete_old_fail">Нема вилученого старого ключа (створюється новий?)</string> <string name="msg_ip_delete_old_fail">Нема вилученого старого ключа (створюється новий?)</string>
<string name="msg_ip_delete_old_ok">Вилучений старий ключ з бази даних</string> <string name="msg_ip_delete_old_ok">Вилучений старий ключ з бази даних</string>
<string name="msg_ip_encode_fail">Операція не вдалася через помилку кодування</string> <string name="msg_ip_encode_fail">Операція не вдалася через помилку кодування</string>
<string name="msg_ip_fail_io_exc">Операція не вдалася через помилку вводу/виводу</string> <string name="msg_ip_error_io_exc">Операція не вдалася через помилку вводу/виводу</string>
<string name="msg_ip_fail_op_exc">Операція не вдалася через помилку бази даних</string> <string name="msg_ip_error_op_exc">Операція не вдалася через помилку бази даних</string>
<string name="msg_ip_fail_remote_ex">Операція не вдалася через внутрішню помилку</string> <string name="msg_ip_error_remote_ex">Операція не вдалася через внутрішню помилку</string>
<string name="msg_ip">Імпортується публічна в\'язка %s</string> <string name="msg_ip">Імпортується публічна в\'язка %s</string>
<string name="msg_ip_insert_keyring">Шифруються дані із в\'язки</string> <string name="msg_ip_insert_keyring">Шифруються дані із в\'язки</string>
<string name="msg_ip_insert_keys">Аналізуються ключі</string> <string name="msg_ip_insert_keys">Аналізуються ключі</string>
@ -494,7 +494,7 @@
<string name="msg_is">Імпортується секретний ключ %s</string> <string name="msg_is">Імпортується секретний ключ %s</string>
<string name="msg_is_db_exception">Помилка бази даних!</string> <string name="msg_is_db_exception">Помилка бази даних!</string>
<string name="msg_is_importing_subkeys">Опрацьовуються секретні підключі</string> <string name="msg_is_importing_subkeys">Опрацьовуються секретні підключі</string>
<string name="msg_is_io_exc">Помилка шифрування в’язки</string> <string name="msg_is_error_io_exc">Помилка шифрування в’язки</string>
<string name="msg_is_pubring_generate">Генерується публічна в\'язка із секретної</string> <string name="msg_is_pubring_generate">Генерується публічна в\'язка із секретної</string>
<string name="msg_is_success_identical">В\'язка не містить нових даних. Нема що робити.</string> <string name="msg_is_success_identical">В\'язка не містить нових даних. Нема що робити.</string>
<string name="msg_is_success">Успішно імпортована секретна в\'язка</string> <string name="msg_is_success">Успішно імпортована секретна в\'язка</string>

View File

@ -543,9 +543,9 @@
<string name="msg_ip_delete_old_fail">"No old key deleted (creating a new one?)"</string> <string name="msg_ip_delete_old_fail">"No old key deleted (creating a new one?)"</string>
<string name="msg_ip_delete_old_ok">"Deleted old key from database"</string> <string name="msg_ip_delete_old_ok">"Deleted old key from database"</string>
<string name="msg_ip_encode_fail">"Operation failed due to encoding error"</string> <string name="msg_ip_encode_fail">"Operation failed due to encoding error"</string>
<string name="msg_ip_fail_io_exc">"Operation failed due to i/o error"</string> <string name="msg_ip_error_io_exc">"Operation failed due to i/o error"</string>
<string name="msg_ip_fail_op_exc">"Operation failed due to database error"</string> <string name="msg_ip_error_op_exc">"Operation failed due to database error"</string>
<string name="msg_ip_fail_remote_ex">"Operation failed due to internal error"</string> <string name="msg_ip_error_remote_ex">"Operation failed due to internal error"</string>
<string name="msg_ip">"Importing public keyring %s"</string> <string name="msg_ip">"Importing public keyring %s"</string>
<string name="msg_ip_insert_keyring">"Encoding keyring data"</string> <string name="msg_ip_insert_keyring">"Encoding keyring data"</string>
<string name="msg_ip_insert_keys">"Parsing keys"</string> <string name="msg_ip_insert_keys">"Parsing keys"</string>
@ -597,7 +597,7 @@
<string name="msg_is">"Importing secret key %s"</string> <string name="msg_is">"Importing secret key %s"</string>
<string name="msg_is_db_exception">"Database error!"</string> <string name="msg_is_db_exception">"Database error!"</string>
<string name="msg_is_importing_subkeys">"Processing secret subkeys"</string> <string name="msg_is_importing_subkeys">"Processing secret subkeys"</string>
<string name="msg_is_io_exc">"Error encoding keyring"</string> <string name="msg_is_error_io_exc">"Error encoding keyring"</string>
<string name="msg_is_pubring_generate">"Generating public keyring from secret keyring"</string> <string name="msg_is_pubring_generate">"Generating public keyring from secret keyring"</string>
<string name="msg_is_subkey_nonexistent">"Subkey %s unavailable in secret key"</string> <string name="msg_is_subkey_nonexistent">"Subkey %s unavailable in secret key"</string>
<string name="msg_is_subkey_ok">"Marked secret subkey %s as available"</string> <string name="msg_is_subkey_ok">"Marked secret subkey %s as available"</string>