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:----timXFhE0fP1eeFDpFuXecExRE20SW5RrH9Mj2syGdc9XAir2fc3/ehaF0zfDYqRx986R7VoWk2QYMPL7fk782tqhX9VMEu+IgpyCsbb8yYfxAAdDBw/Ujkq89b8Z66ADLpUtkj8xmn055agP4Vycp6NK+oAfXg2VuXFdumvcWsberbc069zs1h3wM10j3ZoD5jXb9u06okd4u8h3uCI4vE4y7+rMCzSaS5+GSebxBWHYRWhGq3TURx5h9e4+qCLUJ0wFGnVzUZ4mgHUdOLKaOQ5geIId3jdenCxhTdepqiO1qw87L3BowyuhiMUkhuDDEnwc/F2doJQbfBb6E2SOdnTUqydK+4KaBId4z2knb2JHie1+i3784i/uwSbQrxEeXSl2i31OXWOKCik9WVhdZCghZcPilmyNDs8ixPmKkugGmbh1C6Uo6PtN8fcYRZJ4tD0Eaj7XYi+kuICI0HrsODWfVu6IfH2YsVxyi+67NZylP+DHAvKbjMd8Qkafnapxm2SvvDhJHzEhhUQ+QNYVLRPOR2fYdOBxBwGRY0SeYzxUJ1YOco8ADJ9GPTx75mmnO3VfZfNQHGjHRJlXWH4EQS0Ew576rERhVQBgZ9yJk4vPI1J0pnqdX7y2BsaA3Gji86jkt71q/1clJAYvIbRYj9ipguph8fl+BhZEdBfyDO0=----ATTACHMENT:----Mjc4NzgwODU1Nzg4NTYwMiAzMzI3NzE3ODM3Mjk0NjYgMjg3NDUxMTY2NzkxNDQ2NA==