Child pages
  • UAPI Functions - GPG::export_public_key
Skip to end of metadata
Go to start of metadata

Description

This function exports a GnuPG (GPG) public key.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/GPG/export_public_key?key_id=48BEA5A16FCA746E


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Export a GnuPG public key.
$poll = $cpanel->uapi(
    'GPG', 'export_public_key',
    array(
        'key_id' => '48BEA5A16FCA746E',
  )
);


Note:

For more information, read our Guide to the LiveAPI System.

 

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Export a GnuPG public key.
my $poll = $cpliveapi->uapi(
    'GPG', 'export_public_key',
    {
        'key_id' => '48BEA5A16FCA746E',
  }
);


Note:

For more information, read our Guide to the LiveAPI System.

 Command Line
uapi --user=username GPG export_public_key key_id=48BEA5A16FCA746E 
 Output (JSON)
{
    "apiversion": 3,
    "module": "GPG",
    "func": "export_public_key",
    "result": {
        "warnings": null,
        "status": 1,
        "errors": null,
        "data": {
            "key_data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v2.0.22 (GNU/Linux)\n\nmQMuBFzwFyMRCADgNf7GHvCgb2/HWBYVAzu408eXEO4ucWGfbD5c5BOHg7WBVOkh\nj+J0HYaeh9FwOXLJAzesiGtTU/HQ5wNkBbKRYR2oNEUbiefBgQhjllIGJNnFCQbD\nTcyxXjKUF4aQBw6InqzM9akVChLvGoCfom/y1fcwrQ5OQ46EEjhe9lSnj1E2DIi+\n0PvOsWeehChtn28WkmXPcl+XovfsCl5vh2RnJQeJwkSwBogA1GObj9fnPBbrIUt2\nF5JDaJ7/R8aDwV1Pg2mBmRqTBIKvx6gxEQgCL52OWCKVJfqy5oVGDl/2u0BGCaRt\n3Tnh9B14Lk8frBaOjYMtMq1Rl3rPDc3KCRnLAQC6dMNJ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L/ndf/yu0jPEZE1uEpxvH1X/x2IecMy7wm51usxpBWwSw7BTLfA9ASzDtH\n8fnkid2qY2J6fNWZDA5wrNR4auVKDkqKsatMC75GkHcT2NevLdh8SuYH60kQsmvD\nOkuE4ufIwzlnQ4HFKsYTxn6QIQY18entu563f+RCoUCNv2J0zxXFzvy+eo568+Uh\nx4Irz9OQRNUh/82a2HF10oUvkPEtCDlMy8gISEqnU1i2Ry8IsbUrvhz+my5yb5Gm\nZz+xOKWTiwADBQf/YOYKvHIWw4/vsbLUPMmjDdMfsnT0haDlLerCSHhY+ZLzYQdz\n/7hC4Qt/5EvaGeXkwAPzr0T4PvVOQUUAiskvDNScYQxS5KxyrHAqoKkF4EDJ9MyK\nDqEN6dF9IDOxuA1g0cOX7THPm3GjRh3BjOaHnN5jXKwT85Cs7hj7u1q9Cm59RUzJ\nwRKyxo9eR3pJMR+8E0VW8oRe/7O/Qvh54ShD7NkfgUhIWcriR9MjoGp0gnpCOH52\nLrfdczCIzAoUC4Q3Jm80sCeZAqf4CNHZ0TxqxuwG+ZkfbCBViM4TVXDEufA4IENM\nmEu2bNWDLkRrrNme+S4HEeNRuSg8EOpFUuwPI4hnBBgRCAAPBQJc8BcjAhsMBQkB\n4TOAAAoJEEi+paFvynRu0YsA/0rluXh9ij3Np4O/KWuL2L8zcOrJJ7mNFuw0wkpY\nfZ3NAP9ayHG+70XellsQ/E3lR8fkRwqDDRh43w7ukhJEfkcY9A==\n=yyST\n-----END PGP PUBLIC KEY BLOCK-----\n"
        },
        "metadata": {},
        "messages": null
    }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
key_idstring

Required

The ID of the GPG key.

A valid string.48BEA5A16FCA746E

Returns

ParameterTypeDescriptionPossible valuesExample
key_datastring

The GPG public key's contents.

A valid GPG key.
 Click to view...
-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v2.0.22 (GN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