From 1c7ffb57202ceb64521e5770fc9bb3d16642149c Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 4 Jul 2020 20:02:50 +0200 Subject: [PATCH] Trust key from backup upon restore --- .../main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java index cf070bdf1..7cf036c2e 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java @@ -479,9 +479,11 @@ public final class OpenPgpManager extends Manager { String backupCode = codeCallback.askForBackupCode(); PGPSecretKeyRing secretKeys = SecretKeyBackupHelper.restoreSecretKeyBackup(backup, backupCode); + OpenPgpV4Fingerprint fingerprint = new OpenPgpV4Fingerprint(secretKeys); provider.getStore().importSecretKey(getJidOrThrow(), secretKeys); provider.getStore().importPublicKey(getJidOrThrow(), BCUtil.publicKeyRingFromSecretKeyRing(secretKeys)); + getOpenPgpSelf().trust(fingerprint); return new OpenPgpV4Fingerprint(secretKeys); }