diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-01-26 17:33:40 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-01-26 17:33:40 +0100 |
commit | fc786280fdd7187f1828a4c7fa4d719de902a374 (patch) | |
tree | 5a5a136af8426ae279fccc81f237374aad5c0936 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote | |
parent | 34a7728cec5c17ef25f3d5cd56421e4f5258862d (diff) | |
download | open-keychain-fc786280fdd7187f1828a4c7fa4d719de902a374.tar.gz open-keychain-fc786280fdd7187f1828a4c7fa4d719de902a374.tar.bz2 open-keychain-fc786280fdd7187f1828a4c7fa4d719de902a374.zip |
Fixes for detached signatures
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java index f2af43b6f..6c36e1ab8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -244,7 +244,12 @@ public class OpenPgpService extends RemoteService { // Get Input- and OutputStream from ParcelFileDescriptor InputStream is = new ParcelFileDescriptor.AutoCloseInputStream(input); - OutputStream os = new ParcelFileDescriptor.AutoCloseOutputStream(output); + OutputStream os = null; + if (cleartextSign) { + // output stream only needed for cleartext signatures, + // detached signatures are returned as extra + os = new ParcelFileDescriptor.AutoCloseOutputStream(output); + } try { long inputLength = is.available(); InputData inputData = new InputData(is, inputLength); @@ -325,7 +330,9 @@ public class OpenPgpService extends RemoteService { } } finally { is.close(); - os.close(); + if (os != null) { + os.close(); + } } } catch (Exception e) { Log.d(Constants.TAG, "signImpl", e); @@ -720,6 +727,7 @@ public class OpenPgpService extends RemoteService { return signImpl(data, input, output, accSettings, true); } else if (OpenPgpApi.ACTION_SIGN.equals(action)) { // DEPRECATED: same as ACTION_CLEARTEXT_SIGN + Log.w(Constants.TAG, "You are using a deprecated API call, please use ACTION_CLEARTEXT_SIGN instead of ACTION_SIGN!"); return signImpl(data, input, output, accSettings, true); } else if (OpenPgpApi.ACTION_DETACHED_SIGN.equals(action)) { return signImpl(data, input, output, accSettings, false); |