mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -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,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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user