Jose\Loader::fromFlattenedSerializationRecipientToSerialization PHP Method

fromFlattenedSerializationRecipientToSerialization() private method

    private function fromFlattenedSerializationRecipientToSerialization($input)
    {
        $recipient = [];
        foreach (['header', 'encrypted_key'] as $key) {
            if (array_key_exists($key, $input)) {
                $recipient[$key] = $input[$key];
            }
        }
        $recipients = ['ciphertext' => $input['ciphertext'], 'recipients' => [$recipient]];
        foreach (['protected', 'unprotected', 'iv', 'aad', 'tag'] as $key) {
            if (array_key_exists($key, $input)) {
                $recipients[$key] = $input[$key];
            }
        }
        return $recipients;
    }