Connecting Keepassxc Portable on Windows with Firefox

I am using the excellent KeepassXC on all my computers, it works on Windows (work-supplied laptop), Linux (home) and there are mobile clients too. On my Windows work laptop I am using the PortableApps version. The keepassxc devs offer a portable zip for download (KUDOS!) but I do like the seamless upgrades and the start menu the PortableApps platform offers. So far, so good.

However, I – seemingly like many others – have trouble to connect the portable version with the Firefox browser extension to enable autofill. After lots of trial and error and debugging attempts (debugging led to no more detail than “key exchange failed”, unfortunately), I have gotten it working. See below what I did, in the hope that it might be useful for others and for future reference to myself (I posted this in the portable app forum too -and- as the problem seems widespread as an issue in the keepassxc issue tracker. It was quickly closed there as the devs don’t want to support PortableApps versions, fair enough, but would perhaps saved them a few support requests if the information were to be find in their development wiki):

Initial Problem PortableApps Keepassxc (2.5.3)
Some things worked as intended:

  • I had a registry key under “Computer\HKEY_CURRENT_USER\Software\Mozilla\NativeMessagingHosts\org.keepassxc.keepassxc_browser”,
  • it pointed to the correct org.keepassxc.keepassxc_browser_firefox.json file
  • which pointed to a correct path “C:\Users\spaetz\bin\PortableApps\KeePassXCPortable\App\KeePassXC\keepassxc-proxy.exe”

When I started Firefox, I got a running keepassxc-proxy.exe process as a Firefox child process. However, trying to connect, all I got is a “key exchange failed” error. Turning on add-on debugging led to the same result and not more helpful information.
When I turned off the use of a proxy in the keepassxc settings (Browser integration -> Advanced), starting Firefox actually also started a keepassxc instance automatically, however all I still got was a “key exchange failed” error. NO combination of options, deleting of keepassxc and/or the browser extension, deletion of registry entries, or using a fresh Firefox profile helped.

Possible Solution

I noted that there are actually 2 binaries:
BINARY1:
C:\Users\spaetz\bin\PortableApps\KeePassXCPortable\KeePassXCPortable.exe (248kb) and
BINARY2:
C:\Users\spaetz\bin\PortableApps\KeePassXCPortable\App\KeePassXC\KeePassXC.exe (7094kb)

The latter is also the directory which contains the keepassxc-proxy.exe. The binary in the former directory is what is started when one starts keepassxc through the PortableApps menu.

IF I directly start the latter binary, the Firefox extension is able to connect to the running keepassxc. If I start the former, I will get a key exchange failed error. Somehow, in this case the proxy will probably try to talk to the wrong binary. (not sure what weird wrapper the first binary is).

I autostart BINARY2 now on system start (Hit WIN-R, type shell:startup and paste a “link” to the correct keepassxc.exe) and that seems to do the trick for me. I realize that this is not the fault of keepassxc, but given the multitude of reported errors and the unhelpful error message I think this might be of use for other users of the Portable Version. It might be useful on the wiki if confirmed by other users of the portable version on windows….