I reinstalled DC 1.38.2 on Android.
(Reason: 1.40.0 kept crashing on start, a simple downgrade to 1.38.2 did not help.)
Now, 1.38.2 starts again but the chat list is empty.
How can I restore the chats?
My approaches so far:
Concerning the keys:
I still have another regular mail app with the keys working and managed over OpenKeychain so that I can decrypt and read all messages from the DeltaChat folder. And I have got a backup_XXXX-XX-XX.sec.pgp file (maybe exported from OpenKeychain, not DC?). When trying to import the keys from that file via the Download folder, DC complained it couldn’t find a matching file.
Concerning the messages:
The messages are still there in the DeltaChat IMAP folder. But not in DC. Do I need to move them into the IMAP Inbox to make DC rescan all messages? I have found this topic on that: What would be the proper way to restore a Delta Chat account using only mail server messages?
Thanks for any help
at least earlier, move the delta-chat folder content into a temporary folder on the email server, and then back, made DC fetch all anew.
If I recall correctly, I had the same problem and I think it was because you need to give the files a specific name. What I did to find that out was exporting the keys from DC (you can generate new ones just to be able to do it) and looking at the format and names of the backup files.
Then, take your keys from PGP, give them the proper name, make sure they are in the correct format (probably ASC instead of armor) and put them in a folder to be able to import them.
For the messages just do as the thread you linked or @SamanaJohann suggests.
Before I move the emails away and back to trigger DC chat restore (thanks @SamanaJohann and @Ivan), I need to restore the old keys.
@Ivan: Good to know that you had that issue, too, but I still fail to import the keys. And yes, I named the key files exactly like DC does when exporting keys (which is e.g. private-key-1.asc and public-key-1.asc).
So, the issue is: I cannot reinstall the keys as they had been “tainted” (?) by OpenKeychain and exported from there?
So, to track that further I exported arbitrary new DC’s keys and imported them into gpg on a PC, exported them again as mentioned in other threads (Import of existing PGP keys · Issue #98 · deltachat/deltachat-android · GitHub) but … no. When transfered back into Andoird’s Download/ folder, DC still tells me that there are no keys found in the Downloads/ folder… While the byte size before / after gpg is identical, diff shows some slight differences.
Hm, is anyone able to import gpg (or OpenKeychain) exported keys into DC?
Am I missing something trivial?
How could I get more information why DC does not accept the keys?
Maybe comparing the keys with a PGP viewer in a computer…
My guess is that PGP has signed or altered them from their original state (eg: changing some field, the name, …) when they were exported by DC and now DC fails to import them.
If you could find the logical difference you could theoretically edit the PGP key and be able to feed it to DC in the exact format it expects.
you should prefer a Deltachat Backup to a key import if that is possible. Key import might still have problems and needs to be reworked IMO
Yes, lessens learned… But too late for now! I only have (working) gpg / OpenKeychain keys. I thought it was enough to have those backed up!
I still hope to find the needle in the haystack why DC refuses to reimport my keys…
Delta Chat refuses to import PGP keys that contain a passphrase, more info here: FAQ - Delta Chat
Concerning passwords: Thanks, I’ve seen that thread too, that DC refuses keys with passwords. But this key is indeed originally from DC… And only imported to OpenKeychain (and then backed up from there). So there has never been a password around.
I am trying
pgpdump to compare the concerned keys with what DC creates. I still fail to see the reason why DC does not want to import my old DC keys.
pgpdump I compared the output of the old DC key (which had been imported to OpenKeychain and then backed up from there) and the new test DC key from a fresh DC installation:
The only relevant diff I see is:
The old keys (that are refused to be imported) have
EdDSA R(255 bits) - ...
EdDSA s(256 bits) - ...
for the public key and
EdDSA Q(60073 bits) - ...
for the private key.
The new test keys (that can be re-imported by DC) use:
EdDSA R(253 bits) - ...
EdDSA s(256 bits) - ...
for the public key and
EdDSA Q(39312 bits) - ...
Hm. Not sure whether there is a way to make my old keys having the exact same bit depth.
Hi, I have nearly the same challenge. The F-Droid Update to 1.40 and a uninstall and reinstall of 1.38 brought me in trouble. The messages are still on the IMAP server and the keys inside of Thunderbird, because I had exported them years ago to read the DeltaChat folder in Thunderbird as well… Now I thought it should be possible to get everything to work again by importing the old key again - but I have the same trouble as mentioned here – this is really annoying, because I did’t expect this trouble by reading the FAQs…
Could it be possible, that Deltachat is refusing the secret key import, because of the public key being part of it? This is the mayor difference I can see: When I export the keys from Deltachat, both keys are in individual files. The restored secret key from Thunderbird (with deleted PW by the help of gpg) is always exported by gpg with the public key inside too (if I delete the keys in gpg and reimport from the secret key file, both keys are present in gpg again – private and public…).
If that can be the problem, does anybody know how to export the secret key in gpg without the public key?
@dctopo: You can easily split your exported asc file into two asc files, one for the public and one for the private one. These are only text files in the end. But even with exact files names this is not enough. That’s why I started comparing the details of the keys. Somehow, the keys are not the same when re-exported from OpenKeychain, gpg, Thunderbird – even though these apps can successfully use the keys…
@mpa : You are right – I did a key import of the new private key exported from DeltaChat in gpg and it looks like, that the public key is always part of the secret one (or is derivable from it) because both are now present in gpg. So it is unlikely to be the problem…
But gpg is the much major application than DeltaChat and I do not think it does anything „harmful“ to the key on import and export. It shouldn’t matter at all if the key is slightly different after passing through gpg, because Deltachat should accept existing keys from gpg and others:
FAQ: Delta Chat supports common OpenPGP private key formats, however, it is unlikely that private keys from all sources will be fully supported. This is not the main goal of Delta Chat. In fact, the majority of new users will not have any key prior to using Delta Chat. We do, however, try to support private keys from as many sources as possible.
If an ordinary import/export breaks compatibility it makes no sense to claim “supports common OpenPGP private key formats” or “…try to support private keys from as many sources as possible.” And according to the info in this link (the link is from DeltaChat FAQ!): https://github.com/deltachat/deltachat-android/issues/98#issuecomment-378383429 the import/export (and deleting an existing password protection) in gpg is recommended and was at least working in 2018.
I solved the problem for me, but it was really tricky and took me many hours…
I hope it is helpful for you @mpa and several others too. I describe the whole way I took with description, so that everybody can follow the logic of what I have done – In my case it was a combination of two “bugs” in DC, both showing the same message in DC…
What got me on the right track was the fact that even the keys newly exported from DC could only be imported again as long as they were not deleted and re-inserted into the download folder. It made no difference if I used adb push to directly send the files to /storage/emulated/0/Download or simply the file manager of my operating system to access the storage of the smartphone. The output of ls -l on the adb shell doesn’t show anything strange – all as expected, but DC refuses every file copied to the phone. I was not able to find out the reason. But I found a workaround:
I did a key export from DC (the new keys, generated by the new setup after fresh install) and left the files in place. Then I copied the key files I wanted to import from my computer to the phone with an other file name. The next step was to open both files in a text editor on the phone and to directly copy the key-text from the backup to the new exported file. After saving it was possible to import into DC. This worked for the backup and for a key imported and re-exported from gpg. But it didn’t work for my old key witch I exported from Thunderbird…
I had to protect the old key with a password, otherwise it would not have been possible to export from Thunderbird. I already deleted this password with gpg as described in the link in my former message, but this was not enough – in addition I had to perform an “minimize” in gpg to delete signatures. All together I did the following commands in gpg (the key has to be imported to gpg):
gpg --edit-key [key-id]
enter existing passphrase
change passphrase to [empty]
And than the following export worked for import in DC…
gpg --armor --export-secret-keys [key-id] > deltachat.asc
…in combination with the textfile editing as described before: exporting keys from DC (private-key-1.asc); copying deltachat.asc to the phone; open deltachat.asc with an editor on the phone and copy the unique key-text; open private-key-1.asc in the editor and replace the key-text by pasting the text from the former file; save private-key-1.asc and try the import into DC. It worked for me…
@dctopo: I am very happy to confirm that copying the key file content is indeed working here, too, I got my old keys imported! Thanks a lot for exploring that workaround!!
Some more information:
- It feels quite… well… random to me, that copying key file content instead of entire files makes a difference… But the DC devs might know why and maybe make that more transparent.
- I did not try the “minimize” gpg workaround. That wasn’t needed here probably because the keys were originally from DC itself.
- There is no way to install a fresh DC instance and select keys to be imported right away (besides starting from a previously created DC backup). So, I had to take care not to have DC continue with newly created keys while setting old keys up. Anyway, it seems that DC can handle multiply keys, though. See here.
- To make DC import old chats I moved the mail away and back to DeltaChat mail directory as mentioned already.
I am about to mark this thread kind of solved soon!