mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 14:11:00 +00:00
Fixed OpenKeychain loop with hardware key
Closes open-keychain/open-keychain#2507
This commit is contained in:
parent
f66af79bda
commit
8ec3e01a5e
2 changed files with 21 additions and 20 deletions
2
FAQ.md
2
FAQ.md
|
@ -51,7 +51,7 @@ Related questions:
|
||||||
* A bug in Nova Launcher on Android 5.x lets FairEmail crash with a *java.lang.StackOverflowError* when Nova Launcher has access to the accessibility service.
|
* A bug in Nova Launcher on Android 5.x lets FairEmail crash with a *java.lang.StackOverflowError* when Nova Launcher has access to the accessibility service.
|
||||||
* The folder selector sometimes shows no folders for yet unknown reasons.
|
* The folder selector sometimes shows no folders for yet unknown reasons.
|
||||||
* A [bug in AndroidX](https://issuetracker.google.com/issues/64729576) makes it hard to grap the fast scroller.
|
* A [bug in AndroidX](https://issuetracker.google.com/issues/64729576) makes it hard to grap the fast scroller.
|
||||||
* Encryption with YubiKey results into an infinite loop. This seems to be caused by a [bug in OpenKeychain](https://github.com/open-keychain/open-keychain/issues/2507).
|
* ~~Encryption with YubiKey results into an infinite loop. This seems to be caused by a [bug in OpenKeychain](https://github.com/open-keychain/open-keychain/issues/2507).~~
|
||||||
* Scrolling to an internal linked location in original messages does not work. This can't be fixed because the original message view is contained in a scrolling view.
|
* Scrolling to an internal linked location in original messages does not work. This can't be fixed because the original message view is contained in a scrolling view.
|
||||||
* A preview of the message text doesn't (always) appear on a Samsung watch because [setLocalOnly](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder.html#setLocalOnly(boolean)) seem to be ignored. However, message preview texts are known to appear correctly on a Pebble 2, a Fitbit Charge 3 and a Mi band 3. See also [this FAQ](#user-content-faq126).
|
* A preview of the message text doesn't (always) appear on a Samsung watch because [setLocalOnly](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder.html#setLocalOnly(boolean)) seem to be ignored. However, message preview texts are known to appear correctly on a Pebble 2, a Fitbit Charge 3 and a Mi band 3. See also [this FAQ](#user-content-faq126).
|
||||||
|
|
||||||
|
|
|
@ -1557,30 +1557,28 @@ public class FragmentCompose extends FragmentBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create temporary files
|
// Create temporary files
|
||||||
File plain = File.createTempFile("plain", "." + id, context.getCacheDir());
|
File plain = new File(context.getCacheDir(), "plain." + id);
|
||||||
File encrypted = File.createTempFile("encrypted", "." + id, context.getCacheDir());
|
File encrypted = new File(context.getCacheDir(), "encrypted." + id);
|
||||||
|
|
||||||
// Build message
|
// Serializing messages is NOT reproducible
|
||||||
Properties props = MessageHelper.getSessionProperties();
|
if (OpenPgpApi.ACTION_GET_KEY_IDS.equals(data.getAction())) {
|
||||||
Session isession = Session.getInstance(props, null);
|
// Build message
|
||||||
MimeMessage imessage = new MimeMessage(isession);
|
Properties props = MessageHelper.getSessionProperties();
|
||||||
MessageHelper.build(context, message, attachments, identity, imessage);
|
Session isession = Session.getInstance(props, null);
|
||||||
|
MimeMessage imessage = new MimeMessage(isession);
|
||||||
|
MessageHelper.build(context, message, attachments, identity, imessage);
|
||||||
|
|
||||||
// Serialize message
|
// Serialize message
|
||||||
try (OutputStream out = new FileOutputStream(plain)) {
|
try (OutputStream out = new FileOutputStream(plain)) {
|
||||||
imessage.writeTo(out);
|
imessage.writeTo(out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call OpenPGP
|
// Call OpenPGP
|
||||||
Intent result;
|
Log.i("Executing " + data.getAction());
|
||||||
try {
|
Log.logExtras(data);
|
||||||
Log.i("Executing " + data.getAction());
|
OpenPgpApi api = new OpenPgpApi(context, pgpService.getService());
|
||||||
Log.logExtras(data);
|
Intent result = api.executeApi(data, new FileInputStream(plain), new FileOutputStream(encrypted));
|
||||||
OpenPgpApi api = new OpenPgpApi(context, pgpService.getService());
|
|
||||||
result = api.executeApi(data, new FileInputStream(plain), new FileOutputStream(encrypted));
|
|
||||||
} finally {
|
|
||||||
plain.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process result
|
// Process result
|
||||||
try {
|
try {
|
||||||
|
@ -1686,6 +1684,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
intent.putExtra(BuildConfig.APPLICATION_ID, id);
|
intent.putExtra(BuildConfig.APPLICATION_ID, id);
|
||||||
return intent;
|
return intent;
|
||||||
} else if (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction())) {
|
} else if (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction())) {
|
||||||
|
plain.delete();
|
||||||
|
|
||||||
// Get signature
|
// Get signature
|
||||||
Intent intent = new Intent(OpenPgpApi.ACTION_DETACHED_SIGN);
|
Intent intent = new Intent(OpenPgpApi.ACTION_DETACHED_SIGN);
|
||||||
intent.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, pgpSignKeyId);
|
intent.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, pgpSignKeyId);
|
||||||
|
@ -1700,6 +1700,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
return (PendingIntent) result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
return (PendingIntent) result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
||||||
|
|
||||||
case OpenPgpApi.RESULT_CODE_ERROR:
|
case OpenPgpApi.RESULT_CODE_ERROR:
|
||||||
|
plain.delete();
|
||||||
db.identity().setIdentitySignKey(identity.id, null);
|
db.identity().setIdentitySignKey(identity.id, null);
|
||||||
OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
|
OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
|
Loading…
Reference in a new issue