Skip to content

Commit

Permalink
💩 Imporve AES_KEY validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Oct 12, 2016
1 parent 0fc1d3d commit dad1c0f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Encryption/Encryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,14 @@ public function decode($decrypted)
*/
protected function getAESKey()
{
if (empty($this->AESKey) || strlen($this->AESKey) !== 43) {
if (empty($this->AESKey)) {
throw new InvalidConfigException("Configuration mission, 'aes_key' is required.");
}

if (strlen($this->AESKey) !== 43) {
throw new InvalidConfigException("The length of 'aes_key' must be 43.");
}

return base64_decode($this->AESKey.'=', true);
}

Expand Down

0 comments on commit dad1c0f

Please sign in to comment.