|
@@ 61-63 (lines=3) @@
|
| 58 |
|
public function wrapNewKey($cekSizeBits, $kek, array $header) |
| 59 |
|
{ |
| 60 |
|
$kekLen = StringUtils::length($kek); |
| 61 |
|
if ($kekLen * 8 != $this->kekLengthBits) { |
| 62 |
|
throw new JoseJwtException(sprintf('AesKeyWrap management algorithm expected key of size %s bits, but was given %s bits', $this->kekLengthBits, $kekLen * 8)); |
| 63 |
|
} |
| 64 |
|
if ($cekSizeBits % 8 != 0) { |
| 65 |
|
throw new JoseJwtException('CekSizeBits must be divisible by 8'); |
| 66 |
|
} |
|
@@ 86-88 (lines=3) @@
|
| 83 |
|
public function unwrap($encryptedCek, $kek, $cekSizeBits, array $header) |
| 84 |
|
{ |
| 85 |
|
$kekLen = StringUtils::length($kek); |
| 86 |
|
if ($kekLen * 8 != $this->kekLengthBits) { |
| 87 |
|
throw new JoseJwtException(sprintf('AesKeyWrap management algorithm expected key of size %s bits, but was given %s bits', $this->kekLengthBits, $kekLen * 8)); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
return $this->aesUnwrap($kek, $encryptedCek); |
| 91 |
|
} |