mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +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;
|
||||
}
|
||||
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),
|
||||
'publicExponent' => $modulus
|
||||
);
|
||||
} else {
|
||||
return array(
|
||||
return strlen($key) ? false : array(
|
||||
'modulus' => $modulus,
|
||||
'publicExponent' => $publicExponent
|
||||
);
|
||||
@ -1033,7 +1033,7 @@ class Crypt_RSA {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->components;
|
||||
return isset($this->components['modulus']) && isset($this->components['publicExponent']) ? $this->components : false;
|
||||
// from PuTTY's SSHPUBK.C
|
||||
case CRYPT_RSA_PRIVATE_FORMAT_PUTTY:
|
||||
$components = array();
|
||||
|
Loading…
Reference in New Issue
Block a user