- keys should now be null padded if they're too short

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@136 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2010-12-01 05:09:01 +00:00
parent fb0f03c904
commit 4d4cc0e0f5
2 changed files with 2 additions and 2 deletions

View File

@ -362,7 +362,7 @@ class Crypt_DES {
*/ */
function setKey($key) function setKey($key)
{ {
$this->keys = ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) ? substr($key, 0, 8) : $this->_prepareKey($key); $this->keys = ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) ? str_pad(substr($key, 0, 8), 8, chr(0)) : $this->_prepareKey($key);
$this->changed = true; $this->changed = true;
} }

View File

@ -532,7 +532,7 @@ class Crypt_Rijndael {
*/ */
function setKey($key) function setKey($key)
{ {
$this->key = $key; $this->key = str_pad(substr($key, 0, $this->key_size), $this->key_size, chr(0));
$this->changed = true; $this->changed = true;
} }