We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

SFTP and OpenSSL key format problem and workaround solution

  • #4528
    Avatar photo[anonymous]

    I could not get Publii to successfully make a test connection to my web server, and I tracked it down to the format of the private key I was using. The clue was in deployment-process.log:

    [Sun, 15 Nov 2020 23:15:20 GMT] ERR (1): Error: Cannot parse privateKey: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT

    That led me to a lot of hits on Google, things about private keys that I have never bothered to really understand, but the main point is that OpenSSL changed the format of their private keys “recently” and many SSH libraries don’t play well with the new format yet. References: and

    ssh-keygen was able to downgrade the format without changing the actual private or public keys themselves (very handy if you don’t want to break your authentication to a lot of sites) with this command:

    ssh-keygen -p -m PEM -f ~/.ssh/id_rsa # where rsa may instead be dsa, ed25519, etc. based on what key type you have

    So, a) I hope this helps someone who wants to get SFTP working and b) I hope the Publii maintainers can upgrade the SSH library in a future version.

    Avatar photo[anonymous]


    Thanks for the report of this problem – I will look what we can do with that in the next bigger release of Publii (v.0.38) 🙂