aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-09-10 01:04:13 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-09-10 01:04:13 +0200
commitd61d846b7277a89eb1b7c625ddf5e002f55b79ba (patch)
treed0b620e0128b0e5bb3b46b0b8cb9bf199e4e49bf
parent7dbb7cf1e1fd4de1098d4a2207a90ddc680598ed (diff)
downloadopen-keychain-d61d846b7277a89eb1b7c625ddf5e002f55b79ba.tar.gz
open-keychain-d61d846b7277a89eb1b7c625ddf5e002f55b79ba.tar.bz2
open-keychain-d61d846b7277a89eb1b7c625ddf5e002f55b79ba.zip
add some comments to previous commit
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java1
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java4
3 files changed, 12 insertions, 1 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java
index 4874b6eaa..d82c68316 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java
@@ -335,6 +335,7 @@ public class PgpSignEncrypt {
throw new NoSigningKeyException();
}
+ // Make sure we are allowed to sign here!
if ( ! signingKey.canSign()) {
throw new NoSigningKeyException();
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
index f085c8582..e664570ac 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
@@ -281,11 +281,17 @@ public class KeychainIntentService extends IntentService implements Progressable
.setOriginalFilename(originalFilename);
try {
+
+ // Find the appropriate subkey to sign with
CachedPublicKeyRing signingRing =
new ProviderHelper(this).getCachedPublicKeyRing(sigMasterKeyId);
long sigSubKeyId = signingRing.getSignId();
- // It is assumed that the passphrase was cached prior to the service call.
+
+ // Get its passphrase from cache. It is assumed that this passphrase was
+ // cached prior to the service call.
String passphrase = PassphraseCacheService.getCachedPassphrase(this, sigSubKeyId);
+
+ // Set signature settings
builder.setSignatureMasterKeyId(sigMasterKeyId)
.setSignatureSubKeyId(sigSubKeyId)
.setSignaturePassphrase(passphrase)
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java
index 290dc1ce6..bc0d3d387 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java
@@ -72,6 +72,7 @@ public class EncryptTextActivity extends DrawerActivity implements EncryptActivi
// model used by fragments
private long mEncryptionKeyIds[] = null;
private String mEncryptionUserIds[] = null;
+ // TODO Constants.key.none? What's wrong with a null value?
private long mSigningKeyId = Constants.key.none;
private String mPassphrase = "";
private boolean mShareAfterEncrypt = false;
@@ -313,10 +314,13 @@ public class EncryptTextActivity extends DrawerActivity implements EncryptActivi
}
try {
+ // TODO This should really not be decided here. We do need the info for the passphrase
+ // TODO dialog fragment though, so that's just the way it is for now.
if (mSigningKeyId != 0) {
CachedPublicKeyRing signingRing =
new ProviderHelper(this).getCachedPublicKeyRing(mSigningKeyId);
long sigSubKeyId = signingRing.getSignId();
+ // Make sure the passphrase is cached, then start over.
if (PassphraseCacheService.getCachedPassphrase(this, sigSubKeyId) == null) {
PassphraseDialogFragment.show(this, sigSubKeyId,
new Handler() {