Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function retrieves a Certificate Signing Request (CSR).

Examples 


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

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 the CSR called TestCSR
$SSL_show_csr = $cpanel->uapi(
    'SSL', 'show_csr',    array(
           'friendly_name'    => 'TestCSR',
  )
);

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 the CSR called TestCSR
my $SSL_show_csr = $cpliveapi->uapi(
    'SSL', 'show_csr',    {
           'friendly_name'    => 'TestCSR',
    }
);

Note:

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

 cPanel Template Toolkit
<!--  Retrieve the CSR called TestCSR -->
[% data = execute( 'SSL', 'show_csr', { friendly_name => 'TestCSR'} ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]

Note:

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

 Command Line
uapi --user=username SSL show_csr friendly_name=TestCSR

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. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{
  "messages": null,
  "errors": null,
  "status": 1,
  "data": {
    "text":
 "Certificate Request:\n Data:\n Version: 0 (0x0)\n Subject: CN = 
example.com, C = US, emailAddress = username@example.com, O = Example, 
ST = Texas, L = Houston\n 
    Subject Public Key Info:\n Public Key Algorithm: rsaEncryption\n Public-Key: (2048 bit)\n 
    Modulus:\n 00:bf:44:22:cb:13:2b:7f:41:9f:48:85:d6:2c:77:\n 03:cf:84:db:90:5c:5a:ed:e5:9c:cb:d6:9d:4b:fc:\n 
    67:58:b7:db:71:dd:eb:8e:5a:77:6f:03:5d:96:85:\n 60:dc:91:45:59:85:ff:9e:57:76:a5:b5:cd:dc:48:\n 
    25:89:3f:8f:17:c1:c2:1e:4d:ec:f0:08:1a:a9:cc:\n 2d:45:34:be:82:77:a5:e4:bb:0b:82:bc:82:51:c3:\n 
    ac:1b:ed:c3:a4:b3:e6:14:4f:ba:9e:39:af:08:ae:\n 3c:2c:15:bd:dc:03:17:93:01:95:4f:c0:2a:0f:3b:\n 
    46:5f:5e:6f:96:d5:b2:dd:53:22:a9:91:e4:36:8e:\n f2:60:5b:ca:b3:72:e6:be:53:8b:9e:b6:72:26:04:\n 
    85:37:f4:89:c1:78:91:7d:46:96:71:c4:be:39:f3:\n cc:1d:79:bc:33:61:5c:5f:76:52:4a:7d:d0:60:31:\n 
    79:96:44:6e:6a:77:72:70:1f:3f:08:24:e6:d1:50:\n c0:6a:86:98:df:56:8b:ae:2f:c1:97:bc:ed:4c:70:\n 
    a1:a6:b2:7e:25:97:8f:95:73:a1:84:71:43:da:33:\n 48:d5:44:17:e1:28:1e:37:93:63:fa:ec:45:17:39:\n 
    e5:ff:62:90:6b:b2:eb:11:5b:32:b2:ce:51:0b:8a:\n 3e:95\n Exponent: 65537 (0x10001)\n Attributes:\n 
    a0:00\n Signature Algorithm: sha1WithRSAEncryption\n 41:bd:99:89:7a:1b:c2:71:90:f7:5a:17:05:c9:77:c8:f0:0e:\n 
    62:0f:85:0d:fb:16:02:74:34:5f:7a:93:3e:50:8e:cf:f4:6f:\n ee:ab:7b:c9:ef:7c:76:59:dd:85:fd:7d:4e:ac:95:9d:b7:ae:\n 
    8a:89:fc:1f:5b:ee:ee:6b:cd:9b:4e:2d:2a:fb:1b:32:8f:8f:\n 56:70:d1:42:c1:72:ed:04:4b:27:5a:ee:5a:e1:2b:6e:53:59:\n 
    aa:14:25:87:7f:2b:c3:7a:f5:b2:6c:71:2a:93:62:40:ca:87:\n b4:fe:34:a1:95:77:1e:98:f1:71:5e:14:97:61:73:07:8d:bc:\n 
    3e:e1:f8:47:f7:00:8b:06:a5:1c:84:a3:88:9a:7b:37:74:5d:\n 34:a6:ae:22:ab:a3:b8:9f:d7:ab:60:9a:70:81:15:13:0f:d9:\n 
    ff:ab:7a:2b:fd:cb:96:04:ad:00:6b:e4:74:4e:59:57:a5:9e:\n 84:c7:74:d8:62:08:37:b3:ee:cc:74:b2:b6:26:e8:c0:37:32:\n 
    19:dc:1c:ff:97:4a:cc:1c:36:c3:a7:2d:ca:77:53:c4:1d:1c:\n 3c:36:5b:f8:90:46:01:48:49:61:9b:ef:bb:b3:a8:94:0b:3f:\n 
    50:51:93:29:9f:aa:9a:ab:ae:3d:3c:72:8a:0b:bc:2f:3f:19:\n d7:5d:70:14\n",
    "csr": "-----BEGIN CERTIFICATE REQUEST------THE CERTIFICATE TEXT\n-----END CERTIFICATE REQUEST-----",
    "details": {
      "organizationalUnitName": null,
      "emailAddress": "username@example.com",
      "organizationName": "Example",
      "countryName": "US",
      "stateOrProvinceName": "Texas",
      "modulus": "a74f7636fa6ac93ee6836a83a995b55deb5019ea36d7ba3dafb00e38d693acdb0c81b2ff777d6b433a420fae523f127f352a68bcc8b8f2d6ee7b70395bafabd8237ada8164fdddf8376b30375c35d4d4cbcce7d33d08069c17b409176a3689f1ebc97c0b08fe6ae44c19a92ac6d68448e7f1d13f3b360affd4222a51b4f35342de99b5a1fb5548e438f2d824664562a448002eed7fce24dedc7dc3e1ed179973d1dae959b33716eeb410d172708954e00632cbf60a0e26419860c8c0bc285d6bfe4b479de0dd189772a5dae676bd2a92acccc1369821be8cffddd8a7e6ecc061f8a32a9ae0661e4e946ed8e3827b277138d3a76116567cbd129cbd869ef9dddf",
      "created": "1365633415",
      "domains": [
        "example.com"
      ],
      "key_algorithm": "rsaEncryption",
      "commonName": "example.com",
      "localityName": "Houston",
      "friendly_name": "TestCSR",
      "id": "example_com_bf442_a3e95_54c3220946c8c495275386ec1728be3c"
    }
  }
}


Note:

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

Parameters

Note:

You must include one of the following parameters:

ParameterTypeDescriptionPossible valuesExample
idstringThe CSR's ID.A valid string.
 Click to view...
example_com_e095f_0ab2f_ebcbe4a571276f48562241411556647f
friendly_namestringThe CSR's friendly name.A valid string.TestCSR

Returns

ReturnTypeDescriptionPossible valuesExample
textstringThe parsed information from the OpenSSL command-line tool.A valid string.
 Click to view...
Certificate Request:\n Data:\n Version: 0 (0x0)\n Subject: CN = 
example.com, C = US, emailAddress = username@example.com, O = Example, 
ST = Texas, L = Houston\n 
Subject Public Key Info:\n Public Key Algorithm: rsaEncryption\n Public-Key: (2048 bit)\n
Modulus:\n 00:bf:44:22:cb:13:2b:7f:41:9f:48:85:d6:2c:77:\n 03:cf:84:db:90:5c:5a:ed:e5:9c:cb:d6:9d:4b:fc:\n
67:58:b7:db:71:dd:eb:8e:5a:77:6f:03:5d:96:85:\n 60:dc:91:45:59:85:ff:9e:57:76:a5:b5:cd:dc:48:\n
25:89:3f:8f:17:c1:c2:1e:4d:ec:f0:08:1a:a9:cc:\n 2d:45:34:be:82:77:a5:e4:bb:0b:82:bc:82:51:c3:\n
ac:1b:ed:c3:a4:b3:e6:14:4f:ba:9e:39:af:08:ae:\n 3c:2c:15:bd:dc:03:17:93:01:95:4f:c0:2a:0f:3b:\n
46:5f:5e:6f:96:d5:b2:dd:53:22:a9:91:e4:36:8e:\n f2:60:5b:ca:b3:72:e6:be:53:8b:9e:b6:72:26:04:\n
85:37:f4:89:c1:78:91:7d:46:96:71:c4:be:39:f3:\n cc:1d:79:bc:33:61:5c:5f:76:52:4a:7d:d0:60:31:\n
79:96:44:6e:6a:77:72:70:1f:3f:08:24:e6:d1:50:\n c0:6a:86:98:df:56:8b:ae:2f:c1:97:bc:ed:4c:70:\n
a1:a6:b2:7e:25:97:8f:95:73:a1:84:71:43:da:33:\n 48:d5:44:17:e1:28:1e:37:93:63:fa:ec:45:17:39:\n
e5:ff:62:90:6b:b2:eb:11:5b:32:b2:ce:51:0b:8a:\n 3e:95\n Exponent: 65537 (0x10001)\n Attributes:\n
a0:00\n Signature Algorithm: sha1WithRSAEncryption\n 41:bd:99:89:7a:1b:c2:71:90:f7:5a:17:05:c9:77:c8:f0:0e:\n
62:0f:85:0d:fb:16:02:74:34:5f:7a:93:3e:50:8e:cf:f4:6f:\n ee:ab:7b:c9:ef:7c:76:59:dd:85:fd:7d:4e:ac:95:9d:b7:ae:\n
8a:89:fc:1f:5b:ee:ee:6b:cd:9b:4e:2d:2a:fb:1b:32:8f:8f:\n 56:70:d1:42:c1:72:ed:04:4b:27:5a:ee:5a:e1:2b:6e:53:59:\n
aa:14:25:87:7f:2b:c3:7a:f5:b2:6c:71:2a:93:62:40:ca:87:\n b4:fe:34:a1:95:77:1e:98:f1:71:5e:14:97:61:73:07:8d:bc:\n
3e:e1:f8:47:f7:00:8b:06:a5:1c:84:a3:88:9a:7b:37:74:5d:\n 34:a6:ae:22:ab:a3:b8:9f:d7:ab:60:9a:70:81:15:13:0f:d9:\n
ff:ab:7a:2b:fd:cb:96:04:ad:00:6b:e4:74:4e:59:57:a5:9e:\n 84:c7:74:d8:62:08:37:b3:ee:cc:74:b2:b6:26:e8:c0:37:32:\n
19:dc:1c:ff:97:4a:cc:1c:36:c3:a7:2d:ca:77:53:c4:1d:1c:\n 3c:36:5b:f8:90:46:01:48:49:61:9b:ef:bb:b3:a8:94:0b:3f:\n
50:51:93:29:9f:aa:9a:ab:ae:3d:3c:72:8a:0b:bc:2f:3f:19:\n d7:5d:70:14\n
csrstringThe CSR's text.A valid CSR.
 Click to view...
-----BEGIN CERTIFICATE REQUEST-----
MIIC3TCCAcUCAQAwgZcxFDASBgNVBAMMC2V4YW1wbGUuY29tMRYwFAYDVQQLDA1E
b2N1bWVudGF0aW9uMQswCQYDVQQGEwJVUzEiMCAGCSqGSIb3DQEJARYTbGF1cmVu
Y2VAY3BhbmVsLm5ldDEUMBIGA1UECgwLY1BhbmVsIEluYy4xDjAMBgNVBAgMBVRl
eGFzMRAwDgYDVQQHDAdIb3VzdG9uMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAp092NvpqyT7mg2qDqZW1XetQGeo217o9r7AOONaTrNsMgbL/d31rQzpC
D65SPxJ/NSpovMi48tbue3A5W6+r2CN62oFk/d34N2swN1w11NTLzOfTPQgGnBe0
CRdqNonx68l8Cwj+auRMGakqxtaESOfx0T87Ngr/1CIqUbTzU0LembWh+1VI5Djy
2CRmRWKkSAAu7X/OJN7cfcPh7ReZc9Ha6VmzNxbutBDRcnCJVOAGMsv2Cg4mQZhg
yMC8KF1r/ktHneDdGJdypdrmdr0qkqzMwTaYIb6M/93Yp+bswGH4oyqa4GYeTpRu
2OOCeydxONOnYRZWfL0SnL2Gnvnd3wIDAQABoAAwDQYJKoZIhvcNAQEFBQADggEB
AFlolzJbcviWcdZUv+PJ7G8cAqFAxa8a3W2a0Y1U0BaMrpDfuOHpQgOtO62rr+i+
hkrIReuk7Isyl6GoZkX17KhQ1Vo9aW8a8Ur7+0RGDbxRlK9jJWnvSFn6cMMqRSfA
DXpptxhqBFZJIZMc3pPX9Jqycuu8bxeIvUKeSMe3Jxcl1ZXEXX47FeRZxvd+WXF9
4Xu4KZXHdzb5tB6jPhzIaN0/3d92N/KhvCcnw3YC2fEGDkpOlZaoa7O72+aq5K3b
M1htFv9deAHqIHefV41iOrxUCIKIhdPIjvAm774lDHLzPpJVrshO/NpA74LEkny5
FMwKKx+6Jgx1HSWucn5kWek=
-----END CERTIFICATE REQUEST-----
detailshashA hash of the CSR's contents.This hash includes the organizationalUnitName, emailAddress, organizationName, countryName, stateOrProvinceName, modulus, created, domains, key_algorithm, commonName, friendly_name, and id returns. 

organizationalUnitName

string

The CSR's organizational unit name.

The function returns this value in the details hash.

A valid string.Department

emailAddress

string

The CSR's email address.

The function returns this parameter in the details hash.

A valid string.username@example.com

organizationName

string

The CSR's organization name.

The function returns this value in the details hash.

A valid string.Organization

countryName

string

The CSR's country name.

The function returns this value in the details hash.

A valid two-letter ISO-3166 country code.US

stateOrProvinceName

string

The CSR's state or province name.

The function returns this value in the details hash.

A valid string.
Texas

modulus

string

The CSR's modulus.

The function returns this value in the details hash.

A valid string.
 Click to view...
a74f7636fa6ac93ee6836a83a995b55deb5019ea36d7ba3dafb00e38d693acdb0c81b2ff777d6b433a420fae523f127f352a68bcc8b8f2d6ee7b70395bafabd8237ada8164fdddf8376b30375c35d4d4cbcce7d33d08069c17b409176a3689f1ebc97c0b08fe6ae44c19a92ac6d68448e7f1d13f3b360affd4222a51b4f35342de99b5a1fb5548e438f2d824664562a448002eed7fce24dedc7dc3e1ed179973d1dae959b33716eeb410d172708954e00632cbf60a0e26419860c8c0bc285d6bfe4b479de0dd189772a5dae676bd2a92acccc1369821be8cffddd8a7e6ecc061f8a32a9ae0661e4e946ed8e3827b277138d3a76116567cbd129cbd869ef9dddf 

created

string

The CSR's creation date.

The function returns this value in the details hash.

A date in Unix time format.1365633415

domains

string

The domains that the CSR covers.

The function returns this value in the details hash.

A valid domain name or list of domains.

example.com

key_algorithm

string

The key algorithm that encrypts the CSR.

The function returns this value in the details hash.

A valid string.
rsaEncryption

commonName

string

The CSR's Common Name or Distinguished Name.

The function returns this value in the details hash.

A valid string.example.com

friendly_name

string

The CSR's friendly name.

The function returns this value in the details hash.

A valid string.TestCSR

id

string

The CSR's ID.

The function returns this value in the details hash.

A valid string
 Click to view...
example_com_c69ce_37ff5_1397169490_169c717cb2c260281df792788accf041