/usr/share/doc/kamailio/modules/README.crypto is in kamailio-tls-modules 5.1.2-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | CRYPTO Module
Daniel-Constantin Mierla
<miconda@gmail.com>
Edited by
Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2016 asipto.com
__________________________________________________________________
Table of Contents
1. Admin Guide
1. Overview
2. Dependencies
2.1. Kamailio Modules
2.2. External Libraries or Applications
3. Parameters
3.1. salt (str)
3.2. register_callid (int)
4. Functions
4.1. crypto_aes_encrypt(text, key, res)
4.2. crypto_aes_decrypt(text, key, res)
List of Examples
1.1. Set salt parameter
1.2. Set register_callid parameter
1.3. crypto_aes_encrypt usage
1.4. crypto_aes_decrypt usage
Chapter 1. Admin Guide
Table of Contents
1. Overview
2. Dependencies
2.1. Kamailio Modules
2.2. External Libraries or Applications
3. Parameters
3.1. salt (str)
3.2. register_callid (int)
4. Functions
4.1. crypto_aes_encrypt(text, key, res)
4.2. crypto_aes_decrypt(text, key, res)
1. Overview
This module provides various cryptography tools for use in Kamailio
configuration file.
It relies on OpenSSL libraries for cryptographic operations (libssl,
libcrypto).
2. Dependencies
2.1. Kamailio Modules
2.2. External Libraries or Applications
2.1. Kamailio Modules
The following modules must be loaded before this module:
* none.
2.2. External Libraries or Applications
The following libraries or applications must be installed before
running Kamailio with this module loaded:
* libcrypto - part of OpenSSL project
3. Parameters
3.1. salt (str)
3.2. register_callid (int)
3.1. salt (str)
A keyword to generate salt for encryption. It must be at least 8 chars
long. If set to empty, no salt is used for encryption.
The salt is a binary array that is appended to the encryption password
for better protection against dictionary attacks. Same salt and
password need to be when encrypting and decrypting.
Default value is "..." (see code).
Example 1.1. Set salt parameter
...
modparam("crypto", "salt", "l0Bh2M8a")
...
3.2. register_callid (int)
Set it to 1 in order to register a callback to core for generation of
callid values for requests generated by Kamailio tm module.
This callid generator uses libssl random and hashing functions for
generating RFC 4122 version 4 UUID with high quality entropy. It is
useful when wanting to have new callids that cannot be predicted from
previous values.
Default value is 0.
Example 1.2. Set register_callid parameter
...
modparam("crypto", "register_callid", 1)
...
4. Functions
4.1. crypto_aes_encrypt(text, key, res)
4.2. crypto_aes_decrypt(text, key, res)
4.1. crypto_aes_encrypt(text, key, res)
Encrypts the text with the key using AES encryption algorithm. The
result is encoded in base64 format and stored in res. The parameter res
must be a read-write variables. The parameters text and key can be
static strings or strings with variables (dynamic strings).
This function can be used from ANY_ROUTE.
Example 1.3. crypto_aes_encrypt usage
...
crypto_aes_encrypt("$rb", "my-secret-key", "$var(encrypted)");
...
4.2. crypto_aes_decrypt(text, key, res)
Decrypts the text with the key using AES encryption algorithm. The text
has to be encoded in base64 format. The parameter res must be a
read-write variables. The parameters text and key can be static strings
or strings with variables (dynamic strings).
This function can be used from ANY_ROUTE.
Example 1.4. crypto_aes_decrypt usage
...
crypto_aes_decrypt("$var(encrypted)", "my-secret-key", "$var(text)");
...
|