aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-09-11 22:45:35 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-09-11 22:45:35 +0200
commit2a6774b2218ab32883f77888a8782fc288ca2f5a (patch)
treed5338725405a5c168648ead32d831281f0a20c20 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java
parent51d6ad43947f7cd3a803abfb0d3147ba2f06ce4f (diff)
downloadopen-keychain-2a6774b2218ab32883f77888a8782fc288ca2f5a.tar.gz
open-keychain-2a6774b2218ab32883f77888a8782fc288ca2f5a.tar.bz2
open-keychain-2a6774b2218ab32883f77888a8782fc288ca2f5a.zip
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.
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java26
1 files changed, 3 insertions, 23 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java
index f3d098850..e26fa4446 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java
@@ -517,10 +517,6 @@ public class UncachedKeyRing {
// Replace modified key in the keyring
ring = replacePublicKey(ring, modified);
- if (ring == null) {
- log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
- return null;
- }
indent -= 1;
}
@@ -698,10 +694,6 @@ public class UncachedKeyRing {
}
// replace pubkey in keyring
ring = replacePublicKey(ring, modified);
- if (ring == null) {
- log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
- return null;
- }
indent -= 1;
}
@@ -791,10 +783,6 @@ public class UncachedKeyRing {
} else {
// otherwise, just insert the public key
result = replacePublicKey(result, key);
- if (result == null) {
- log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
- return null;
- }
}
continue;
}
@@ -823,10 +811,6 @@ public class UncachedKeyRing {
if (!key.isMasterKey()) {
if (modified != resultKey) {
result = replacePublicKey(result, modified);
- if (result == null) {
- log.add(LogLevel.ERROR, LogType.MSG_MG_ERROR_SECRET_DUMMY, indent);
- return null;
- }
}
continue;
}
@@ -851,10 +835,6 @@ public class UncachedKeyRing {
// If anything changed, save the updated (sub)key
if (modified != resultKey) {
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 {
PGPSecretKeyRing secRing = (PGPSecretKeyRing) ring;
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) {
- Log.e(Constants.TAG, "dummy secret key generation not yet implemented");
- return null;
+ // generate a stripped secret (sub)key
+ sKey = PGPSecretKey.constructGnuDummyKey(key);
}
sKey = PGPSecretKey.replacePublicKey(sKey, key);
return PGPSecretKeyRing.insertSecretKey(secRing, sKey);