mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 18:25:13 +00:00
- improved handling of malformed RSA keys: part II
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@172 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
parent
d4a3d61ff5
commit
a5d702346a
@ -1009,12 +1009,12 @@ class Crypt_RSA {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
extract(unpack('Nlength', $this->_string_shift($key, 4)));
|
extract(unpack('Nlength', $this->_string_shift($key, 4)));
|
||||||
return array(
|
return strlen($key) ? false : array(
|
||||||
'modulus' => new Math_BigInteger($this->_string_shift($key, $length), -256),
|
'modulus' => new Math_BigInteger($this->_string_shift($key, $length), -256),
|
||||||
'publicExponent' => $modulus
|
'publicExponent' => $modulus
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return array(
|
return strlen($key) ? false : array(
|
||||||
'modulus' => $modulus,
|
'modulus' => $modulus,
|
||||||
'publicExponent' => $publicExponent
|
'publicExponent' => $publicExponent
|
||||||
);
|
);
|
||||||
@ -1033,7 +1033,7 @@ class Crypt_RSA {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->components;
|
return isset($this->components['modulus']) && isset($this->components['publicExponent']) ? $this->components : false;
|
||||||
// from PuTTY's SSHPUBK.C
|
// from PuTTY's SSHPUBK.C
|
||||||
case CRYPT_RSA_PRIVATE_FORMAT_PUTTY:
|
case CRYPT_RSA_PRIVATE_FORMAT_PUTTY:
|
||||||
$components = array();
|
$components = array();
|
||||||
|
Loading…
Reference in New Issue
Block a user