mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-17 06:23:38 +02:00
Added S/MIME encrypt/decrypt key aliases
This commit is contained in:
@@ -3222,8 +3222,12 @@ public class FragmentCompose extends FragmentBase {
|
||||
EntityIdentity identity = db.identity().getIdentity(draft.identity);
|
||||
if (identity != null && identity.sign_key_alias != null)
|
||||
try {
|
||||
PrivateKey key = KeyChain.getPrivateKey(context, identity.sign_key_alias);
|
||||
args.putBoolean("available", key != null);
|
||||
Pair<String, String> aliases = identity.getAliases();
|
||||
if (aliases != null && aliases.first != null) {
|
||||
args.putString("alias", aliases.first);
|
||||
PrivateKey key = KeyChain.getPrivateKey(context, aliases.first);
|
||||
args.putBoolean("available", key != null);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
@@ -3238,13 +3242,13 @@ public class FragmentCompose extends FragmentBase {
|
||||
|
||||
boolean available = args.getBoolean("available");
|
||||
if (available) {
|
||||
args.putString("alias", identity.sign_key_alias);
|
||||
onSmime(args, action, extras);
|
||||
return;
|
||||
}
|
||||
|
||||
if (interactive)
|
||||
Helper.selectKeyAlias(getActivity(), getViewLifecycleOwner(), identity.sign_key_alias, new Helper.IKeyAlias() {
|
||||
if (interactive) {
|
||||
String alias = args.getString("alias");
|
||||
Helper.selectKeyAlias(getActivity(), getViewLifecycleOwner(), alias, new Helper.IKeyAlias() {
|
||||
@Override
|
||||
public void onSelected(String alias) {
|
||||
args.putString("alias", alias);
|
||||
@@ -3269,6 +3273,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
snackbar.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -4463,7 +4468,8 @@ public class FragmentCompose extends FragmentBase {
|
||||
}
|
||||
|
||||
// Store selected alias
|
||||
db.identity().setIdentitySignKeyAlias(identity.id, alias);
|
||||
identity.setAlias(alias, true);
|
||||
db.identity().setIdentitySignKeyAlias(identity.id, identity.sign_key_alias);
|
||||
|
||||
// Build content
|
||||
File sinput = new File(tmp, draft.id + ".smime_sign");
|
||||
|
||||
Reference in New Issue
Block a user