The command createkeys() creates new keys for an authenticated user.
This command ensures that the desired key material is available for an authenticated user. This means that if the corresponding user has no or only expired key material available, new key material would be generated according to the settings (see Parameter keys). This corresponds to the settings you can make in the Ruleset generator under Key generation.
Structure of the command
createkeys('keys',['continue']);
Return value
positive |
if the keys are created successfully |
negative |
if the creation failes |
Parameters
keys (optional)
This parameter specifies which key material is to be generated. The format corresponds to a bitmask in octal notation.
The following values are available:
Bit 0 : Generate OpenPGP key pair
Bit 1 : Generate S/MIME certificate with your own certification authority
Bit 2 : Generate S/MIME certificate via CA connector
Values |
Mask |
||||
---|---|---|---|---|---|
Bit 0: OpenPGP |
x |
|
x |
|
x |
Bit 1: S/MIME with own CA |
|
x |
x |
|
|
Bit 2: S/MIME via CA-Connector |
|
|
|
x |
x |
Value for keys |
1 |
2 |
3 |
4 |
5 |
continue (optional)
With this parameter, it is decided whether an email is rejected temporarily during the generation of the key material (false) with the message 420 An encryption key for your account '$senderemail' will be available shortly, so for example 420 An encryption key for your account 'john.doe@mycompany.tld' will be available shortly, or is held in the queue of the SEPPmail Secure E-Mail Gateway.
Possible values
•true, yes or 1
•false, no or 0
The default setting is 0
Example 1
Line |
Code |
---|---|
01 |
if (authenticated()) { |
02 |
createkeys('3'); |
03 |
log(1,'OpenPGP Key generated'); |
04 |
} |
Explanation
The example evaluates the return value of the command authenticated() (line 01). If the internal sender of the email could be authenticated successfully, due to the negation, the return value is true. Thus, it is proceeded with createkeys() (line 02) and an OpenPGP key pair is created, unless a valid pair already exists (line 02). Additionally, a log entry is created (line 03).