Fortinet white logo
Fortinet white logo

Script Reference Guide

Key_gen(str_pass, str_salt, iter_num, len_num)

Key_gen(str_pass, str_salt, iter_num, len_num)

Creates an AES key to encrypt/decrypt data, either generated by password or user defined.

Syntax

key_gen(str_pass, str_salt, iter_num, len_num);

Arguments

Name Description

str_pass

The password string.

str_salt

The salt string.

iter_num

The number of iterations.

len_num

The key length.

Events

Applicable in all events.

Example

when HTTP_REQUEST {
new_key = key_gen("pass", "salt", 32, 32);     -- first parameter is the password string, second the salt string, third the number of iterations, fourth the key length
debug("new key in hex is %s\n", to_HEX(new_key));
}

Supported Version

FortiADC version 5.2.x and later.

Key_gen(str_pass, str_salt, iter_num, len_num)

Key_gen(str_pass, str_salt, iter_num, len_num)

Creates an AES key to encrypt/decrypt data, either generated by password or user defined.

Syntax

key_gen(str_pass, str_salt, iter_num, len_num);

Arguments

Name Description

str_pass

The password string.

str_salt

The salt string.

iter_num

The number of iterations.

len_num

The key length.

Events

Applicable in all events.

Example

when HTTP_REQUEST {
new_key = key_gen("pass", "salt", 32, 32);     -- first parameter is the password string, second the salt string, third the number of iterations, fourth the key length
debug("new key in hex is %s\n", to_HEX(new_key));
}

Supported Version

FortiADC version 5.2.x and later.