Johnny Matthews | Dealing with the OpenKeychain input error

The OpenKeychain app on Android is used for managing GPG keys on your mobile device. However, it's stuck on GPG version 2.2.0. This was written on 19th of November 2023.

If you created a GPG key on your computer using a GPG version higher than 2.2.0, OpenKeychain will likely throw an error when trying to read it:

Error from OpenKeyChain: Encountered an error reading input data!

I recently encountered this error when updating my keys for my password store. To get around the error, you can temporarily install an older version of GPG, re-initialize your password store, and re-export your keys to your Android device.

  1. Install GnuPG version 2.2:

    brew install gnupg@2.2
    
  2. Specify that you want to use this specific GPG version for your current terminal session:

    echo 'export PATH="/opt/homebrew/opt/gnupg@2.2/bin:$PATH"' >> /Users/johnnymatthews/.bash_profile && source ~/.bash_profile
    

    Replace johnnymatthews with your username.

  3. Re-initialise your password store:

    pass init johnny
    

    Replace johnny with the identifier of your key.

  4. Push any changes to your remote pass store:

    pass git push
    
  5. Re-export your key:

    gpg --export-secret-keys johnny > private.key
    

    Again, replace johnny with the identifier of your key.

  6. Securely copy private.key to your Android device.

  7. Delete your old key from the OpenKeychain app and import the private.key file.

  8. Pull your password store changes from Git.

You should now be able to view your passwords with your GPG key! At this point, you can remove the old version of GPG from your system with:

brew remove gnupg@2.2
rm -rf /opt/homebrew/etc/gnupg