Table of Contents
List of Examples
Table of Contents
This module provides various cryptography tools for use in Kamailio configuration file using libgcrypt.
The initialization vector used for the cryptographic operations. This needs to be a string value with 16 bytes lengths.
Default value is set in the C code.
Example 1.1. Set init_vector
parameter
... modparam("gcrypt", "init_vector", "abcdefghijklmnop") ...
Set it to 1 in order to do AES CBC encryption mode. By default, it does AES ECB mode.
Default value is 0.
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 libcrypt 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.
Encrypts the text with the key using AES256 ECB 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.4. gcrypt_aes_encrypt
usage
... gcrypt_aes_encrypt("$rb", "my-secret-key", "$var(encrypted)"); ...
Decrypts the text with the key using AES256 ECB 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.5. gcrypt_aes_decrypt
usage
... gcrypt_aes_decrypt("$var(encrypted)", "my-secret-key", "$var(text)"); ...