diff options
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 { } } + |