|
@@ 61-63 (lines=3) @@
|
| 58 |
|
public function encrypt($aad, $plainText, $cek) |
| 59 |
|
{ |
| 60 |
|
$cekLen = StringUtils::length($cek); |
| 61 |
|
if ($cekLen * 8 != $this->keySize) { |
| 62 |
|
throw new JoseJwtException(sprintf('AES-CBC with HMAC algorithm expected key of size %s bits, but was given %s bits', $this->keySize, $cekLen * 8)); |
| 63 |
|
} |
| 64 |
|
if ($cekLen % 2 != 0) { |
| 65 |
|
throw new JoseJwtException('AES-CBC with HMAC encryption expected key of even number size'); |
| 66 |
|
} |
|
@@ 93-95 (lines=3) @@
|
| 90 |
|
public function decrypt($aad, $cek, $iv, $cipherText, $authTag) |
| 91 |
|
{ |
| 92 |
|
$cekLen = StringUtils::length($cek); |
| 93 |
|
if ($cekLen * 8 != $this->keySize) { |
| 94 |
|
throw new JoseJwtException(sprintf('AES-CBC with HMAC algorithm expected key of size %s bits, but was given %s bits', $this->keySize, $cekLen * 8)); |
| 95 |
|
} |
| 96 |
|
if ($cekLen % 2 != 0) { |
| 97 |
|
throw new JoseJwtException('AES-CBC with HMAC encryption expected key of even number size'); |
| 98 |
|
} |