This commit is contained in:
2021-08-11 14:19:59 +08:00
parent 54de278a83
commit bf8849aff8
+4 -3
View File
@@ -49,12 +49,13 @@ class Jwt extends Component
$this->setEncrypt($jwt['encrypt'] ?? JWTConstant::AES_128_ECB); $this->setEncrypt($jwt['encrypt'] ?? JWTConstant::AES_128_ECB);
$this->setKey($jwt['key'] ?? get_called_class()); $this->setKey($jwt['key'] ?? get_called_class());
var_dump($this->encrypt); $length = openssl_cipher_iv_length($this->encrypt);
if ($length > 0) {
$defaultIv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($this->encrypt)); $defaultIv = openssl_random_pseudo_bytes($length);
$this->setIv($jwt['iv'] ?? $defaultIv); $this->setIv($jwt['iv'] ?? $defaultIv);
} }
} }
}
/** /**
* @param int $unionId * @param int $unionId