This commit is contained in:
2021-08-11 14:36:07 +08:00
parent bf8849aff8
commit 13f7b93659
3 changed files with 1 additions and 34 deletions
-31
View File
@@ -1,31 +0,0 @@
<?php
namespace Kiri\Jwt;
class JWTConstant
{
const AES_128_ECB = 'aes-128-ecb';
const AES_192_ECB = 'aes-192-ecb';
const AES_256_ECB = 'aes-256-ecb';
const ARIA_128_ECB = 'aria-128-ecb';
const ARIA_192_ECB = 'aria-192-ecb';
const ARIA_256_ECB = 'aria-256-ecb';
const BF_ECB = 'bf-ecb';
const CAMELLIA_128_ECB = 'camellia-128-ecb';
const CAMELLIA_192_ECB = 'camellia-192-ecb';
const CAMELLIA_256_ECB = 'camellia-256-ecb';
const CAST5_ECB = 'cast5-ecb';
const DES_ECB = 'des-ecb';
const DES_EDE = 'des-ede';
const DES_EDE3 = 'des-ede3';
const ID_SMIME_ALG_CMS3DESWRAP = 'id-smime-alg-CMS3DESwrap';
const IDEA_ECB = 'idea-ecb';
const RC2_ECB = 'rc2-ecb';
const RC4 = 'rc4';
const RC4_40 = 'rc4-40';
const RC4_HMAC_MD5 = 'rc4-hmac-md5';
const SEED_ECB = 'seed-ecb';
const SM4_ECB = 'sm4-ecb';
}
-2
View File
@@ -46,9 +46,7 @@ class Jwt extends Component
$jwt = Config::get('jwt', []);
if ($jwt) {
$this->setScene($jwt['scene'] ?? 'application');
$this->setEncrypt($jwt['encrypt'] ?? JWTConstant::AES_128_ECB);
$this->setKey($jwt['key'] ?? get_called_class());
$length = openssl_cipher_iv_length($this->encrypt);
if ($length > 0) {
$defaultIv = openssl_random_pseudo_bytes($length);
+1 -1
View File
@@ -26,7 +26,7 @@ trait JwtHelper
private string $scene = 'default';
private string $encrypt = '';
private string $encrypt = 'aes-128-ecb';
private string $iv = '';