mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
parent
b7b22beafc
commit
d6a2875816
@ -33,7 +33,6 @@ import org.spongycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.spongycastle.openpgp.PGPSignature;
|
||||
import org.spongycastle.openpgp.PGPSignatureGenerator;
|
||||
import org.spongycastle.openpgp.PGPSignatureSubpacketGenerator;
|
||||
import org.spongycastle.openpgp.PGPSignatureSubpacketVector;
|
||||
import org.spongycastle.openpgp.PGPUtil;
|
||||
import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor;
|
||||
import org.spongycastle.openpgp.operator.PBESecretKeyEncryptor;
|
||||
@ -51,7 +50,6 @@ import org.sufficientlysecure.keychain.service.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||
import org.sufficientlysecure.keychain.util.Primes;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -65,7 +63,6 @@ import java.security.SignatureException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
@ -268,18 +265,18 @@ public class PgpKeyOperation {
|
||||
// 4a. For each subkey change, generate new subkey binding certificate
|
||||
for (SaveKeyringParcel.SubkeyChange change : saveParcel.changeSubKeys) {
|
||||
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_CHANGE,
|
||||
new String[]{PgpKeyHelper.convertKeyIdToHex(change.mKeyId)}, indent);
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(change.mKeyId));
|
||||
PGPSecretKey sKey = sKR.getSecretKey(change.mKeyId);
|
||||
if (sKey == null) {
|
||||
log.add(LogLevel.ERROR, LogType.MSG_MF_SUBKEY_MISSING,
|
||||
new String[]{PgpKeyHelper.convertKeyIdToHex(change.mKeyId)}, indent + 1);
|
||||
indent + 1, PgpKeyHelper.convertKeyIdToHex(change.mKeyId));
|
||||
return null;
|
||||
}
|
||||
PGPPublicKey pKey = sKey.getPublicKey();
|
||||
|
||||
if (change.mExpiry != null && new Date(change.mExpiry).before(new Date())) {
|
||||
log.add(LogLevel.ERROR, LogType.MSG_MF_SUBKEY_PAST_EXPIRY,
|
||||
new String[]{PgpKeyHelper.convertKeyIdToHex(change.mKeyId)}, indent + 1);
|
||||
indent + 1, PgpKeyHelper.convertKeyIdToHex(change.mKeyId));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -293,11 +290,11 @@ public class PgpKeyOperation {
|
||||
// 4b. For each subkey revocation, generate new subkey revocation certificate
|
||||
for (long revocation : saveParcel.revokeSubKeys) {
|
||||
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_REVOKE,
|
||||
new String[] { PgpKeyHelper.convertKeyIdToHex(revocation) }, indent);
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(revocation));
|
||||
PGPSecretKey sKey = sKR.getSecretKey(revocation);
|
||||
if (sKey == null) {
|
||||
log.add(LogLevel.ERROR, LogType.MSG_MF_SUBKEY_MISSING,
|
||||
new String[] { PgpKeyHelper.convertKeyIdToHex(revocation) }, indent+1);
|
||||
indent+1, PgpKeyHelper.convertKeyIdToHex(revocation));
|
||||
return null;
|
||||
}
|
||||
PGPPublicKey pKey = sKey.getPublicKey();
|
||||
@ -321,7 +318,7 @@ public class PgpKeyOperation {
|
||||
log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_NEW, indent);
|
||||
PGPSecretKey sKey = createKey(add.mAlgorithm, add.mKeysize, passphrase, false);
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_MF_SUBKEY_NEW_ID,
|
||||
new String[] { PgpKeyHelper.convertKeyIdToHex(sKey.getKeyID()) }, indent+1);
|
||||
indent+1, PgpKeyHelper.convertKeyIdToHex(sKey.getKeyID()));
|
||||
|
||||
PGPPublicKey pKey = sKey.getPublicKey();
|
||||
PGPSignature cert = generateSubkeyBindingSignature(masterPublicKey, masterPrivateKey,
|
||||
|
@ -207,7 +207,7 @@ public class UncachedKeyRing {
|
||||
public UncachedKeyRing canonicalize(OperationLog log, int indent) {
|
||||
|
||||
log.add(LogLevel.START, isSecret() ? LogType.MSG_KC_SECRET : LogType.MSG_KC_PUBLIC,
|
||||
new String[]{PgpKeyHelper.convertKeyIdToHex(getMasterKeyId())}, indent);
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(getMasterKeyId()));
|
||||
indent += 1;
|
||||
|
||||
final Date now = new Date();
|
||||
@ -220,7 +220,7 @@ public class UncachedKeyRing {
|
||||
|
||||
{
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_KC_MASTER,
|
||||
new String[]{PgpKeyHelper.convertKeyIdToHex(masterKey.getKeyID())}, indent);
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(masterKey.getKeyID()));
|
||||
indent += 1;
|
||||
|
||||
PGPPublicKey modified = masterKey;
|
||||
@ -240,9 +240,7 @@ public class UncachedKeyRing {
|
||||
|
||||
if (type != PGPSignature.KEY_REVOCATION) {
|
||||
// Unknown type, just remove
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TYPE, new String[]{
|
||||
"0x" + Integer.toString(type, 16)
|
||||
}, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TYPE, indent, "0x" + Integer.toString(type, 16));
|
||||
modified = PGPPublicKey.removeCertification(modified, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
@ -250,7 +248,7 @@ public class UncachedKeyRing {
|
||||
|
||||
if (cert.getCreationTime().after(now)) {
|
||||
// Creation date in the future? No way!
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TIME, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TIME, indent);
|
||||
modified = PGPPublicKey.removeCertification(modified, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
@ -258,7 +256,7 @@ public class UncachedKeyRing {
|
||||
|
||||
if (cert.isLocal()) {
|
||||
// Creation date in the future? No way!
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_LOCAL, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_LOCAL, indent);
|
||||
modified = PGPPublicKey.removeCertification(modified, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
@ -267,13 +265,13 @@ public class UncachedKeyRing {
|
||||
try {
|
||||
cert.init(masterKey);
|
||||
if (!cert.verifySignature(masterKey)) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD, indent);
|
||||
modified = PGPPublicKey.removeCertification(modified, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
} catch (PgpGeneralException e) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_ERR, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_ERR, indent);
|
||||
modified = PGPPublicKey.removeCertification(modified, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
@ -286,12 +284,12 @@ public class UncachedKeyRing {
|
||||
} else if (revocation.getCreationTime().before(zert.getCreationTime())) {
|
||||
modified = PGPPublicKey.removeCertification(modified, revocation);
|
||||
redundantCerts += 1;
|
||||
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, null, indent);
|
||||
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, indent);
|
||||
revocation = zert;
|
||||
} else {
|
||||
modified = PGPPublicKey.removeCertification(modified, zert);
|
||||
redundantCerts += 1;
|
||||
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, null, indent);
|
||||
log.add(LogLevel.INFO, LogType.MSG_KC_REVOKE_DUP, indent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,16 +310,14 @@ public class UncachedKeyRing {
|
||||
&& type != PGPSignature.POSITIVE_CERTIFICATION
|
||||
&& type != PGPSignature.CERTIFICATION_REVOCATION) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_TYPE,
|
||||
new String[] {
|
||||
"0x" + Integer.toString(zert.getSignatureType(), 16)
|
||||
}, indent);
|
||||
indent, "0x" + Integer.toString(zert.getSignatureType(), 16));
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, zert);
|
||||
badCerts += 1;
|
||||
}
|
||||
|
||||
if (cert.getCreationTime().after(now)) {
|
||||
// Creation date in the future? No way!
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TIME, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_TIME, indent);
|
||||
modified = PGPPublicKey.removeCertification(modified, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
@ -329,7 +325,7 @@ public class UncachedKeyRing {
|
||||
|
||||
if (cert.isLocal()) {
|
||||
// Creation date in the future? No way!
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_LOCAL, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_REVOKE_BAD_LOCAL, indent);
|
||||
modified = PGPPublicKey.removeCertification(modified, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
@ -340,7 +336,7 @@ public class UncachedKeyRing {
|
||||
// never mind any further for public keys, but remove them from secret ones
|
||||
if (isSecret()) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_UID_FOREIGN,
|
||||
new String[] { PgpKeyHelper.convertKeyIdToHex(certId) }, indent);
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(certId));
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, zert);
|
||||
badCerts += 1;
|
||||
}
|
||||
@ -352,14 +348,14 @@ public class UncachedKeyRing {
|
||||
cert.init(masterKey);
|
||||
if (!cert.verifySignature(masterKey, userId)) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
} catch (PgpGeneralException e) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_UID_BAD_ERR,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, zert);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
@ -376,13 +372,13 @@ public class UncachedKeyRing {
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, selfCert);
|
||||
redundantCerts += 1;
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_DUP,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
selfCert = zert;
|
||||
} else {
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, zert);
|
||||
redundantCerts += 1;
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_DUP,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
}
|
||||
// If there is a revocation certificate, and it's older than this, drop it
|
||||
if (revocation != null
|
||||
@ -391,7 +387,7 @@ public class UncachedKeyRing {
|
||||
revocation = null;
|
||||
redundantCerts += 1;
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_OLD,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -401,7 +397,7 @@ public class UncachedKeyRing {
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, zert);
|
||||
redundantCerts += 1;
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_OLD,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
continue;
|
||||
}
|
||||
// first revocation? remember it.
|
||||
@ -412,13 +408,13 @@ public class UncachedKeyRing {
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, revocation);
|
||||
redundantCerts += 1;
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_DUP,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
revocation = zert;
|
||||
} else {
|
||||
modified = PGPPublicKey.removeCertification(modified, userId, zert);
|
||||
redundantCerts += 1;
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_KC_UID_REVOKE_DUP,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -430,13 +426,13 @@ public class UncachedKeyRing {
|
||||
if (selfCert == null && revocation == null) {
|
||||
modified = PGPPublicKey.removeCertification(modified, userId);
|
||||
log.add(LogLevel.ERROR, LogType.MSG_KC_UID_REVOKE_DUP,
|
||||
new String[] { userId }, indent);
|
||||
indent, userId);
|
||||
}
|
||||
}
|
||||
|
||||
// If NO user ids remain, error out!
|
||||
if (!modified.getUserIDs().hasNext()) {
|
||||
log.add(LogLevel.ERROR, LogType.MSG_KC_FATAL_NO_UID, null, indent);
|
||||
log.add(LogLevel.ERROR, LogType.MSG_KC_FATAL_NO_UID, indent);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -453,7 +449,7 @@ public class UncachedKeyRing {
|
||||
continue;
|
||||
}
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_KC_SUB,
|
||||
new String[]{PgpKeyHelper.convertKeyIdToHex(key.getKeyID())}, indent);
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(key.getKeyID()));
|
||||
indent += 1;
|
||||
// A subkey needs exactly one subkey binding certificate, and optionally one revocation
|
||||
// certificate.
|
||||
@ -468,29 +464,27 @@ public class UncachedKeyRing {
|
||||
|
||||
// filter out bad key types...
|
||||
if (cert.getKeyId() != masterKey.getKeyID()) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_KEYID, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_KEYID, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type != PGPSignature.SUBKEY_BINDING && type != PGPSignature.SUBKEY_REVOCATION) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_TYPE, new String[]{
|
||||
"0x" + Integer.toString(type, 16)
|
||||
}, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_TYPE, indent, "0x" + Integer.toString(type, 16));
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cert.getCreationTime().after(now)) {
|
||||
// Creation date in the future? No way!
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_TIME, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_TIME, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cert.isLocal()) {
|
||||
// Creation date in the future? No way!
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_LOCAL, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_LOCAL, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
@ -501,12 +495,12 @@ public class UncachedKeyRing {
|
||||
try {
|
||||
cert.init(masterKey);
|
||||
if (!cert.verifySignature(masterKey, key)) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
} catch (PgpGeneralException e) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_ERR, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_BAD_ERR, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
@ -526,19 +520,19 @@ public class UncachedKeyRing {
|
||||
if (subsig.verifySignature(masterKey, key)) {
|
||||
ok = true;
|
||||
} else {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_BAD, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_BAD, indent);
|
||||
badCerts += 1;
|
||||
continue uids;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_NONE, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_NONE, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_BAD_ERR, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_PRIMARY_BAD_ERR, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
@ -565,12 +559,12 @@ public class UncachedKeyRing {
|
||||
try {
|
||||
cert.init(masterKey);
|
||||
if (!cert.verifySignature(key)) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_REVOKE_BAD, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_REVOKE_BAD, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
} catch (PgpGeneralException e) {
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_REVOKE_BAD_ERR, null, indent);
|
||||
log.add(LogLevel.WARN, LogType.MSG_KC_SUB_REVOKE_BAD_ERR, indent);
|
||||
badCerts += 1;
|
||||
continue;
|
||||
}
|
||||
@ -591,7 +585,7 @@ public class UncachedKeyRing {
|
||||
ring = replacePublicKey(ring, modified);
|
||||
|
||||
log.add(LogLevel.ERROR, LogType.MSG_KC_SUB_NO_CERT,
|
||||
new String[]{ PgpKeyHelper.convertKeyIdToHex(key.getKeyID()) }, indent);
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(key.getKeyID()));
|
||||
indent -= 1;
|
||||
continue;
|
||||
}
|
||||
@ -608,17 +602,17 @@ public class UncachedKeyRing {
|
||||
}
|
||||
|
||||
if (badCerts > 0 && redundantCerts > 0) {
|
||||
// multi plural would make this complex, just leaving this as is...
|
||||
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS_BAD_AND_RED,
|
||||
new String[] { Integer.toString(badCerts),
|
||||
Integer.toString(redundantCerts) }, indent);
|
||||
indent, Integer.toString(badCerts), Integer.toString(redundantCerts));
|
||||
} else if (badCerts > 0) {
|
||||
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS_BAD,
|
||||
new String[] { Integer.toString(badCerts) }, indent);
|
||||
indent, badCerts);
|
||||
} else if (redundantCerts > 0) {
|
||||
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS_REDUNDANT,
|
||||
new String[] { Integer.toString(redundantCerts) }, indent);
|
||||
indent, redundantCerts);
|
||||
} else {
|
||||
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS, null, indent);
|
||||
log.add(LogLevel.OK, LogType.MSG_KC_SUCCESS, indent);
|
||||
}
|
||||
|
||||
return new UncachedKeyRing(ring, true);
|
||||
@ -638,13 +632,13 @@ public class UncachedKeyRing {
|
||||
public UncachedKeyRing merge(UncachedKeyRing other, OperationLog log, int indent) {
|
||||
|
||||
log.add(LogLevel.DEBUG, isSecret() ? LogType.MSG_MG_SECRET : LogType.MSG_MG_PUBLIC,
|
||||
new String[]{ PgpKeyHelper.convertKeyIdToHex(getMasterKeyId()) }, indent);
|
||||
indent, PgpKeyHelper.convertKeyIdToHex(getMasterKeyId()));
|
||||
indent += 1;
|
||||
|
||||
long masterKeyId = other.getMasterKeyId();
|
||||
|
||||
if (getMasterKeyId() != masterKeyId) {
|
||||
log.add(LogLevel.ERROR, LogType.MSG_MG_HETEROGENEOUS, null, indent);
|
||||
log.add(LogLevel.ERROR, LogType.MSG_MG_HETEROGENEOUS, indent);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -683,7 +677,7 @@ public class UncachedKeyRing {
|
||||
|
||||
final PGPPublicKey resultKey = result.getPublicKey(key.getKeyID());
|
||||
if (resultKey == null) {
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_MG_NEW_SUBKEY, null, indent);
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_MG_NEW_SUBKEY, indent);
|
||||
result = replacePublicKey(result, key);
|
||||
continue;
|
||||
}
|
||||
@ -751,12 +745,12 @@ public class UncachedKeyRing {
|
||||
}
|
||||
|
||||
log.add(LogLevel.DEBUG, LogType.MSG_MG_FOUND_NEW,
|
||||
new String[] { Integer.toString(newCerts) }, indent);
|
||||
indent, Integer.toString(newCerts));
|
||||
|
||||
return new UncachedKeyRing(result);
|
||||
|
||||
} catch (IOException e) {
|
||||
log.add(LogLevel.ERROR, LogType.MSG_MG_FATAL_ENCODE, null, indent);
|
||||
log.add(LogLevel.ERROR, LogType.MSG_MG_FATAL_ENCODE, indent);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -165,10 +165,10 @@ public class KeychainDatabase extends SQLiteOpenHelper {
|
||||
|
||||
// make sure this is only done once, on the first instance!
|
||||
boolean iAmIt = false;
|
||||
synchronized(apgHack) {
|
||||
if(!apgHack) {
|
||||
synchronized(KeychainDatabase.class) {
|
||||
if(!KeychainDatabase.apgHack) {
|
||||
iAmIt = true;
|
||||
apgHack = true;
|
||||
KeychainDatabase.apgHack = true;
|
||||
}
|
||||
}
|
||||
// if it's us, do the import
|
||||
@ -206,6 +206,7 @@ public class KeychainDatabase extends SQLiteOpenHelper {
|
||||
try {
|
||||
db.execSQL("ALTER TABLE keys ADD COLUMN has_secret BOOLEAN");
|
||||
} catch (Exception e) {
|
||||
// never mind, the column probably already existed
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,8 +262,8 @@ public class KeychainDatabase extends SQLiteOpenHelper {
|
||||
cursor = db.rawQuery("SELECT key_ring_data FROM key_rings WHERE type = 1 OR EXISTS ("
|
||||
+ " SELECT 1 FROM key_rings d2 WHERE key_rings.master_key_id = d2.master_key_id"
|
||||
+ " AND d2.type = 1) ORDER BY type ASC", null);
|
||||
Log.d(Constants.TAG, "Importing " + cursor.getCount() + " secret keyrings from apg.db...");
|
||||
if (cursor != null) {
|
||||
Log.d(Constants.TAG, "Importing " + cursor.getCount() + " secret keyrings from apg.db...");
|
||||
for (int i = 0; i < cursor.getCount(); i++) {
|
||||
cursor.moveToPosition(i);
|
||||
byte[] data = cursor.getBlob(0);
|
||||
@ -285,8 +286,8 @@ public class KeychainDatabase extends SQLiteOpenHelper {
|
||||
+ " SELECT 1 FROM key_rings d2 WHERE key_rings.master_key_id = d2.master_key_id AND"
|
||||
+ " d2.type = 1)) DESC, type DESC", null);
|
||||
// import from old database
|
||||
Log.d(Constants.TAG, "Importing " + cursor.getCount() + " keyrings from apg.db...");
|
||||
if (cursor != null) {
|
||||
Log.d(Constants.TAG, "Importing " + cursor.getCount() + " keyrings from apg.db...");
|
||||
for (int i = 0; i < cursor.getCount(); i++) {
|
||||
cursor.moveToPosition(i);
|
||||
byte[] data = cursor.getBlob(0);
|
||||
|
@ -116,12 +116,12 @@ public class ProviderHelper {
|
||||
|
||||
public void log(LogLevel level, LogType type) {
|
||||
if(mLog != null) {
|
||||
mLog.add(level, type, null, mIndent);
|
||||
mLog.add(level, type, mIndent);
|
||||
}
|
||||
}
|
||||
public void log(LogLevel level, LogType type, String[] parameters) {
|
||||
public void log(LogLevel level, LogType type, Object... parameters) {
|
||||
if(mLog != null) {
|
||||
mLog.add(level, type, parameters, mIndent);
|
||||
mLog.add(level, type, mIndent, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,9 +320,9 @@ public class ProviderHelper {
|
||||
int rank = 0;
|
||||
for (UncachedPublicKey key : new IterableIterator<UncachedPublicKey>(keyRing.getPublicKeys())) {
|
||||
long keyId = key.getKeyId();
|
||||
log(LogLevel.DEBUG, keyId == masterKeyId ? LogType.MSG_IP_MASTER : LogType.MSG_IP_SUBKEY, new String[]{
|
||||
log(LogLevel.DEBUG, keyId == masterKeyId ? LogType.MSG_IP_MASTER : LogType.MSG_IP_SUBKEY,
|
||||
PgpKeyHelper.convertKeyIdToHex(keyId)
|
||||
});
|
||||
);
|
||||
mIndent += 1;
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
@ -343,36 +343,36 @@ public class ProviderHelper {
|
||||
if (c) {
|
||||
if (e) {
|
||||
log(LogLevel.DEBUG, s ? LogType.MSG_IP_MASTER_FLAGS_CES
|
||||
: LogType.MSG_IP_MASTER_FLAGS_CEX, null);
|
||||
: LogType.MSG_IP_MASTER_FLAGS_CEX);
|
||||
} else {
|
||||
log(LogLevel.DEBUG, s ? LogType.MSG_IP_MASTER_FLAGS_CXS
|
||||
: LogType.MSG_IP_MASTER_FLAGS_CXX, null);
|
||||
: LogType.MSG_IP_MASTER_FLAGS_CXX);
|
||||
}
|
||||
} else {
|
||||
if (e) {
|
||||
log(LogLevel.DEBUG, s ? LogType.MSG_IP_MASTER_FLAGS_XES
|
||||
: LogType.MSG_IP_MASTER_FLAGS_XEX, null);
|
||||
: LogType.MSG_IP_MASTER_FLAGS_XEX);
|
||||
} else {
|
||||
log(LogLevel.DEBUG, s ? LogType.MSG_IP_MASTER_FLAGS_XXS
|
||||
: LogType.MSG_IP_MASTER_FLAGS_XXX, null);
|
||||
: LogType.MSG_IP_MASTER_FLAGS_XXX);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (c) {
|
||||
if (e) {
|
||||
log(LogLevel.DEBUG, s ? LogType.MSG_IP_SUBKEY_FLAGS_CES
|
||||
: LogType.MSG_IP_SUBKEY_FLAGS_CEX, null);
|
||||
: LogType.MSG_IP_SUBKEY_FLAGS_CEX);
|
||||
} else {
|
||||
log(LogLevel.DEBUG, s ? LogType.MSG_IP_SUBKEY_FLAGS_CXS
|
||||
: LogType.MSG_IP_SUBKEY_FLAGS_CXX, null);
|
||||
: LogType.MSG_IP_SUBKEY_FLAGS_CXX);
|
||||
}
|
||||
} else {
|
||||
if (e) {
|
||||
log(LogLevel.DEBUG, s ? LogType.MSG_IP_SUBKEY_FLAGS_XES
|
||||
: LogType.MSG_IP_SUBKEY_FLAGS_XEX, null);
|
||||
: LogType.MSG_IP_SUBKEY_FLAGS_XEX);
|
||||
} else {
|
||||
log(LogLevel.DEBUG, s ? LogType.MSG_IP_SUBKEY_FLAGS_XXS
|
||||
: LogType.MSG_IP_SUBKEY_FLAGS_XXX, null);
|
||||
: LogType.MSG_IP_SUBKEY_FLAGS_XXX);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -385,11 +385,11 @@ public class ProviderHelper {
|
||||
if (key.isExpired()) {
|
||||
log(LogLevel.DEBUG, keyId == masterKeyId ?
|
||||
LogType.MSG_IP_MASTER_EXPIRED : LogType.MSG_IP_SUBKEY_EXPIRED,
|
||||
new String[]{ expiryDate.toString() });
|
||||
expiryDate.toString());
|
||||
} else {
|
||||
log(LogLevel.DEBUG, keyId == masterKeyId ?
|
||||
LogType.MSG_IP_MASTER_EXPIRES : LogType.MSG_IP_SUBKEY_EXPIRES,
|
||||
new String[] { expiryDate.toString() });
|
||||
expiryDate.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,9 +405,7 @@ public class ProviderHelper {
|
||||
|
||||
// classify and order user ids. primary are moved to the front, revoked to the back,
|
||||
// otherwise the order in the keyfile is preserved.
|
||||
log(LogLevel.INFO, LogType.MSG_IP_UID_CLASSIFYING, new String[]{
|
||||
Integer.toString(trustedKeys.size())
|
||||
});
|
||||
log(LogLevel.INFO, LogType.MSG_IP_UID_CLASSIFYING, trustedKeys.size());
|
||||
mIndent += 1;
|
||||
List<UserIdItem> uids = new ArrayList<UserIdItem>();
|
||||
for (String userId : new IterableIterator<String>(
|
||||
@ -418,7 +416,7 @@ public class ProviderHelper {
|
||||
|
||||
int unknownCerts = 0;
|
||||
|
||||
log(LogLevel.INFO, LogType.MSG_IP_UID_PROCESSING, new String[]{ userId });
|
||||
log(LogLevel.INFO, LogType.MSG_IP_UID_PROCESSING, userId);
|
||||
mIndent += 1;
|
||||
// look through signatures for this specific key
|
||||
for (WrappedSignature cert : new IterableIterator<WrappedSignature>(
|
||||
@ -447,10 +445,10 @@ public class ProviderHelper {
|
||||
cert.init(trustedKey);
|
||||
if (cert.verifySignature(masterKey, userId)) {
|
||||
item.trustedCerts.add(cert);
|
||||
log(LogLevel.INFO, LogType.MSG_IP_UID_CERT_GOOD, new String[] {
|
||||
log(LogLevel.INFO, LogType.MSG_IP_UID_CERT_GOOD,
|
||||
PgpKeyHelper.convertKeyIdToHexShort(trustedKey.getKeyId()),
|
||||
trustedKey.getPrimaryUserId()
|
||||
});
|
||||
);
|
||||
} else {
|
||||
log(LogLevel.WARN, LogType.MSG_IP_UID_CERT_BAD);
|
||||
}
|
||||
@ -459,16 +457,13 @@ public class ProviderHelper {
|
||||
unknownCerts += 1;
|
||||
|
||||
} catch (PgpGeneralException e) {
|
||||
log(LogLevel.WARN, LogType.MSG_IP_UID_CERT_ERROR, new String[]{
|
||||
PgpKeyHelper.convertKeyIdToHex(cert.getKeyId())
|
||||
});
|
||||
log(LogLevel.WARN, LogType.MSG_IP_UID_CERT_ERROR,
|
||||
PgpKeyHelper.convertKeyIdToHex(cert.getKeyId()));
|
||||
}
|
||||
}
|
||||
|
||||
if (unknownCerts > 0) {
|
||||
log(LogLevel.DEBUG, LogType.MSG_IP_UID_CERTS_UNKNOWN, new String[]{
|
||||
Integer.toString(unknownCerts)
|
||||
});
|
||||
log(LogLevel.DEBUG, LogType.MSG_IP_UID_CERTS_UNKNOWN, unknownCerts);
|
||||
}
|
||||
mIndent -= 1;
|
||||
|
||||
@ -574,8 +569,7 @@ public class ProviderHelper {
|
||||
}
|
||||
|
||||
long masterKeyId = keyRing.getMasterKeyId();
|
||||
log(LogLevel.START, LogType.MSG_IS,
|
||||
new String[]{ PgpKeyHelper.convertKeyIdToHex(masterKeyId) });
|
||||
log(LogLevel.START, LogType.MSG_IS, PgpKeyHelper.convertKeyIdToHex(masterKeyId));
|
||||
mIndent += 1;
|
||||
try {
|
||||
|
||||
@ -625,18 +619,18 @@ public class ProviderHelper {
|
||||
int upd = mContentResolver.update(uri, values, Keys.KEY_ID + " = ?",
|
||||
new String[]{Long.toString(id)});
|
||||
if (upd == 1) {
|
||||
log(LogLevel.DEBUG, LogType.MSG_IS_SUBKEY_OK, new String[]{
|
||||
log(LogLevel.DEBUG, LogType.MSG_IS_SUBKEY_OK,
|
||||
PgpKeyHelper.convertKeyIdToHex(id)
|
||||
});
|
||||
);
|
||||
} else {
|
||||
log(LogLevel.WARN, LogType.MSG_IS_SUBKEY_NONEXISTENT, new String[]{
|
||||
log(LogLevel.WARN, LogType.MSG_IS_SUBKEY_NONEXISTENT,
|
||||
PgpKeyHelper.convertKeyIdToHex(id)
|
||||
});
|
||||
);
|
||||
}
|
||||
} else {
|
||||
log(LogLevel.INFO, LogType.MSG_IS_SUBKEY_STRIPPED, new String[]{
|
||||
log(LogLevel.INFO, LogType.MSG_IS_SUBKEY_STRIPPED,
|
||||
PgpKeyHelper.convertKeyIdToHex(id)
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
mIndent -= 1;
|
||||
@ -654,8 +648,6 @@ public class ProviderHelper {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public SaveKeyringResult savePublicKeyRing(UncachedKeyRing keyRing) {
|
||||
return savePublicKeyRing(keyRing, new NullProgressable());
|
||||
}
|
||||
@ -669,8 +661,7 @@ public class ProviderHelper {
|
||||
|
||||
try {
|
||||
long masterKeyId = publicRing.getMasterKeyId();
|
||||
log(LogLevel.START, LogType.MSG_IP,
|
||||
new String[]{ PgpKeyHelper.convertKeyIdToHex(masterKeyId) });
|
||||
log(LogLevel.START, LogType.MSG_IP, PgpKeyHelper.convertKeyIdToHex(masterKeyId));
|
||||
mIndent += 1;
|
||||
|
||||
// If there is an old keyring, merge it
|
||||
@ -694,7 +685,7 @@ public class ProviderHelper {
|
||||
// Early breakout if nothing changed
|
||||
if (Arrays.hashCode(publicRing.getEncoded())
|
||||
== Arrays.hashCode(oldPublicRing.getEncoded())) {
|
||||
log(LogLevel.OK, LogType.MSG_IP_SUCCESS_IDENTICAL, null);
|
||||
log(LogLevel.OK, LogType.MSG_IP_SUCCESS_IDENTICAL);
|
||||
return new SaveKeyringResult(SaveKeyringResult.RESULT_OK, mLog);
|
||||
}
|
||||
} catch (NotFoundException e) {
|
||||
@ -754,8 +745,7 @@ public class ProviderHelper {
|
||||
|
||||
try {
|
||||
long masterKeyId = secretRing.getMasterKeyId();
|
||||
log(LogLevel.START, LogType.MSG_IS,
|
||||
new String[]{ PgpKeyHelper.convertKeyIdToHex(masterKeyId) });
|
||||
log(LogLevel.START, LogType.MSG_IS, PgpKeyHelper.convertKeyIdToHex(masterKeyId));
|
||||
mIndent += 1;
|
||||
|
||||
// If there is an old secret key, merge it.
|
||||
@ -780,7 +770,7 @@ public class ProviderHelper {
|
||||
if (Arrays.hashCode(secretRing.getEncoded())
|
||||
== Arrays.hashCode(oldSecretRing.getEncoded())) {
|
||||
log(LogLevel.OK, LogType.MSG_IS_SUCCESS_IDENTICAL,
|
||||
new String[]{ PgpKeyHelper.convertKeyIdToHex(masterKeyId) });
|
||||
PgpKeyHelper.convertKeyIdToHex(masterKeyId) );
|
||||
return new SaveKeyringResult(SaveKeyringResult.RESULT_OK, mLog);
|
||||
}
|
||||
} catch (NotFoundException e) {
|
||||
@ -812,7 +802,7 @@ public class ProviderHelper {
|
||||
}
|
||||
|
||||
} catch (NotFoundException e) {
|
||||
log(LogLevel.DEBUG, LogType.MSG_IS_PUBRING_GENERATE, null);
|
||||
log(LogLevel.DEBUG, LogType.MSG_IS_PUBRING_GENERATE);
|
||||
publicRing = secretRing.extractPublicKeyRing();
|
||||
}
|
||||
|
||||
@ -833,7 +823,7 @@ public class ProviderHelper {
|
||||
return new SaveKeyringResult(result, mLog);
|
||||
|
||||
} catch (IOException e) {
|
||||
log(LogLevel.ERROR, LogType.MSG_IS_FAIL_IO_EXC, null);
|
||||
log(LogLevel.ERROR, LogType.MSG_IS_FAIL_IO_EXC);
|
||||
return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog);
|
||||
} finally {
|
||||
mIndent -= 1;
|
||||
@ -841,21 +831,6 @@ public class ProviderHelper {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves (or updates) a pair of public and secret KeyRings in the database
|
||||
*/
|
||||
@Deprecated // scheduled for deletion after merge with new-edit branch
|
||||
public void savePairedKeyRing(UncachedKeyRing pubRing, UncachedKeyRing secRing) throws IOException {
|
||||
long masterKeyId = pubRing.getMasterKeyId();
|
||||
|
||||
// delete secret keyring (so it isn't unnecessarily saved by public-savePublicKeyRing below)
|
||||
mContentResolver.delete(KeyRingData.buildSecretKeyRingUri(Long.toString(masterKeyId)), null, null);
|
||||
|
||||
// save public keyring
|
||||
internalSavePublicKeyRing(pubRing, null, true);
|
||||
internalSaveSecretKeyRing(secRing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build ContentProviderOperation to add PGPPublicKey to database corresponding to a keyRing
|
||||
*/
|
||||
|
@ -59,23 +59,23 @@ public class OperationResultParcel implements Parcelable {
|
||||
public static class LogEntryParcel implements Parcelable {
|
||||
public final LogLevel mLevel;
|
||||
public final LogType mType;
|
||||
public final String[] mParameters;
|
||||
public final Object[] mParameters;
|
||||
public final int mIndent;
|
||||
|
||||
public LogEntryParcel(LogLevel level, LogType type, String[] parameters, int indent) {
|
||||
public LogEntryParcel(LogLevel level, LogType type, int indent, Object... parameters) {
|
||||
mLevel = level;
|
||||
mType = type;
|
||||
mParameters = parameters;
|
||||
mIndent = indent;
|
||||
}
|
||||
public LogEntryParcel(LogLevel level, LogType type, String[] parameters) {
|
||||
this(level, type, parameters, 0);
|
||||
public LogEntryParcel(LogLevel level, LogType type, Object... parameters) {
|
||||
this(level, type, 0, parameters);
|
||||
}
|
||||
|
||||
public LogEntryParcel(Parcel source) {
|
||||
mLevel = LogLevel.values()[source.readInt()];
|
||||
mType = LogType.values()[source.readInt()];
|
||||
mParameters = source.createStringArray();
|
||||
mParameters = (Object[]) source.readSerializable();
|
||||
mIndent = source.readInt();
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public class OperationResultParcel implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(mLevel.ordinal());
|
||||
dest.writeInt(mType.ordinal());
|
||||
dest.writeStringArray(mParameters);
|
||||
dest.writeSerializable(mParameters);
|
||||
dest.writeInt(mIndent);
|
||||
}
|
||||
|
||||
@ -164,8 +164,8 @@ public class OperationResultParcel implements Parcelable {
|
||||
MSG_IP_UID_CERT_BAD (R.string.msg_ip_uid_cert_bad),
|
||||
MSG_IP_UID_CERT_ERROR (R.string.msg_ip_uid_cert_error),
|
||||
MSG_IP_UID_CERT_GOOD (R.string.msg_ip_uid_cert_good),
|
||||
MSG_IP_UID_CERTS_UNKNOWN (R.string.msg_ip_uid_certs_unknown),
|
||||
MSG_IP_UID_CLASSIFYING (R.string.msg_ip_uid_classifying),
|
||||
MSG_IP_UID_CERTS_UNKNOWN (R.plurals.msg_ip_uid_certs_unknown),
|
||||
MSG_IP_UID_CLASSIFYING (R.plurals.msg_ip_uid_classifying),
|
||||
MSG_IP_UID_REORDER(R.string.msg_ip_uid_reorder),
|
||||
MSG_IP_UID_PROCESSING (R.string.msg_ip_uid_processing),
|
||||
MSG_IP_UID_REVOKED (R.string.msg_ip_uid_revoked),
|
||||
@ -209,9 +209,9 @@ public class OperationResultParcel implements Parcelable {
|
||||
MSG_KC_SUB_REVOKE_BAD_ERR (R.string.msg_kc_sub_revoke_bad_err),
|
||||
MSG_KC_SUB_REVOKE_BAD (R.string.msg_kc_sub_revoke_bad),
|
||||
MSG_KC_SUB_REVOKE_DUP (R.string.msg_kc_sub_revoke_dup),
|
||||
MSG_KC_SUCCESS_BAD (R.string.msg_kc_success_bad),
|
||||
MSG_KC_SUCCESS_BAD (R.plurals.msg_kc_success_bad),
|
||||
MSG_KC_SUCCESS_BAD_AND_RED (R.string.msg_kc_success_bad_and_red),
|
||||
MSG_KC_SUCCESS_REDUNDANT (R.string.msg_kc_success_redundant),
|
||||
MSG_KC_SUCCESS_REDUNDANT (R.plurals.msg_kc_success_redundant),
|
||||
MSG_KC_SUCCESS (R.string.msg_kc_success),
|
||||
MSG_KC_UID_BAD_ERR (R.string.msg_kc_uid_bad_err),
|
||||
MSG_KC_UID_BAD_LOCAL (R.string.msg_kc_uid_bad_local),
|
||||
@ -296,13 +296,13 @@ public class OperationResultParcel implements Parcelable {
|
||||
public static class OperationLog extends ArrayList<LogEntryParcel> {
|
||||
|
||||
/// Simple convenience method
|
||||
public void add(LogLevel level, LogType type, String[] parameters, int indent) {
|
||||
public void add(LogLevel level, LogType type, int indent, Object... parameters) {
|
||||
Log.d(Constants.TAG, type.toString());
|
||||
add(new OperationResultParcel.LogEntryParcel(level, type, parameters, indent));
|
||||
add(new OperationResultParcel.LogEntryParcel(level, type, indent, parameters));
|
||||
}
|
||||
|
||||
public void add(LogLevel level, LogType type, int indent) {
|
||||
add(new OperationResultParcel.LogEntryParcel(level, type, null, indent));
|
||||
add(new OperationResultParcel.LogEntryParcel(level, type, indent, (Object[]) null));
|
||||
}
|
||||
|
||||
public boolean containsWarnings() {
|
||||
|
@ -390,9 +390,6 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
|
||||
/**
|
||||
* Scroll ViewPager left and right
|
||||
*
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
@ -432,7 +429,7 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
// get returned data bundle
|
||||
Bundle returnData = message.getData();
|
||||
final ImportResult result =
|
||||
returnData.<ImportResult>getParcelable(KeychainIntentService.RESULT);
|
||||
returnData.getParcelable(KeychainIntentService.RESULT);
|
||||
|
||||
int resultType = result.getResult();
|
||||
|
||||
|
@ -35,6 +35,7 @@ import org.sufficientlysecure.keychain.helper.Preferences;
|
||||
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
|
||||
import org.sufficientlysecure.keychain.keyimport.Keyserver;
|
||||
import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.AsyncTaskResultWrapper;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListKeybaseLoader;
|
||||
@ -79,6 +80,7 @@ public class ImportKeysListFragment extends ListFragment implements
|
||||
public ArrayList<ParcelableKeyRing> getSelectedData() {
|
||||
ArrayList<ParcelableKeyRing> result = new ArrayList<ParcelableKeyRing>();
|
||||
for (ImportKeysListEntry entry : getSelectedEntries()) {
|
||||
Log.d(Constants.TAG, "code" + Integer.toString(entry.hashCode()));
|
||||
result.add(mCachedKeyData.get(entry.hashCode()));
|
||||
}
|
||||
return result;
|
||||
|
@ -173,7 +173,14 @@ public class LogDisplayFragment extends ListFragment implements OnTouchListener
|
||||
ih = (ItemHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
ih.mText.setText(getResources().getString(entry.mType.getMsgId(), (Object[]) entry.mParameters));
|
||||
// special case: first parameter may be a quantity
|
||||
if (entry.mParameters != null && entry.mParameters.length > 0
|
||||
&& entry.mParameters[0] instanceof Integer) {
|
||||
ih.mText.setText(getResources().getQuantityString(entry.mType.getMsgId(),
|
||||
(Integer) entry.mParameters[0], entry.mParameters));
|
||||
} else {
|
||||
ih.mText.setText(getResources().getString(entry.mType.getMsgId(), entry.mParameters));
|
||||
}
|
||||
ih.mText.setTextColor(entry.mLevel == LogLevel.DEBUG ? Color.GRAY : Color.BLACK);
|
||||
convertView.setPadding((entry.mIndent) * dipFactor, 0, 0, 0);
|
||||
switch (entry.mLevel) {
|
||||
|
@ -388,19 +388,19 @@
|
||||
|
||||
<!-- Import result toast -->
|
||||
<plurals name="import_keys_added_and_updated_1">
|
||||
<item quantity="one">Successfully added %1$d key</item>
|
||||
<item quantity="other">Successfully added %1$d keys</item>
|
||||
<item quantity="one">Successfully imported key</item>
|
||||
<item quantity="other">Successfully imported %1$d keys</item>
|
||||
</plurals>
|
||||
<plurals name="import_keys_added_and_updated_2">
|
||||
<item quantity="one"> and updated %1$d key%2$s.</item>
|
||||
<item quantity="one"> and updated key%2$s.</item>
|
||||
<item quantity="other"> and updated %1$d keys%2$s.</item>
|
||||
</plurals>
|
||||
<plurals name="import_keys_added">
|
||||
<item quantity="one">Successfully added %1$d key%2$s.</item>
|
||||
<item quantity="other">Successfully added %1$d keys%2$s.</item>
|
||||
<item quantity="one">Successfully imported key%2$s.</item>
|
||||
<item quantity="other">Successfully imported %1$d keys%2$s.</item>
|
||||
</plurals>
|
||||
<plurals name="import_keys_updated">
|
||||
<item quantity="one">Successfully updated %1$d key%2$s.</item>
|
||||
<item quantity="one">Successfully updated key%2$s.</item>
|
||||
<item quantity="other">Successfully updated %1$d keys%2$s.</item>
|
||||
</plurals>
|
||||
<string name="import_view_log">View Log</string>
|
||||
@ -542,8 +542,15 @@
|
||||
<string name="msg_ip_uid_cert_bad">Encountered bad certificate!</string>
|
||||
<string name="msg_ip_uid_cert_error">Error processing certificate!</string>
|
||||
<string name="msg_ip_uid_cert_good">User id is certified by %1$s (%2$s)</string>
|
||||
<string name="msg_ip_uid_certs_unknown">Ignoring %s certificates from unknown pubkeys</string>
|
||||
<string name="msg_ip_uid_classifying">Classifying user ids, using %s trusted signatures</string>
|
||||
<plurals name="msg_ip_uid_certs_unknown">
|
||||
<item quantity="one">Ignoring one certificate issued by an unknown public key</item>
|
||||
<item quantity="other">Ignoring %s certificates issued by unknown public keys</item>
|
||||
</plurals>
|
||||
<plurals name="msg_ip_uid_classifying">
|
||||
<item quantity="zero">Classifying user ids (no trusted keys available)</item>
|
||||
<item quantity="one">Classifying user ids (using one trusted key)</item>
|
||||
<item quantity="other">Classifying user ids (using %s trusted keys)</item>
|
||||
</plurals>
|
||||
<string name="msg_ip_uid_reorder">Re-ordering user ids</string>
|
||||
<string name="msg_ip_uid_processing">Processing user id %s</string>
|
||||
<string name="msg_ip_uid_revoked">User id is revoked</string>
|
||||
@ -588,9 +595,15 @@
|
||||
<string name="msg_kc_sub_revoke_bad">Removing bad subkey revocation certificate</string>
|
||||
<string name="msg_kc_sub_revoke_dup">Removing redundant subkey revocation certificate</string>
|
||||
<string name="msg_kc_success">Keyring canonicalization successful, no changes</string>
|
||||
<string name="msg_kc_success_bad">Keyring canonicalization successful, removed %s erroneous certificates</string>
|
||||
<plurals name="msg_kc_success_bad">
|
||||
<item quantity="one">Keyring canonicalization successful, removed one erroneous certificate</item>
|
||||
<item quantity="other">Keyring canonicalization successful, removed %d erroneous certificates</item>
|
||||
</plurals>
|
||||
<string name="msg_kc_success_bad_and_red">Keyring canonicalization successful, removed %1$s erroneous and %2$s redundant certificates</string>
|
||||
<string name="msg_kc_success_redundant">Keyring canonicalization successful, removed %s redundant certificates</string>
|
||||
<plurals name="msg_kc_success_redundant">
|
||||
<item quantity="one">Keyring canonicalization successful, removed one redundant certificate</item>
|
||||
<item quantity="other">Keyring canonicalization successful, removed %d redundant certificates</item>
|
||||
</plurals>
|
||||
<string name="msg_kc_uid_bad_err">Removing bad self certificate for user id %s</string>
|
||||
<string name="msg_kc_uid_bad_local">Removing user id certificate with "local" flag</string>
|
||||
<string name="msg_kc_uid_bad_time">Removing user id with future timestamp</string>
|
||||
|
Loading…
Reference in New Issue
Block a user