Changes

Jump to navigation Jump to search
No change in size ,  18:59, 23 September 2019
no edit summary
The encryption and decryption functions underlie several limitations:
* Cryptographic algorithms are currently limited to {{Code|symmetric}} algorithms. This means that the same secret key is used for encryption and decryption.
* Available algorithms are {{Code|desDES}} and {{Code|aesAES}}.
* Padding is fixed to {{Code|PKCS5Padding}}.
* The result of an encryption using the same message, algorithm and key looks different each time it is executed. This is due to a random initialization vector (IV) which is appended to the message and simply increases security.
* {{Code|$data}} must be a string or binary item.
* {{Code|$type}} must be {{Code|symmetric}}.
* {{Code|$key}} is the secret key which is used for both encryption and decryption of input data. It must be a string or binary item. Its length is fixed and depends on the chosen algorithm: 8 bytes for {{Code|desDES}}, 16 bytes for {{Code|aesAES}}.* {{Code|$algorithm}} must either be {{Code|desDES}} or {{Code|aesAES}}. Default is {{Code|desDES}}.
|-
| '''Errors'''
'''Query:'''
<pre class="brush:xquery">
crypto:encrypt('message', 'symmetric', 'keykeyke', 'desDES')
</pre>
|}
* {{Code|$data}} must be a string or binary item.
* {{Code|$type}} must be {{Code|symmetric}}.
* {{Code|$key}} is the secret key which is used for both encryption and decryption of input data. It must be a string or binary item. Its length is fixed and depends on the chosen algorithm: 8 bytes for {{Code|desDES}}, 16 bytes for {{Code|aesAES}}.* {{Code|$algorithm}} must either be {{Code|desDES}} or {{Code|aesAES}}. Default is {{Code|desDES}}.
|-
| '''Errors'''
'''Query:'''
<pre class="brush:xquery">
let $encrypted := crypto:encrypt('message', 'symmetric', 'keykeyke', 'desDES')return crypto:decrypt($encrypted, 'symmetric', 'keykeyke', 'desDES')
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu