Changes

Jump to navigation Jump to search
4 bytes added ,  18:56, 23 September 2019
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'''
* {{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|DES}}, 16 bytes for {{Code|AESaes}}.* {{Code|$algorithm}} must either be {{Code|DES}} or {{Code|AESaes}}. Default is {{Code|DES}}.
|-
| '''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