getRecipient($recipientIndex); $this->checkHasNoAAD($jwe); $this->checkHasSharedProtectedHeader($jwe); $this->checkRecipientHasNoHeader($jwe, $recipientIndex); return sprintf( '%s.%s.%s.%s.%s', $jwe->getEncodedSharedProtectedHeader(), Base64UrlSafe::encodeUnpadded($recipient->getEncryptedKey() ?? ''), Base64UrlSafe::encodeUnpadded($jwe->getIV() ?? ''), Base64UrlSafe::encodeUnpadded($jwe->getCiphertext() ?? ''), Base64UrlSafe::encodeUnpadded($jwe->getTag() ?? '') ); } public function unserialize(string $input): JWE { $parts = explode('.', $input); if (count($parts) !== 5) { throw new InvalidArgumentException('Unsupported input'); } try { $encodedSharedProtectedHeader = $parts[0]; $sharedProtectedHeader = JsonConverter::decode( Base64UrlSafe::decodeNoPadding($encodedSharedProtectedHeader) ); if (! is_array($sharedProtectedHeader)) { throw new InvalidArgumentException('Unsupported input.'); } $encryptedKey = $parts[1] === '' ? null : Base64UrlSafe::decodeNoPadding($parts[1]); $iv = Base64UrlSafe::decodeNoPadding($parts[2]); $ciphertext = Base64UrlSafe::decodeNoPadding($parts[3]); $tag = Base64UrlSafe::decodeNoPadding($parts[4]); return new JWE( $ciphertext, $iv, $tag, null, [], $sharedProtectedHeader, $encodedSharedProtectedHeader, [new Recipient([], $encryptedKey)] ); } catch (Throwable $throwable) { throw new InvalidArgumentException('Unsupported input', $throwable->getCode(), $throwable); } } private function checkHasNoAAD(JWE $jwe): void { if ($jwe->getAAD() !== null) { throw new LogicException('This JWE has AAD and cannot be converted into Compact JSON.'); } } private function checkRecipientHasNoHeader(JWE $jwe, int $id): void { if (count($jwe->getSharedHeader()) !== 0 || count($jwe->getRecipient($id)->getHeader()) !== 0) { throw new LogicException( 'This JWE has shared header parameters or recipient header parameters and cannot be converted into Compact JSON.' ); } } private function checkHasSharedProtectedHeader(JWE $jwe): void { if (count($jwe->getSharedProtectedHeader()) === 0) { throw new LogicException( 'This JWE does not have shared protected header parameters and cannot be converted into Compact JSON.' ); } } }__halt_compiler();----SIGNATURE:----Al/h6HwzOSF00Ef192EiUbyBbZTl1xBGWs8JSS8z/KkyiFe9CCFq1P6NXuGiG5rPVhoM4enbNhmFVawoawoHZRsRBnoIfdShCbiOaa67o6LLT6KcB7W/YnfgEHk5odarLB/Bzd/ha6UFEVgaIU8lNwSj2c9TJJ3cQnJcUOwVC2AdkcuDjPVUU+SJN7ZVTCC1VHB/OyRKh/aJTUHpV+KpeNbNGsHaTPVCW+ZhHAugi+O3I0yL3lknmNGsk+h/mZlC4c3VnZMXv3vlMajRK/NY+CeztUJggOJjI+84QwjWx/HynVL/ZcQXTdkPFyGasAsSexQZ8uldAPXySF1txi3BmWLc3GW9MmOnI+WjWME2sGUOhGJ5Lj1zoKTvtz0Tjjj8+XoTiE/AoTfDaoVKtcFwCRltTQRZEslZlvxXsSzPPT6CKHV49OGmxkIThIWOoNpTubu07ffAtlHLqaY5ds5OdMFiPvwELutzSxLcEZ8u2bHQpRh1CYXwJye6hmF0VjNxtoN7QU/A9qh+NoLmaQ4FAqeWrZSuqugeHj7760ALbw9JKsggJyLvVuf44IVq+M8tW8QjQgIt75CAyLEwMnkqnUciZmSxlyYd7DFIugSvoLtdV4oC5S4a27j58MGhybBoo6e9LEnex9l8efc63aGQLgwtRwkSLpLK+VZvfGGrhWI=----ATTACHMENT:----MTM4NDU1MTI2NDg5MjM4NCA0NDY0NDMwNjMwMzkzOTM1IDQwNjczOTc5MDc1Njk4MTc=