mirror of
https://github.com/danog/tgseclib.git
synced 2025-01-22 14:01:20 +01:00
Merge branch '1.0' into 2.0
This commit is contained in:
commit
4e4397afc9
@ -168,14 +168,17 @@ class Agent
|
|||||||
for ($i = 0; $i < $keyCount; $i++) {
|
for ($i = 0; $i < $keyCount; $i++) {
|
||||||
$length = current(unpack('N', fread($this->fsock, 4)));
|
$length = current(unpack('N', fread($this->fsock, 4)));
|
||||||
$key_blob = fread($this->fsock, $length);
|
$key_blob = fread($this->fsock, $length);
|
||||||
|
$key_str = 'ssh-rsa ' . base64_encode($key_blob);
|
||||||
$length = current(unpack('N', fread($this->fsock, 4)));
|
$length = current(unpack('N', fread($this->fsock, 4)));
|
||||||
$key_comment = fread($this->fsock, $length);
|
if ($length) {
|
||||||
|
$key_str.= ' ' . fread($this->fsock, $length);
|
||||||
|
}
|
||||||
$length = current(unpack('N', substr($key_blob, 0, 4)));
|
$length = current(unpack('N', substr($key_blob, 0, 4)));
|
||||||
$key_type = substr($key_blob, 4, $length);
|
$key_type = substr($key_blob, 4, $length);
|
||||||
switch ($key_type) {
|
switch ($key_type) {
|
||||||
case 'ssh-rsa':
|
case 'ssh-rsa':
|
||||||
$key = new RSA();
|
$key = new RSA();
|
||||||
$key->loadKey('ssh-rsa ' . base64_encode($key_blob) . ' ' . $key_comment);
|
$key->loadKey($key_str);
|
||||||
break;
|
break;
|
||||||
case 'ssh-dss':
|
case 'ssh-dss':
|
||||||
// not currently supported
|
// not currently supported
|
||||||
|
Loading…
x
Reference in New Issue
Block a user