Sorry - Just noticed I sent it to Christian only instead of to the group as well.
Resending.

====


Hi Christian,

Thanks for the quick reply.
The attacked CSV is very small.
I've also included the test query file.

As mentioned, I'd like to encrypt the CK field (so that it's saved to the file as encrypted).

Thanks,
Noam

On Mon, Jun 22, 2015 at 11:30 AM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi Noam,

Could you please provide us with a self-contained example (the
smaller, the better [1])?

Thanks in advance,
Christian

[1] http://sscce.org/






On Mon, Jun 22, 2015 at 10:09 AM, Noam Green <green.noam@gmail.com> wrote:
> Hi all,
>
> I'm using the following xquery (after being helped by Christian).
>
> declare variable $in  external;
> declare variable $out external;
> declare variable $vendor external;
>
> let $options := map { 'header': true() }
> let $text := file:read-text($in)
> let $xml := csv:parse($text, $options)
>
> let $result := <csv>{
>   for $record in $xml//record[contains(VENDORS, $vendor) and
> not(contains(HOST, "Non external")) and not(empty(HOST))]
>
>   return <record>{
>
>      $record/(HOST, PATH, ATTACKCOUNT, TIME_STAMP,CK)
>   }</record>
>
> }</csv>
> return file:write-text($out, csv:serialize($result, $options))
>
> I would like to have one of the returned records encrypted. How do I change
> that record before saving it?
> I tried:
>  return <record>{
>
>      crypto:encrypt($record/CK, 'symmetric','keykeyke','DES'),
> $record/(HOST, PATH, ATTACKCOUNT, TIME_STAMP,CK)
>   }</record>
>
> But that doesn't really change the CK field. I can't seem to modify anything
> in the  $record/(HOST, PATH, ATTACKCOUNT, TIME_STAMP,CK).
>
> Any thoughts?
> Thanks,
> Noam