This function generates a GnuPG (GPG) key. The system saves the key in the user's .gnupg directory.
Note:
This function uses the system's entropy to generate the key. Systems with low entropy levels may cause long generation times or timeouts.
| email required | string <email> The user's email address. Example: email=user@example.com |
| name required | string <username> The name of the user for whom to generate the key. Example: name=username |
| passphrase required | string Default: null The key's password. Example: passphrase=123456luggage |
| comment | string Default: null A comment about the key. Example: comment=Username's Key |
| expire | string The desired expiration date of the key as a timestamp in Unix time format. Note: This will default to one year from the current date. Example: expire=1560363242 |
| keysize | integer [ 1024 .. 4096 ] Default: 2048 The new key's size, in bytes. Note: Large keys require more time to generate. Example: keysize=2048 |
| no_expire | integer Default: 0 Whether to generate the key without an expiration date.
Example: no_expire=0 |
uapi --output=jsonpretty \ --user=username \ GPG \ generate_key \ name='username' \ email='user@example.com' passphrase='123456luggage'
{- "apiversion": 3,
- "func": "generate_key",
- "module": "GPG",
- "result": {
- "data": null,
- "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
}
}