You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • UAPI Functions - SSL::find_csrs_for_key
Skip to end of metadata
Go to start of metadata

Description

This function retrieves certificate signing requests (CSR) for a private key.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/SSL/find_csrs_for_key?friendly_name=TestKey


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.
 
// Retrieve certificate signing requests that are associated with the TestKey key.
$SSL_find_csrs_for_key = $cpanel->uapi(
    'SSL', 'find_csrs_for_key',    array(
        'friendly_name'    => 'TestKey',
    )
);


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.
 
#  Retrieve certificate signing requests that are associated with the TestKey key.
my $SSL_find_csrs_for_key = $cpliveapi->uapi(
    'SSL', 'find_csrs_for_key',    {
        'friendly_name'    => 'TestKey',
    }
);


Note:

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

 Command Line
uapi --user=username SSL find_csrs_for_key friendly_name=TestKey


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    "transformed": 1
  },
  "data": [
    {
      "created": "1402332791",
      "domains": [
        "example.com"
      ],
      "commonName": "example.com",
      "modulus": "a74f7636fa6ac93ee6836a83a995b55deb5019ea36d7ba3dafb00e38d693acdb0c81b2ff777d6b433a420fae523f127f352a68bcc8b8f2d6ee7b70395bafabd8237ada8164fdddf8376b30375c35d4d4cbcce7d33d08069c17b409176a3689f1ebc97c0b08fe6ae44c19a92ac6d68448e7f1d13f3b360affd4222a51b4f35342de99b5a1fb5548e438f2d824664562a448002eed7fce24dedc7dc3e1ed179973d1dae959b33716eeb410d172708954e00632cbf60a0e26419860c8c0bc285d6bfe4b479de0dd189772a5dae676bd2a92acccc1369821be8cffddd8a7e6ecc061f8a32a9ae0661e4e946ed8e3827b277138d3a76116567cbd129cbd869ef9dddf",
      "id": "example_com_a74f7_9dddf_2c5d1615e85db817d6b640f65335fb62",
      "key_algorithm": "rsaEncryption",
	  "ecdsa_curve_name": null,
      "ecdsa_public": null,
      "friendly_name": "TestCSR"
    }
  ]
}


Note:

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

Parameters

You must include one of the following parameters:

ParameterTypeDescriptionPossible valuesExample
idstring

The key's ID.

A valid string.
example_com_cb497_a394d_1397249671_d1272da8f13a1fd837493a5ad1f0a0f3
friendly_namestringThe key's friendly name.A valid string.TestKey

Returns

ReturnTypeDescriptionPossible valuesExample
createdstringWhen the CSR was created.A valid date in Unix time format.
1402332791
domainsstringThe domains that the CSR covers.A valid domain or domains.
example.com
commonNamestringThe CSR's common name.A valid domain.
example.com
modulusstringThe CSR's key's modulus, in hexadecimal format.
  • A valid string.
  • null — The certificate's key is not an RSA key.

Note:

We added the null value in cPanel & WHM version 92.

 Click to view...
a74f7636fa6ac93ee6836a83a995b55deb5019ea36d7ba3dafb00e38d693acdb0c81b2ff777d6b433a420fae523f127f352a68bcc8b8f2d6ee7b70395bafabd8237ada8164fdddf8376b30375c35d4d4cbcce7d33d08069c17b409176a3689f1ebc97c0b08fe6ae44c19a92ac6d68448e7f1d13f3b360affd4222a51b4f35342de99b5a1fb5548e438f2d824664562a448002eed7fce24dedc7dc3e1ed179973d1dae959b33716eeb410d172708954e00632cbf60a0e26419860c8c0bc285d6bfe4b479de0dd189772a5dae676bd2a92acccc1369821be8cffddd8a7e6ecc061f8a32a9ae0661e4e946ed8e3827b277138d3a76116567cbd129cbd869ef9dddf
idstringThe CSR's ID.A valid string.
 Click to view...
example_com_a74f7_9dddf_2c5d1615e85db817d6b640f65335fb62
friendly_namestringThe CSR's friendly name.A valid string.
TestCSR
key_algorithimstring

The CSR's key's algorithm.

Note:

We added this return in cPanel & WHM version 92.

  • rsaEncryption — RSA.
  • id-ecPublicKey — ECDSA.
rsaEncryption
ecdsa_curve_namestring

The ECDSA curve that the CSR's key uses.

Note:

We added this return in cPanel & WHM version 92.

  • prime256v1
  • secp384r1
  • null — The certificate's key is not an ECDSA key.
prime256v1
ecdsa_publicstring

The CSR's key's ECDSA compressed public point, in hexadecimal format.

Note:

We added this return in cPanel & WHM version 92.

  • A valid string.
  • null — The certificate's key is not an ECDSA key.
02a2cb73408a5833ffbe6eedac9227b9985c54a94990cc4a13ea2a57f3bdecada1