merge: add support for s2k dummy generation
if a public key gets merged into a secret one, and there are new subkeys, the merge() routine now adds a newly generated, stripped secret subkey instead.
This commit is contained in:
@@ -517,10 +517,6 @@ public class UncachedKeyRing {
|
|||||||
|
|
||||||
// Replace modified key in the keyring
|
// Replace modified key in the keyring
|
||||||
ring = replacePublicKey(ring, modified);
|
ring = replacePublicKey(ring, modified);
|
||||||
if (ring == null) {
|
|
||||||
log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
indent -= 1;
|
indent -= 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -698,10 +694,6 @@ public class UncachedKeyRing {
|
|||||||
}
|
}
|
||||||
// replace pubkey in keyring
|
// replace pubkey in keyring
|
||||||
ring = replacePublicKey(ring, modified);
|
ring = replacePublicKey(ring, modified);
|
||||||
if (ring == null) {
|
|
||||||
log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
indent -= 1;
|
indent -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,10 +783,6 @@ public class UncachedKeyRing {
|
|||||||
} else {
|
} else {
|
||||||
// otherwise, just insert the public key
|
// otherwise, just insert the public key
|
||||||
result = replacePublicKey(result, key);
|
result = replacePublicKey(result, key);
|
||||||
if (result == null) {
|
|
||||||
log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -823,10 +811,6 @@ public class UncachedKeyRing {
|
|||||||
if (!key.isMasterKey()) {
|
if (!key.isMasterKey()) {
|
||||||
if (modified != resultKey) {
|
if (modified != resultKey) {
|
||||||
result = replacePublicKey(result, modified);
|
result = replacePublicKey(result, modified);
|
||||||
if (result == null) {
|
|
||||||
log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -851,10 +835,6 @@ public class UncachedKeyRing {
|
|||||||
// If anything changed, save the updated (sub)key
|
// If anything changed, save the updated (sub)key
|
||||||
if (modified != resultKey) {
|
if (modified != resultKey) {
|
||||||
result = replacePublicKey(result, modified);
|
result = replacePublicKey(result, modified);
|
||||||
if (result == null) {
|
|
||||||
log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -905,10 +885,10 @@ public class UncachedKeyRing {
|
|||||||
} else {
|
} else {
|
||||||
PGPSecretKeyRing secRing = (PGPSecretKeyRing) ring;
|
PGPSecretKeyRing secRing = (PGPSecretKeyRing) ring;
|
||||||
PGPSecretKey sKey = secRing.getSecretKey(key.getKeyID());
|
PGPSecretKey sKey = secRing.getSecretKey(key.getKeyID());
|
||||||
// TODO generate secret key with S2K dummy, if none exists!
|
// if this is a secret key which does not yet occur in the secret ring
|
||||||
if (sKey == null) {
|
if (sKey == null) {
|
||||||
Log.e(Constants.TAG, "dummy secret key generation not yet implemented");
|
// generate a stripped secret (sub)key
|
||||||
return null;
|
sKey = PGPSecretKey.constructGnuDummyKey(key);
|
||||||
}
|
}
|
||||||
sKey = PGPSecretKey.replacePublicKey(sKey, key);
|
sKey = PGPSecretKey.replacePublicKey(sKey, key);
|
||||||
return PGPSecretKeyRing.insertSecretKey(secRing, sKey);
|
return PGPSecretKeyRing.insertSecretKey(secRing, sKey);
|
||||||
|
|||||||
2
extern/spongycastle
vendored
2
extern/spongycastle
vendored
Submodule extern/spongycastle updated: 526d23382e...375084d553
Reference in New Issue
Block a user