Some time ago, I exported keys from DeltaChat running on an Android device and copied them over to my PC using adb pull. Using adb push, I now copied them over to a new Android device into the directory suggested by DetaChat’s “Import secret key” dialog and verified their presence as well as file permissions using adb shell:
This looks like a permission problem to me. The code which looks through the directory is here, and it should at least output the “considering key file” log:
Could you check if the application has the permission to read the storage? Maybe you denied it when it was requested?
Hm, I can’t remember being asked for any permissions when installing DeltaChat on the new device (which runs LineageOS 20). When checking DeltaChat permissions in the “Apps” category of the system settings, I find permissions for reading audio, video and image files, but no general permission of reading the storage. Or is there any other permissions settings page somewhere hidden in the system settings which I have overlooked?
BTW, DeltaChat is capable of exporting the keys in to the mentioned location, so write permissions seem to be granted.
Hi, maybe it is of interest what I figured out as a workaround here. I had the same situation, that DeltaChat fails to import keys. I am on Android 11 (LineageOS 18.1) and it looks like a very odd permission problem…
Maybe we should export both private and public key to a single file. Selecting a file on Android and similarly sandboxed platforms like Flatpak seems to be much less error-prone than selecting a folder, there are no failures like “granted access to the folder but not the files inside of it” possible.
gpg itself does not allow to use both --export and --export-secret-keys though, so having such file with both keys concatenated is probably not common.
Maybe it is possible to drop the public key and reconstruct it from the private key, then there is no need to import/export the public key at all, or only allow to export it for publishing somewhere?
EDIT: Information Security Stack Exchange question suggests that private key export contains the public key as well. So exporting public key should not be necessary to transfer
And the import function in the core only needs the secret key file, because it extracts the public key from the secret key:
Note: there is a similar issue in the desktop repository, the requirement to select a directory rather than a file is confusing:
Going to make a fix for the core to be able to open a file with a secret key directly, this may not only fix the Android permission problem but be a better UI for the desktop.