diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-03-22 14:16:49 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-03-22 14:16:49 +0100 |
commit | 30fa184e7e6a3bbd1a26c39ef5c3037dcbe3ea32 (patch) | |
tree | c9d47233a0486e3e05e882e05d60202f5565b135 /OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java | |
parent | bee5075f56173b7bd05b210c778c846d154b2ee9 (diff) | |
parent | 0075c522a6773c14e34875cc7118055cde2e13be (diff) | |
download | open-keychain-30fa184e7e6a3bbd1a26c39ef5c3037dcbe3ea32.tar.gz open-keychain-30fa184e7e6a3bbd1a26c39ef5c3037dcbe3ea32.tar.bz2 open-keychain-30fa184e7e6a3bbd1a26c39ef5c3037dcbe3ea32.zip |
Merge with ashh87s pull request
Diffstat (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java')
-rw-r--r-- | OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java index 87b1204a4..ed81c2aa8 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -62,6 +62,7 @@ import android.widget.ViewFlipper; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; +import java.io.BufferedInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.regex.Matcher; @@ -642,7 +643,7 @@ public class DecryptActivity extends SherlockFragmentActivity { } try { - inStream = new FileInputStream(mInputFilename); + inStream = new BufferedInputStream(new FileInputStream(mInputFilename)); } catch (FileNotFoundException e) { Log.e(Constants.TAG, "File not found!", e); Toast.makeText(this, getString(R.string.error_fileNotFound, e.getMessage()), @@ -659,6 +660,9 @@ public class DecryptActivity extends SherlockFragmentActivity { // get decryption key for this inStream try { try { + if (inStream.markSupported()) { + inStream.mark(200); //should probably set this to the max size of two pgpF objects, if it even needs to be anything other than 0. + } mSecretKeyId = PgpMain.getDecryptionKeyId(this, inStream); if (mSecretKeyId == Id.key.none) { throw new PgpMain.PgpGeneralException( @@ -666,6 +670,9 @@ public class DecryptActivity extends SherlockFragmentActivity { } mAssumeSymmetricEncryption = false; } catch (PgpMain.NoAsymmetricEncryptionException e) { + if (inStream.markSupported()) { + inStream.reset(); + } mSecretKeyId = Id.key.symmetric; if (!PgpMain.hasSymmetricEncryption(this, inStream)) { throw new PgpMain.PgpGeneralException( @@ -914,7 +921,7 @@ public class DecryptActivity extends SherlockFragmentActivity { case Id.request.output_filename: { if (resultCode == RESULT_OK && data != null) { try { - String path = data.getData().getPath(); + String path = FileHelper.getPath(this, data.getData()); Log.d(Constants.TAG, "path=" + path); mFileDialog.setFilename(path); @@ -944,3 +951,4 @@ public class DecryptActivity extends SherlockFragmentActivity { } } + |