Description

This function generates a GnuPG key.

 The system saves the key in the user's /home/.gnupg directory.

Examples


$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$generate_key = $cpanel->api1('Gpg', 'genkey', array('Helena', 'But what if it was the chicken?', 'user@example.com', '1y', '2048', '12345luggage') ); // Call the function.

 

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $generate_key = $cpliveapi->api1('Gpg', 'genkey', ['Helena', 'But what if it was the chicken?', 'user@example.com', '1y', '2048', '12345luggage'] ); # Call the function.

 

<cpanel Module="Gpg::genkey($FORM('name','comment','email','expire','keysize','passphrase'))">
cpapi1 --user=username Gpg genkey Helena "But what if it was the chicken?" user@example.com 1y 2048 12345luggage

1

   

Parameters

ParameterTypeDescriptionPossible valuesExample
namestring

Required

The person for whom to generate the key.

Any string that contains at least five characters.Helena
commentstring

A comment about the key.

Any string.

But what if it was the chicken?
emailstring

Required

The email address to encode.

A valid email address.user@example.com
expirestring

The desired amount of time between the key's creation (when this function runs) and its expiration.

  • #y# years.
  • #m# months.
  • #w# weeks.
  • #d# days.

Replace # with one or more digits.

1y
keysizeinteger

The new key's size, in bytes.

Large keys require more time to generate. 

  • 1024
  • 2048
  • 3072
  • 4096
2048
passphrasestringThe key's password.A secure password.12345luggage

Returns

  • 1 — The function succeeded.
  • 0 — The function failed.