Create GnuPG key

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.

Authorizations:
query Parameters
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
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.

Enum: 1024 2048 3072 4096
Example: keysize=2048
no_expire
integer
Default: 0

Whether to generate the key without an expiration date.

  • 0 - The key will expire.
  • 1 - The key will not expire.
Enum: 0 1
Example: no_expire=0
passphrase
string
Default: null

The key's password.

Example: passphrase=123456luggage

Responses

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object

Request samples

uapi --output=jsonpretty \
  --user=username \
  GPG \
  generate_key \
  name='username' \
  email='user@example.com'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "generate_key",
  • "module": "GPG",
  • "result": {
    • "data": null,
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}