diff --git a/FAQ.md b/FAQ.md index 347e0ffe1d..ee95c70b44 100644 --- a/FAQ.md +++ b/FAQ.md @@ -449,6 +449,10 @@ First of all you need to install and configure [OpenKeychain](https://f-droid.or To encrypt and send a message just check the menu *Encrypt* and the message will be encrypted on sending. Similarly, to decrypt a received message, just select the menu *Decrypt* in the expanded message view. +The first time you send an encrypted message you might be asked for a sign key. +FairEmail will automatically store the sign key ID in the selected identity for the next time. +If you need to reset the sign key, just save the identity to clear the sign key ID again. + You can enable *Encrypt by default* in the identity settings, which replaces *Send* by *Encrypt and send*. FairEmail will send the [Autocrypt](https://autocrypt.org/) headers for other email clients. diff --git a/app/src/main/java/eu/faircode/email/DaoIdentity.java b/app/src/main/java/eu/faircode/email/DaoIdentity.java index 9581fd0b0a..a1e1a9f8cf 100644 --- a/app/src/main/java/eu/faircode/email/DaoIdentity.java +++ b/app/src/main/java/eu/faircode/email/DaoIdentity.java @@ -85,7 +85,7 @@ public interface DaoIdentity { int setIdentityConnected(long id, long last_connected); @Query("UPDATE identity SET sign_key = :sign_key WHERE id = :id") - int setIdentitySignKey(long id, long sign_key); + int setIdentitySignKey(long id, Long sign_key); @Query("UPDATE identity SET error = :error WHERE id = :id") int setIdentityError(long id, String error); diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 9b0e769e7d..3a8804aba6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1486,11 +1486,13 @@ public class FragmentCompose extends FragmentBase { return result.getParcelableExtra(OpenPgpApi.RESULT_INTENT); case OpenPgpApi.RESULT_CODE_ERROR: + if (identity != null) + db.identity().setIdentitySignKey(identity.id, null); OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR); if (error == null) throw new IllegalArgumentException("Unknown error"); else - throw new IllegalArgumentException(error.getMessage()); + throw new IllegalArgumentException(error.getMessage() + " (" + error.getErrorId() + ")"); default: throw new IllegalArgumentException("Unknown result code=" + resultCode);