Fix cleartext verify
This commit is contained in:
@@ -607,7 +607,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.ConsolidateDialogActivity"
|
android:name=".ui.ConsolidateDialogActivity"
|
||||||
android:theme="@android:style/Theme.NoDisplay" />
|
android:theme="@android:style/Theme.NoDisplay" />
|
||||||
<!-- stateHidden -->
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.PassphraseDialogActivity"
|
android:name=".ui.PassphraseDialogActivity"
|
||||||
android:theme="@android:style/Theme.NoDisplay" />
|
android:theme="@android:style/Theme.NoDisplay" />
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ public class PgpDecryptVerify {
|
|||||||
|
|
||||||
if (aIn.isClearText()) {
|
if (aIn.isClearText()) {
|
||||||
// a cleartext signature, verify it with the other method
|
// a cleartext signature, verify it with the other method
|
||||||
return verifyCleartextSignature(aIn);
|
return verifyCleartextSignature(aIn, 0);
|
||||||
}
|
}
|
||||||
// else: ascii armored encryption! go on...
|
// else: ascii armored encryption! go on...
|
||||||
}
|
}
|
||||||
@@ -672,7 +672,7 @@ public class PgpDecryptVerify {
|
|||||||
* The method is heavily based on
|
* The method is heavily based on
|
||||||
* pg/src/main/java/org/spongycastle/openpgp/examples/ClearSignedFileProcessor.java
|
* 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 {
|
throws IOException, PGPException {
|
||||||
|
|
||||||
OperationLog log = new OperationLog();
|
OperationLog log = new OperationLog();
|
||||||
@@ -756,6 +756,7 @@ public class PgpDecryptVerify {
|
|||||||
|
|
||||||
if (signature != null) try {
|
if (signature != null) try {
|
||||||
updateProgress(R.string.progress_verifying_signature, 90, 100);
|
updateProgress(R.string.progress_verifying_signature, 90, 100);
|
||||||
|
log.add(LogType.MSG_DC_CLEAR_SIGNATURE_CHECK, indent);
|
||||||
|
|
||||||
InputStream sigIn = new BufferedInputStream(new ByteArrayInputStream(clearText));
|
InputStream sigIn = new BufferedInputStream(new ByteArrayInputStream(clearText));
|
||||||
|
|
||||||
@@ -776,6 +777,11 @@ public class PgpDecryptVerify {
|
|||||||
|
|
||||||
// Verify signature and check binding signatures
|
// Verify signature and check binding signatures
|
||||||
boolean validSignature = signature.verify();
|
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);
|
signatureResultBuilder.setValidSignature(validSignature);
|
||||||
|
|
||||||
} catch (SignatureException e) {
|
} catch (SignatureException e) {
|
||||||
@@ -784,6 +790,8 @@ public class PgpDecryptVerify {
|
|||||||
|
|
||||||
updateProgress(R.string.progress_done, 100, 100);
|
updateProgress(R.string.progress_done, 100, 100);
|
||||||
|
|
||||||
|
log.add(LogType.MSG_DC_OK, indent);
|
||||||
|
|
||||||
DecryptVerifyResult result = new DecryptVerifyResult(DecryptVerifyResult.RESULT_OK, log);
|
DecryptVerifyResult result = new DecryptVerifyResult(DecryptVerifyResult.RESULT_OK, log);
|
||||||
result.setSignatureResult(signatureResultBuilder.build());
|
result.setSignatureResult(signatureResultBuilder.build());
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -152,6 +152,10 @@ public abstract class OperationResult implements Parcelable {
|
|||||||
|
|
||||||
int color;
|
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
|
// Take the last message as string
|
||||||
String str = activity.getString(mLog.getLast().mType.getMsgId());
|
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";
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -78,6 +83,8 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
|
|
||||||
long keyId = getIntent().getLongExtra(EXTRA_SUBKEY_ID, 0);
|
long keyId = getIntent().getLongExtra(EXTRA_SUBKEY_ID, 0);
|
||||||
|
|
||||||
|
mServiceIntent = getIntent().getParcelableExtra(EXTRA_DATA);
|
||||||
|
|
||||||
show(this, keyId);
|
show(this, keyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user