/** * Creates a new Credentials object with the AuthMode::PUBLIC_KEY authorizationmdoe. Requires username and keys details. * @param string $username Authorization username * @param string $publicKey Public key path * @param string $privateKey Private key path * @param string $passphrase Passphrase for Private key (if required) * @return Credentials */ public static function withPublicKey($username, $publicKey, $privateKey, $passphrase = null) { $instance = new self(); $instance->setMode(AuthMode::PUBLIC_KEY); $instance->setUsername($username); $instance->setPublicKey($publicKey); $instance->setPrivateKey($privateKey, $passphrase); return $instance; }
/** * @param PrivateKey * @return PublicKey */ public static function createFromPrivateKey(PrivateKey $private) { $public = new self(); $public->setPrivateKey($private); return $public; }