aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThialfihar <thialfihar@gmail.com>2010-05-11 15:11:24 +0000
committerThialfihar <thialfihar@gmail.com>2010-05-11 15:11:24 +0000
commit29ea6f2f6f4b8fe39c95498a39a13e6bf186d39c (patch)
treee9f11053030b46574649c5f8c6f26b352e9421f0 /src
parente36e8f1deaccd35e48bbb4080c744695e915dc4c (diff)
downloadopen-keychain-29ea6f2f6f4b8fe39c95498a39a13e6bf186d39c.tar.gz
open-keychain-29ea6f2f6f4b8fe39c95498a39a13e6bf186d39c.tar.bz2
open-keychain-29ea6f2f6f4b8fe39c95498a39a13e6bf186d39c.zip
fix a signature bug, which resulted in wrongly read signatures if there was only one line
Diffstat (limited to 'src')
-rw-r--r--src/org/thialfihar/android/apg/Apg.java21
-rw-r--r--src/org/thialfihar/android/apg/DecryptActivity.java24
2 files changed, 30 insertions, 15 deletions
diff --git a/src/org/thialfihar/android/apg/Apg.java b/src/org/thialfihar/android/apg/Apg.java
index 1220cdd19..fec568e6b 100644
--- a/src/org/thialfihar/android/apg/Apg.java
+++ b/src/org/thialfihar/android/apg/Apg.java
@@ -1684,25 +1684,20 @@ public class Apg {
progress.setProgress("reading data...", 0, 100);
- // mostly taken from CLearSignedFileProcessor
+ // mostly taken from ClearSignedFileProcessor
ByteArrayOutputStream lineOut = new ByteArrayOutputStream();
int lookAhead = readInputLine(lineOut, aIn);
byte[] lineSep = getLineSeparator();
- if (lookAhead != -1 && aIn.isClearText())
- {
- byte[] line = lineOut.toByteArray();
+ byte[] line = lineOut.toByteArray();
+ out.write(line, 0, getLengthWithoutSeparator(line));
+ out.write(lineSep);
+
+ while (lookAhead != -1 && aIn.isClearText()) {
+ lookAhead = readInputLine(lineOut, lookAhead, aIn);
+ line = lineOut.toByteArray();
out.write(line, 0, getLengthWithoutSeparator(line));
out.write(lineSep);
-
- while (lookAhead != -1 && aIn.isClearText())
- {
- lookAhead = readInputLine(lineOut, lookAhead, aIn);
-
- line = lineOut.toByteArray();
- out.write(line, 0, getLengthWithoutSeparator(line));
- out.write(lineSep);
- }
}
out.close();
diff --git a/src/org/thialfihar/android/apg/DecryptActivity.java b/src/org/thialfihar/android/apg/DecryptActivity.java
index 1d3510c5a..58db77c83 100644
--- a/src/org/thialfihar/android/apg/DecryptActivity.java
+++ b/src/org/thialfihar/android/apg/DecryptActivity.java
@@ -41,6 +41,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.text.ClipboardManager;
+import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AnimationUtils;
@@ -151,6 +152,13 @@ public class DecryptActivity extends BaseActivity {
mDeleteAfter = (CheckBox) findViewById(R.id.delete_after_decryption);
+ // default: message source
+ mSource.setInAnimation(null);
+ mSource.setOutAnimation(null);
+ while (mSource.getCurrentView().getId() != R.id.source_message) {
+ mSource.showNext();
+ }
+
Intent intent = getIntent();
if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_VIEW)) {
Uri uri = intent.getData();
@@ -196,12 +204,23 @@ public class DecryptActivity extends BaseActivity {
}
mReplyTo = extras.getString("replyTo");
mSubject = extras.getString("subject");
+ } else if (intent.getAction() != null && intent.getAction().equals(Apg.Intent.DECRYPT_FILE)) {
+ mSource.setInAnimation(null);
+ mSource.setOutAnimation(null);
+ while (mSource.getCurrentView().getId() != R.id.source_file) {
+ mSource.showNext();
+ }
}
- if (mMessage.getText().length() == 0) {
+ Log.e("err?", "" + mSource.getCurrentView().getId() + " " + R.id.source_message + " " + mMessage.getText().length());
+ if (mSource.getCurrentView().getId() == R.id.source_message &&
+ mMessage.getText().length() == 0) {
ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
String data = "";
Matcher matcher = Apg.PGP_MESSAGE.matcher(clip.getText());
+ if (!matcher.matches()) {
+ matcher = Apg.PGP_SIGNED_MESSAGE.matcher(clip.getText());
+ }
if (matcher.matches()) {
data = matcher.group(1);
mMessage.setText(data);
@@ -226,7 +245,8 @@ public class DecryptActivity extends BaseActivity {
});
mReplyButton.setVisibility(View.INVISIBLE);
- if (mMessage.getText().length() > 0) {
+ if (mSource.getCurrentView().getId() == R.id.source_message &&
+ mMessage.getText().length() > 0) {
mDecryptButton.performClick();
}