Bug: OpenPGP migration corruption, importing stuck, rnp_key_protect failed
Status: RESOLVED
Priority: P1
Resolution: FIXED
Created: 2020-07-30 16:21:01+00:00
Resolved: 2020-09-09 19:49:14+00:00

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.122 Safari/537.36

Steps to reproduce:

0. Running on Windows 10 v1909 64-bit, thunderbird installed using chocolatey with Russian language pack. Thunderbird version is 78.0.1 (64-bit).
1. Open thunderbird.
2. Go to menu (≡ near top right corner).
3. Select entry “Параметры учётной записи” (“account preferences”?). It has icon which looks like rounded rectangle separated into two regions using vertical split, with two long and one short line in the left region and nothing in the right.
4. In the newly opened tab in the left navigational bar select subtab “Сквозное шифрование” (“end-to-end encryption”?) belonging to the only account I have configured.
5. In the subtab which gets opened there is paragraph header “OpenPGP” with line “{Key drawing} Thunderbird doesn’t have a personal OpenPGP key for napav@spels.ru `[{Key drawing with +}Add Key…]`”. Press `[{Key drawing with +}Add Key…]` button.
6. Export secret key somewhere by running `gpg --export-secret-keys {hex} > key.gpg` in cygwin (powershell adds some crap to the start of the exported key which renders it unreadable by Thunderbird if you do the same thing there, `-o key.gpg` is not helpful). Using GnuPG 2.2.21 with libgcrypt 1.8.6, GnuPG installed using chocolatey as well.
7. After step 5 dialog “Add a Personal OpenPGP Key for napav@spels.ru” appears. Select option “Import an existing OpenPGP Key” there.
8. Press `[Continue]` button.
9. Press `[Select File to Import…]` button.
10. Choose key exported in step 6 in the file open dialog.
11. After choosing file with key Thunderbird lists keys found in that file, one (and the only) of those keys appears in the blue rounded rectangle. Select or leave unselected “Treat this key as a Personal Key” button, neither option appears to help.
12. Press `[Continue]` button.


Actual results:

After following those steps the “Add a Personal OpenPGP Key for napav@spels.ru” dialog displays “Importing your OpenPGP Keys…” with a “busy” circle below (small rotating blue ring with varying color intensity). It never actually finishes importing key and Process Monitor does not report any seeming relevant activity from Thunderbird process when it does that.

While “importing” happens other tabs (like Inbox) work just fine, Process Monitor also reports that Thunderbird is attempting to receive new mail every once in a while. You may also close account preferences tab.

Key in question is both password-protected (secret key) and not password-protected (public key). The same thing happens when trying to use non-password-protected key I generated for testing purposes and included in the attachement. Note though that actual key appears in `gpg --list-secret-keys` as

    sec   rsa4096 2017-10-12 [SCA] [expires: 2022-10-11]
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    uid           [ultimate] napav <napav@spels.ru>
    ssb   rsa4096 2017-10-12 [E] [expires: 2022-10-11]

while test key appears as

    sec   rsa4096 2020-07-30 [SC] [expires: 2025-07-29]
          92D9A968249979F878925F786DA81535D6A233B0
    uid           [ultimate] TESTS <napav@spels.ru>
    ssb   rsa4096 2020-07-30 [E] [expires: 2025-07-29]

I do not know what does `A` mean there.

Key in question worked just fine with Enigmail.


Expected results:

Key imported successfully.