The "password" context option can also be used to provide the passphrase for the keyfile supplied by "privkey_file" and "pubkey_file".Note this bug: https://bugs.php.net/bug.php?id=58573Encrypted keys may not work unless you build libssh2 against openssl. (It only worked for me on Debian Wheezy once I recompiled the library).