If you are getting an error similar to "Invalid key data, not base64 encoded in", most likely it comes from libssh2 library. You need to ensure your key file is in an accepted format by the library. Ex - From my experience, it does not accept rfc4716 format (---- BEGIN SSH2 PUBLIC KEY ----) and it accepts those that start with ssh-rsa ......