mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-11 13:38:06 -05:00
Fix cleartext verify
This commit is contained in:
parent
1abf167f80
commit
7d917fa39c
@ -607,7 +607,6 @@
|
||||
<activity
|
||||
android:name=".ui.ConsolidateDialogActivity"
|
||||
android:theme="@android:style/Theme.NoDisplay" />
|
||||
<!-- stateHidden -->
|
||||
<activity
|
||||
android:name=".ui.PassphraseDialogActivity"
|
||||
android:theme="@android:style/Theme.NoDisplay" />
|
||||
|
@ -191,7 +191,7 @@ public class PgpDecryptVerify {
|
||||
|
||||
if (aIn.isClearText()) {
|
||||
// a cleartext signature, verify it with the other method
|
||||
return verifyCleartextSignature(aIn);
|
||||
return verifyCleartextSignature(aIn, 0);
|
||||
}
|
||||
// else: ascii armored encryption! go on...
|
||||
}
|
||||
@ -672,7 +672,7 @@ public class PgpDecryptVerify {
|
||||
* The method is heavily based on
|
||||
* pg/src/main/java/org/spongycastle/openpgp/examples/ClearSignedFileProcessor.java
|
||||
*/
|
||||
private DecryptVerifyResult verifyCleartextSignature(ArmoredInputStream aIn)
|
||||
private DecryptVerifyResult verifyCleartextSignature(ArmoredInputStream aIn, int indent)
|
||||
throws IOException, PGPException {
|
||||
|
||||
OperationLog log = new OperationLog();
|
||||
@ -756,6 +756,7 @@ public class PgpDecryptVerify {
|
||||
|
||||
if (signature != null) try {
|
||||
updateProgress(R.string.progress_verifying_signature, 90, 100);
|
||||
log.add(LogType.MSG_DC_CLEAR_SIGNATURE_CHECK, indent);
|
||||
|
||||
InputStream sigIn = new BufferedInputStream(new ByteArrayInputStream(clearText));
|
||||
|
||||
@ -776,6 +777,11 @@ public class PgpDecryptVerify {
|
||||
|
||||
// Verify signature and check binding signatures
|
||||
boolean validSignature = signature.verify();
|
||||
if (validSignature) {
|
||||
log.add(LogType.MSG_DC_CLEAR_SIGNATURE_OK, indent +1);
|
||||
} else {
|
||||
log.add(LogType.MSG_DC_CLEAR_SIGNATURE_BAD, indent +1);
|
||||
}
|
||||
signatureResultBuilder.setValidSignature(validSignature);
|
||||
|
||||
} catch (SignatureException e) {
|
||||
@ -784,6 +790,8 @@ public class PgpDecryptVerify {
|
||||
|
||||
updateProgress(R.string.progress_done, 100, 100);
|
||||
|
||||
log.add(LogType.MSG_DC_OK, indent);
|
||||
|
||||
DecryptVerifyResult result = new DecryptVerifyResult(DecryptVerifyResult.RESULT_OK, log);
|
||||
result.setSignatureResult(signatureResultBuilder.build());
|
||||
return result;
|
||||
|
@ -152,6 +152,10 @@ public abstract class OperationResult implements Parcelable {
|
||||
|
||||
int color;
|
||||
|
||||
Log.d(Constants.TAG, "mLog.getLast()"+mLog.getLast());
|
||||
Log.d(Constants.TAG, "mLog.getLast().mType"+mLog.getLast().mType);
|
||||
Log.d(Constants.TAG, "mLog.getLast().mType.getMsgId()"+mLog.getLast().mType.getMsgId());
|
||||
|
||||
// Take the last message as string
|
||||
String str = activity.getString(mLog.getLast().mType.getMsgId());
|
||||
|
||||
|
@ -61,6 +61,11 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
|
||||
public static final String EXTRA_SUBKEY_ID = "secret_key_id";
|
||||
|
||||
// special extra for OpenPgpService
|
||||
public static final String EXTRA_DATA = "data";
|
||||
|
||||
private Intent mServiceIntent;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -78,6 +83,8 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
|
||||
long keyId = getIntent().getLongExtra(EXTRA_SUBKEY_ID, 0);
|
||||
|
||||
mServiceIntent = getIntent().getParcelableExtra(EXTRA_DATA);
|
||||
|
||||
show(this, keyId);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user