| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | * @param string|resource $kek | 
| 29 | 29 | * @param array $header | 
| 30 | 30 | * | 
| 31 | - * @return array [cek, encryptedCek] | |
| 31 | + * @return string[] [cek, encryptedCek] | |
| 32 | 32 | */ | 
| 33 | 33 | public function wrapNewKey($cekSizeBits, $kek, array $header) | 
| 34 | 34 |      { | 
| @@ -37,7 +37,7 @@ | ||
| 37 | 37 | * @param string $securedInput | 
| 38 | 38 | * @param string $key | 
| 39 | 39 | * | 
| 40 | - * @return bool | |
| 40 | + * @return integer | |
| 41 | 41 | */ | 
| 42 | 42 | public function verify($signature, $securedInput, $key) | 
| 43 | 43 |      { | 
| @@ -49,10 +49,10 @@ discard block | ||
| 49 | 49 | public function encrypt($aad, $plainText, $cek) | 
| 50 | 50 |      { | 
| 51 | 51 | $cekLen = strlen($cek); | 
| 52 | -        if ($cekLen * 8 != $this->keySize) { | |
| 52 | +        if ($cekLen*8 != $this->keySize) { | |
| 53 | 53 |              throw new JoseJwtException(sprintf('AES-CBC with HMAC algorithm expected key of size %s bits, but was given %s bits', $this->keySize, $cekLen*8)); | 
| 54 | 54 | } | 
| 55 | -        if ($cekLen % 2 != 0) { | |
| 55 | +        if ($cekLen%2 != 0) { | |
| 56 | 56 |              throw new JoseJwtException('AES-CBC with HMAC algorithm expected key of even number size'); | 
| 57 | 57 | } | 
| 58 | 58 | |
| @@ -81,10 +81,10 @@ discard block | ||
| 81 | 81 | public function decrypt($aad, $cek, $iv, $cipherText, $authTag) | 
| 82 | 82 |      { | 
| 83 | 83 | $cekLen = strlen($cek); | 
| 84 | -        if ($cekLen *8  != $this->keySize) { | |
| 84 | +        if ($cekLen*8 != $this->keySize) { | |
| 85 | 85 |              throw new JoseJwtException(sprintf('AES-CBC with HMAC algorithm expected key of size %s bits, but was given %s bits', $this->keySize, $cekLen*8)); | 
| 86 | 86 | } | 
| 87 | -        if ($cekLen % 2 != 0) { | |
| 87 | +        if ($cekLen%2 != 0) { | |
| 88 | 88 |              throw new JoseJwtException('AES-CBC with HMAC algorithm expected key of even number size'); | 
| 89 | 89 | } | 
| 90 | 90 | |
| @@ -118,7 +118,7 @@ discard block | ||
| 118 | 118 | $aad, | 
| 119 | 119 | $iv, | 
| 120 | 120 | $cipherText, | 
| 121 | -            pack('N2', ($aadLen / $max32bit) * 8, ($aadLen % $max32bit) * 8) | |
| 121 | +            pack('N2', ($aadLen/$max32bit)*8, ($aadLen%$max32bit)*8) | |
| 122 | 122 | ]); | 
| 123 | 123 | $authTag = $this->hashAlgorithm->sign($hmacInput, $hmacKey); | 
| 124 | 124 | $authTagLen = strlen($authTag); | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | * @param string $plainText | 
| 45 | 45 | * @param string|resource $cek | 
| 46 | 46 | * | 
| 47 | - * @return array [iv, cipherText, authTag] | |
| 47 | + * @return string[] [iv, cipherText, authTag] | |
| 48 | 48 | */ | 
| 49 | 49 | public function encrypt($aad, $plainText, $cek) | 
| 50 | 50 |      { | 
| @@ -103,10 +103,10 @@ discard block | ||
| 103 | 103 | } | 
| 104 | 104 | |
| 105 | 105 | /** | 
| 106 | - * @param $aad | |
| 107 | - * @param $iv | |
| 108 | - * @param $cipherText | |
| 109 | - * @param $hmacKey | |
| 106 | + * @param string $aad | |
| 107 | + * @param string $iv | |
| 108 | + * @param string $cipherText | |
| 109 | + * @param string $hmacKey | |
| 110 | 110 | * | 
| 111 | 111 | * @return string | 
| 112 | 112 | */ | 
| @@ -48,10 +48,10 @@ discard block | ||
| 48 | 48 | public function wrapNewKey($cekSizeBits, $kek, array $header) | 
| 49 | 49 |      { | 
| 50 | 50 | $kekLen = strlen($kek); | 
| 51 | -        if ($kekLen * 8 != $this->kekLengthBits) { | |
| 51 | +        if ($kekLen*8 != $this->kekLengthBits) { | |
| 52 | 52 |              throw new JoseJwtException(sprintf('AesKeyWrap management algorithm expected key of size %s bits, but was given %s bits', $this->kekLengthBits, $kekLen*8)); | 
| 53 | 53 | } | 
| 54 | -        if ($cekSizeBits % 8 != 0) { | |
| 54 | +        if ($cekSizeBits%8 != 0) { | |
| 55 | 55 |              throw new JoseJwtException('CekSizeBits must be divisible by 8'); | 
| 56 | 56 | } | 
| 57 | 57 | |
| @@ -73,7 +73,7 @@ discard block | ||
| 73 | 73 | public function unwrap($encryptedCek, $kek, $cekSizeBits, array $header) | 
| 74 | 74 |      { | 
| 75 | 75 | $kekLen = strlen($kek); | 
| 76 | -        if ($kekLen * 8 != $this->kekLengthBits) { | |
| 76 | +        if ($kekLen*8 != $this->kekLengthBits) { | |
| 77 | 77 |              throw new JoseJwtException(sprintf('AesKeyWrap management algorithm expected key of size %s bits, but was given %s bits', $this->kekLengthBits, $kekLen*8)); | 
| 78 | 78 | } | 
| 79 | 79 | |
| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | * @param string|resource $kek | 
| 29 | 29 | * @param array $header | 
| 30 | 30 | * | 
| 31 | - * @return array [cek, encryptedCek] | |
| 31 | + * @return string[] [cek, encryptedCek] | |
| 32 | 32 | */ | 
| 33 | 33 | public function wrapNewKey($cekSizeBits, $kek, array $header) | 
| 34 | 34 |      { | 
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | 3 | // if library is in dev environement with its own vendor, include its autoload | 
| 4 | -if(file_exists(__DIR__ . '/vendor')) | |
| 5 | - require_once __DIR__ . '/vendor/autoload.php'; | |
| 4 | +if (file_exists(__DIR__.'/vendor')) | |
| 5 | + require_once __DIR__.'/vendor/autoload.php'; | |
| 6 | 6 | // if library is in vendor of another project, include the global autolaod | 
| 7 | 7 | else | 
| 8 | - require_once __DIR__ . '/../../autoload.php'; | |
| 8 | + require_once __DIR__.'/../../autoload.php'; | |
| @@ -1,8 +1,10 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | 3 | // if library is in dev environement with its own vendor, include its autoload | 
| 4 | -if(file_exists(__DIR__ . '/vendor')) | |
| 4 | +if(file_exists(__DIR__ . '/vendor')) { | |
| 5 | 5 | require_once __DIR__ . '/vendor/autoload.php'; | 
| 6 | +} | |
| 6 | 7 | // if library is in vendor of another project, include the global autolaod | 
| 7 | -else | |
| 8 | +else { | |
| 8 | 9 | require_once __DIR__ . '/../../autoload.php'; | 
| 10 | +} | |