Answer the question
In order to leave comments, you need to log in
SSH key generation?
I do not understand how to create and save a key using the standard ssh2 lib.
From the docks:
$ssh = ssh2_connect("127.0.0.1", "22");
ssh2_auth_password($ssh, "root", "1234567890");
$pkey = ssh2_publickey_init($ssh);
$keyblob = base64_decode(
"AAAAB3NzaC1yc2EAAAABIwAAAIEA5HVt6VqSGd5PTrLRdjNONxXH1tVFGn0
Bd26BF0aCP9qyJRlvdJ3j4WBeX4ZmrveGrjMgkseSYc4xZ26sDHwfL351xj
zaLpipu\BGRrw17mWVBhuCExo476ri5tQFzbTc54VEHYckxQ16CjSTibI5X
69GmnYC9PNqEYq/1TP+HF10="
);
$result = ssh2_publickey_add($ssh, 'ssh-rsa', $keyblob, false, array('comment' => "John's Key"));
var_dump($pkey); // NULL
var_dump($result); // bool(false)
$keyblob
? Where did he come from? What should happen in ssh2_publickey_init()
? Answer the question
In order to leave comments, you need to log in
Create a key with the appropriate utility.
For example console ssh-keygen or puttygen from putty.org
ssh2 is either a client, not a key generator.
in order to "create and save the key" you need to use the appropriate utilities.
and php-shny ssh is actually an ssh client
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question