mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-20 04:41:52 -05:00
fix a signature bug, which resulted in wrongly read signatures if there was only one line
This commit is contained in:
parent
e36e8f1dea
commit
29ea6f2f6f
@ -1684,26 +1684,21 @@ public class Apg {
|
|||||||
|
|
||||||
progress.setProgress("reading data...", 0, 100);
|
progress.setProgress("reading data...", 0, 100);
|
||||||
|
|
||||||
// mostly taken from CLearSignedFileProcessor
|
// mostly taken from ClearSignedFileProcessor
|
||||||
ByteArrayOutputStream lineOut = new ByteArrayOutputStream();
|
ByteArrayOutputStream lineOut = new ByteArrayOutputStream();
|
||||||
int lookAhead = readInputLine(lineOut, aIn);
|
int lookAhead = readInputLine(lineOut, aIn);
|
||||||
byte[] lineSep = getLineSeparator();
|
byte[] lineSep = getLineSeparator();
|
||||||
|
|
||||||
if (lookAhead != -1 && aIn.isClearText())
|
|
||||||
{
|
|
||||||
byte[] line = lineOut.toByteArray();
|
byte[] line = lineOut.toByteArray();
|
||||||
out.write(line, 0, getLengthWithoutSeparator(line));
|
out.write(line, 0, getLengthWithoutSeparator(line));
|
||||||
out.write(lineSep);
|
out.write(lineSep);
|
||||||
|
|
||||||
while (lookAhead != -1 && aIn.isClearText())
|
while (lookAhead != -1 && aIn.isClearText()) {
|
||||||
{
|
|
||||||
lookAhead = readInputLine(lineOut, lookAhead, aIn);
|
lookAhead = readInputLine(lineOut, lookAhead, aIn);
|
||||||
|
|
||||||
line = lineOut.toByteArray();
|
line = lineOut.toByteArray();
|
||||||
out.write(line, 0, getLengthWithoutSeparator(line));
|
out.write(line, 0, getLengthWithoutSeparator(line));
|
||||||
out.write(lineSep);
|
out.write(lineSep);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.text.ClipboardManager;
|
import android.text.ClipboardManager;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
@ -151,6 +152,13 @@ public class DecryptActivity extends BaseActivity {
|
|||||||
|
|
||||||
mDeleteAfter = (CheckBox) findViewById(R.id.delete_after_decryption);
|
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();
|
Intent intent = getIntent();
|
||||||
if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_VIEW)) {
|
if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_VIEW)) {
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
@ -196,12 +204,23 @@ public class DecryptActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
mReplyTo = extras.getString("replyTo");
|
mReplyTo = extras.getString("replyTo");
|
||||||
mSubject = extras.getString("subject");
|
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);
|
ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||||
String data = "";
|
String data = "";
|
||||||
Matcher matcher = Apg.PGP_MESSAGE.matcher(clip.getText());
|
Matcher matcher = Apg.PGP_MESSAGE.matcher(clip.getText());
|
||||||
|
if (!matcher.matches()) {
|
||||||
|
matcher = Apg.PGP_SIGNED_MESSAGE.matcher(clip.getText());
|
||||||
|
}
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
data = matcher.group(1);
|
data = matcher.group(1);
|
||||||
mMessage.setText(data);
|
mMessage.setText(data);
|
||||||
@ -226,7 +245,8 @@ public class DecryptActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
mReplyButton.setVisibility(View.INVISIBLE);
|
mReplyButton.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
if (mMessage.getText().length() > 0) {
|
if (mSource.getCurrentView().getId() == R.id.source_message &&
|
||||||
|
mMessage.getText().length() > 0) {
|
||||||
mDecryptButton.performClick();
|
mDecryptButton.performClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user