Child pages
  • GPG::export_secret_key
Skip to end of metadata
Go to start of metadata

Description

This function exports a GnuPG secret key.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/GPG/export_secret_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 secret key.
$poll = $cpanel->uapi(
    'GPG', 'export_secret_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 secret key.
my $poll = $cpliveapi->uapi(
    'GPG', 'export_secret_key',
    {
        'key_id' => '48BEA5A16FCA746E',
  }
);


Note:

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

 cPanel Template Toolkit
<!-- Export a GnuPG secret key. -->
[% execute('GPG', 'export_secret_key', { 'key_id' => '48BEA5A16FCA746E' } ) %]


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username GPG export_secret_key key_id=48BEA5A16FCA746E 
 Output (JSON)
{
    "apiversion": 3,
    "module": "GPG",
    "func": "export_secret_key",
    "result": {
        "messages": null,
        "data": {
            "key_data": "-----BEGIN PGP PRIVATE KEY BLOCK-----\nVersion: GnuPG v2.0.22 (GNU/Linux)\n\nlQNTBFzwFyMRCADgNf7GHvCgb2/HWBYVAzu408eXEO4ucWGfbD5c5BOHg7WBVOkh\nj+J0HYaeh9FwOXLJAzesiGtTU/HQ5wNkBbKRYR2oNEUbiefBgQhjllIGJNnFCQbD\nTcyxXjKUF4aQBw6InqzM9akVChLvGoCfom/y1fcwrQ5OQ46EEjhe9lSnj1E2DIi+\n0PvOsWeehChtn28WkmXPcl+XovfsCl5vh2RnJQeJwkSwBogA1GObj9fnPBbrIUt2\nF5JDaJ7/R8aDwV1Pg2mBmRqTBI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kTLaOApKAeqStWYfr\nOUoraI1BayhI/AiTZAEDhmidAj0EXPAXIxAIAOAmNwCp5CL0s33LBQn9TZmYqUBi\nwobN4iIamtzT4qKWKWDDU3QmZJAzEgzONPnfy7YaWJ282FYDwTfThTHS/53X/8rt\nIzxGRNbhKcbx9V/8diHnDMu8JudbrMaQVsEsOwUy3wPQEsw7R/H55IndqmNienzV\nmQwOcKzUeGrlSg5KirGrTAu+RpB3E9jXry3YfErmB+tJELJrwzpLhOLnyMM5Z0OB\nxSrGE8Z+kCEGNfHp7buet3/kQqFAjb9idM8Vxc78vnqOevPlIceCK8/TkETVIf/N\nmthxddKFL5DxLQg5TMvICEhKp1NYtkcvCLG1K74c/psucm+Rpmc/sTilk4sAAwUH\n/2DmCrxyFsOP77Gy1DzJow3TH7J09IWg5S3qwkh4WPmS82EHc/+4QuELf+RL2hnl\n5MAD869E+D71TkFFAIrJLwzUnGEMUuSscqxwKqCpBeBAyfTMig6hDenRfSAzsbgN\nYNHDl+0xz5txo0YdwYzmh5zeY1ysE/OQrO4Y+7tavQpufUVMycESssaPXkd6STEf\nvBNFVvKEXv+zv0L4eeEoQ+zZH4FISFnK4kfTI6BqdIJ6Qjh+di633XMwiMwKFAuE\nNyZvNLAnmQKn+AjR2dE8asbsBvmZH2wgVYjOE1VwxLnwOCBDTJhLtmzVgy5Ea6zZ\nnvkuBxHjUbkoPBDqRVLsDyMAAVIC+56gmf2bW2mDuoFFUW6KT6jorvvbmXSZHi1L\nAGhQj/Q83gRejq2g+DYiFlCIZwQYEQgADwUCXPAXIwIbDAUJAeEzgAAKCRBIvqWh\nb8p0btGLAPsFHEqEg/qrEpjFu/9B8KvBWBgqIJm9XtDgaVaaHjzR4AD/XcrEvMuc\nPVYssXICwKbDwxWEYqhpI6ms0IOob0PH8hE=\n=W2NA\n-----END PGP PRIVATE KEY BLOCK-----\n"
        },
        "errors": null,
        "metadata": {},
        "status": 1,
        "warnings": 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 secret key that you wish to retrieve.

A valid string.48BEA5A16FCA746E


Returns

ParameterTypeDescriptionPossible valuesExample
key_datastringThe key's contents.A valid GPG key.



 Click to view...
key_data": "-----BEGIN PGP PRIVATE KEY BLOCK-----\nVersion: GnuPG v2.0.22 (GNU/Linux)\n\nlQNTBFzwFyMRCADgNf7GHvCgb2/HWBYVAzu408eXEO4ucWGfbD5c5BOHg7WBVOkh\nj+J0HYaeh9FwOXLJAzesiGtTU/HQ5wNkBbKRYR2oNEUbiefBgQhjllIGJNnFCQbD\nTcyxXjKUF4aQBw6InqzM9akVChLvGoCfom/y1fcwrQ5OQ46EEjhe9lSnj1E2DIi+\n0PvOsWeehChtn28WkmXPcl+XovfsCl5vh2RnJQeJwkSwBogA1GObj9fnPBbrIUt2\nF5JDaJ7/R8aDwV1Pg2mBmRqTBIKvx6gxEQgCL52OWCKVJfqy5oVGDl/2u0BGCaRt\n3Tnh9B14Lk8frBaOjYMtMq1Rl3rPDc3KCRnLAQC6dMNJCxIoyfeEFqj0HgwHETYn\nQNGwUaRrOGKLJbMnewf/Yq0S2R6YvMl8pDQeSExYJaqv/u2Hch6GM0f3CSvMnPSg\noB2c/h4MmhmiAbymSO5GBaM4Nx3NTNYU0JpghkTTJpucFZ8hK/aJ8PDQzBnS0zTY\nF8ZqSMFL84QB1NTd1nlJnilpKCkBC6NHUh76IyLQEsH7jgOG9L28qnLxm8bGHwaJ\nmhEH2Y859WzN9hUTZEMxdklI8uwdI+msI7md0uNYiWr5svtM+rrpU+LCZMG+nTCy\n6q0CNLXM0T0Fa642mYSqV307Ouv5rjGvfohIOo5X8ikBoEIOAQk6LX800OzzYGG4\nX75Q4irMuehEK3tId5VIRToy9MRLP6fyOVHwfhzD6Af/R2TJjIdEkEGdspuw9875\nN4z9xV2QNVNgURIOutrfeKSbb7gRLgV7TWpKWItMoEO1njzb4YqoH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