diff options
author | Ash Hughes <ashes-iontach@hotmail.com> | 2013-03-15 23:24:06 +0000 |
---|---|---|
committer | Ash Hughes <ashes-iontach@hotmail.com> | 2013-03-15 23:24:06 +0000 |
commit | 4fc4f09e84718efdfda41cbd7d8822a393e65a60 (patch) | |
tree | f89cb655850986815b30ef9883fe1da97455a059 /OpenPGP-Keychain/src | |
parent | 9985722c6e04cbff027caa84fa01e05624e298a3 (diff) | |
download | open-keychain-4fc4f09e84718efdfda41cbd7d8822a393e65a60.tar.gz open-keychain-4fc4f09e84718efdfda41cbd7d8822a393e65a60.tar.bz2 open-keychain-4fc4f09e84718efdfda41cbd7d8822a393e65a60.zip |
Fix decrypt file selection and symmetric decryption failure
Diffstat (limited to 'OpenPGP-Keychain/src')
-rw-r--r-- | OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/DecryptActivity.java | 12 | ||||
-rw-r--r-- | OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/FileDialogFragment.java | 3 |
2 files changed, 12 insertions, 3 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 { } } + diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/FileDialogFragment.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/FileDialogFragment.java index 2f9cdb3b1..7c4d9cea3 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/FileDialogFragment.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/dialog/FileDialogFragment.java @@ -191,4 +191,5 @@ public class FileDialogFragment extends DialogFragment { Log.w(Constants.TAG, "Messenger is null!", e); } } -}
\ No newline at end of file +} + |