You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/settings/variables.md
+49-7Lines changed: 49 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,9 @@ dovecotlinks:
18
18
conditionals:
19
19
hash: conditionals
20
20
text: Conditionals
21
+
cryptography_support:
22
+
hash: cryptography-support
23
+
text: Cryptography support
21
24
---
22
25
23
26
# Settings Variables
@@ -97,8 +100,12 @@ Bytes output type indicates that the output will be tagged as binary output. Sub
97
100
| base64(pad=boolean, url=boolean) | Bytes | String | Base64 encode given input, defaults to pad and not url scheme. |
98
101
| benumber | Bytes | Number | Convert big-endian encoded input into a number. |
99
102
| concat(any, any...) | Bytes | Bytes | Concatenates input with value(s). Numbers are coerced to strings. Input is optional. |
103
+
| decrypt(key=bytes,iv=bytes,raw=boolean,algorithm=string) | Any | Any | Decrypts given input, see [cryptography support](#cryptography-support). |
104
+
| decrypt(key=string,salt=string,rounds=number,raw=boolean,hash=string,algorithm=string) | Any | Any | Decrypts given input, see [cryptography support](#cryptography-support). |
100
105
| default(value) | String | String | Replace empty or missing input with value. Clears missing variable error. If no value is provided, empty string is used. |
101
106
| domain | String | String | Provides domain part of user@domain value. |
107
+
| encrypt(key=bytes,iv=bytes,raw=boolean,algorithm=string) | Any | Any | Encrypts given input, see [cryptography support](#cryptography-support). |
108
+
| encrypt(key=string,salt=string,rounds=number,raw=boolean,hash=string,algorithm=string) | Any | Any | Encrypts given input, see [cryptography support](#cryptography-support). |
102
109
| hash(method, rounds=number, salt=string) | Bytes | Bytes | Returns raw hash from input using given hash method. Rounds and salt are optional. |
103
110
| hexlify(width) | Bytes | String | Convert bytes into hex with optional width, truncates or pads up to width. |
104
111
| hex(width) | Number | Number | Convert base-10 number to base-16 number. If width is specified the result is truncated or padded with 0 to width. Negative width is applied after number. |
@@ -129,13 +136,6 @@ Bytes output type indicates that the output will be tagged as binary output. Sub
129
136
| upper | String | String | Uppercases input. |
130
137
| username | String | String | Provides user part of user@domain value. |
131
138
132
-
If [[plugin,var-expand-crypt]] is loaded, these filters are registered as well.
133
-
134
-
| Filter | Input | Output | Description |
135
-
| ------ | ----- | ----- | ----------- |
136
-
| decrypt(algorithm=string,key=string,iv=string,raw=boolean) | Bytes/String | Bytes | Decrypts input with given parameters. If raw is `0`, expects '$' separated value of IV and encrypted data. |
137
-
| encrypt(algorithm=string,key=string,iv=string,raw=boolean) | Bytes | Bytes/String | Encrypts input with given parameters. If raw is `0`, outputs `$` separated value of IV and encrypted data. |
138
-
139
139
## Global providers
140
140
141
141
Global providers that work everywhere are:
@@ -356,3 +356,45 @@ Examples:
356
356
# If %{user} is "testuser", return "INVALID". Otherwise return %{user} uppercased.
357
357
%{user | if ("=", "testuser, "invalid", user) | upper }
| key | Encryption key, if no salt is given, must be hex encoded and match the expected length of chosen algorithm. |
367
+
| iv | Initialization vector, provide if no salt is given and algorithm requires one. Must be hex encoded and match the expected length of chosen algorithm. |
368
+
| salt | If provided, will use hash algorithm to create cipher key and IV with PBKDF2 algorithm. |
369
+
| hash | Hash to use in PBKDF2. Defaults to SHA-256. |
370
+
| rounds | Number of rounds to use in PBKDF2. Defaults to 1000. |
371
+
| algorithm | Encryption algorithm. Expects OpenSSL naming. Some algorithms are not usable due to system or functional restrictions. |
372
+
| raw | When set to 1, will return encrypted result in binary. |
373
+
374
+
### Structured output format
375
+
376
+
Dovecot supports structured encrypted data. If IV is directly provided, the syntax is `iv$data$`.
377
+
With salt based keying material generation, the format is `s=salt,r=rounds$data$`.
378
+
379
+
With no IV or salt provided, salt is randomly generated and used.
380
+
381
+
### Raw output format
382
+
383
+
If raw is used, the raw encryption result is emitted with no salt, rounds or IV included.
384
+
385
+
### Recommended usage
386
+
387
+
For best resuts, you should leave salt and IV management to Dovecot.
0 commit comments