The has_smime_key() command checks whether the user has a valid private S/MIME key.
This command checks whether an internal user of the appliance (see Users OpenPGP) has a valid private S/MIME key.
|
One prerequisite for a search with has_smime_key() is that the user has already been authenticated (see authenticated()). |
Structure of the command
has_smime_key();
Return value
positive |
If the user has a valid private S/MIME key. |
negative |
if the user •does not have a private S/MIME key or only has expired S/MIME keys. •is set to the status may not encrypt. •is set to the status may not sign. |
Parameters
none
Example 1
Line |
Code |
|---|---|
01 |
if (has_smime_key()){ |
02 |
log(1,'S/MIME key available, trying to sign'); |
03 |
if (sign_smime()) { |
04 |
log(1,'signing successful'); |
05 |
} else { |
06 |
log(1,'signing failed'); |
07 |
} |
08 |
} else { |
09 |
log(1,'no S/MIME key available, do not sign'); |
10 |
} |
Explanation
In this example, it is first checked whether a private S/MIME key is available (line 01). The result is logged (lines 02 and 09). If a private S/MIME key is available, an attempt is made to sign the email (line 03) and the result of this action is also logged (lines 04 or 06).

