Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passphrases are not retrieved from cache when signing #1222

Closed
dschuermann opened this issue Apr 25, 2015 · 2 comments
Closed

passphrases are not retrieved from cache when signing #1222

dschuermann opened this issue Apr 25, 2015 · 2 comments

Comments

@dschuermann
Copy link
Member

passphrases are not retrieved from cache when signing

@dschuermann dschuermann added this to the OpenKeychain 3.2 milestone Apr 25, 2015
@mgeier63
Copy link
Contributor

mgeier63 commented May 4, 2015

sorry to not be able to provide you with a PR,
but here's how i fixed this on my local copy.

Index: OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java (revision 1923942fc97534eb86177053a29868df5223cb16)
+++ OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java (revision )
@@ -178,13 +178,21 @@
                     case PIN:
                     case PATTERN:
                     case PASSPHRASE: {
-                        if (cryptoInput.getPassphrase() == null) {
+                        Passphrase localPassphrase = cryptoInput.getPassphrase();
+                        if (localPassphrase==null) {
+                            try {
+                                localPassphrase = getCachedPassphrase(signingKeyRing.getMasterKeyId(), signingKey.getKeyId());
+                            } catch (PassphraseCacheInterface.NoSecretKeyException e) {
+                                //
+                            }
+                        }
+                        if (localPassphrase == null) {
                             log.add(LogType.MSG_PSE_PENDING_PASSPHRASE, indent + 1);
                             return new PgpSignEncryptResult(log, RequiredInputParcel.createRequiredSignPassphrase(
                                     signingKeyRing.getMasterKeyId(), signingKey.getKeyId(),
                                     cryptoInput.getSignatureTime()));
                         }
-                        if (!signingKey.unlock(cryptoInput.getPassphrase())) {
+                        if (!signingKey.unlock(localPassphrase)) {
                             log.add(LogType.MSG_PSE_ERROR_BAD_PASSPHRASE, indent);
                             return new PgpSignEncryptResult(PgpSignEncryptResult.RESULT_ERROR, log);
                         }

dschuermann pushed a commit that referenced this issue May 4, 2015
@dschuermann
Copy link
Member Author

done in 51bb967

Hiperzone pushed a commit to Hiperzone/open-keychain that referenced this issue May 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants