UAPI Functions - SSL::show_cert

Description

This function retrieves a certificate.

Examples


 cPanel or Webmail Session URL

https://hostname.example.com:2083/cpsess##########/execute/SSL/show_cert?friendly_name=TestCert

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Retrieve the certificate "TestCert"
$SSL_show_cert $cpanel->uapi(
    'SSL''show_cert',    array(
           'friendly_name'    => 'TestCert',
    )
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# Retrieve the certificate "TestCert"
my $SSL_show_cert $cpliveapi->uapi(
    'SSL''show_cert',    {
           'friendly_name'    => 'TestCert',
    }
);

 cPanel Template Toolkit

<!-- Retrieve the certificate "TestCert" -->
[% data = execute( 'SSL', 'show_cert', { friendly_name => 'TestCert'} ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]

 Command Line

uapi --user=username SSL show_cert friendly_name=TestCert

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

{
  "messages": null,
  "errors": null,
  "status": 1,
  "data": {
    "cert": "-----BEGIN CERTIFICATE-----
MIIDcTCCAlmgAwIBAgIFAU+BNVgwDQYJKoZIhvcNAQEFBQAwUTESMBAGA1UEAwwJ
c2lza28udGxkMQswCQYDVQQGEwJVUzEPMA0GA1UECgwGY1BhbmVsMQswCQYDVQQI
DAJUWDEQMA4GA1UEBwwHSG91c3RvbjAeFw0xNDEwMDYyMjI2MTlaFw0xNTEwMDYy
MjI2MTlaMFExEjAQBgNVBAMMCXNpc2tvLnRsZDELMAkGA1UEBhMCVVMxDzANBgNV
BAoMBmNQYW5lbDELMAkGA1UECAwCVFgxEDAOBgNVBAcMB0hvdXN0b24wggEiMA0G
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9zx6zGiHdmWA0dKtoXmJiWXpZ9E3P
Xx3YHsjFEWW7e5pH0vZ+jVMzDmm5nsJ7RXrAkZO1IvpIpVLvoQfiJOWVvkD+o9fW
voK1tWJS72FSgPju+58mA2ieBuc87A790Pzuv1P3NR3zFLAjUR99zkHR1fpri/da
M3PBWO8ET48FWkyU1kOeZaUlF67/+wrEiNgg+t1qhKOCAB61PdNVkLaSGHimksuC
+Czk8Kq9nuS0E0TCnDtjjEyJ455FUcaCfczlTb8xkB/F9ORe74yTzD+vlk0tFMG6
PLj/ajIwWqwO0qmQ8wX3NRxkWgGz5kVO1wrVJarKQ5EYQ3/mgvit0v6dAgMBAAGj
UDBOMB0GA1UdDgQWBBRw+wKBo34+bgexjAa3EMDsgSCd7zAfBgNVHSMEGDAWgBRw
+wKBo34+bgexjAa3EMDsgSCd7zAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUA
A4IBAQCHRXIs53opzKM2rM8Qe8lcw524WK6hqy2EWrZHp78N7rU7/6DQ/I3hv3Wh
cDDIO04I2/Xhe88MLBaLoM367Ya+vy7CaLr14aLi/SfQszMA0ALBvMao+Fis0iVw
FYq/NLgSXw+fgnpFskt8v8iQZ+4Kaal8U8e9sVgu8m0RgO7rzym1eRiIKpsKd1rh
/SD7LbSN7M7TRL3QqF7ltw9sQhAAsQcRaBBF21pdWrqhiGZ+Eioo3hhgwNavH2ag
qz78ddHwrFpHFwrEeUk1OfpPb76MYIce7xIy/4oQNdg6fOq4l/FrajBv+WkzDVPa
Km6r7YmwfLN/YMZBHXSR58oOGP9W
-----END CERTIFICATE-----",
    "text": "Certificate:\n Data:\n Version: 3 (0x2)\n Serial Number:\n d1:e8:74:8c:d0:69:d2:55\n
    Signature
 Algorithm: sha1WithRSAEncryption\n Issuer: CN = example.com, C = US,
emailAddress = username@example.com, O = Example, ST = Texas, L =
Houston\n Validity\n
    Not Before: Apr 10 22:38:10 2013 GMT\n Not After : Apr 10 22:38:10 2014 GMT\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:c6:9c:e3:37:1a:fc:e6:1b:e4:29:4d:8e:ee:ec:\n bd:7a:52:12:ef: 34:71:64:77:e0:79:76:6d:ba:f0:\n
    77:fd:f0:92:18:b0:84:c3:f7:12:3a:a9:b9:1d:16:\n 6c:a0:10:6d:f0:55:17:35:27:ff:81:a7:46:e6:d4:\n
    36:97:34:01:3a:2f:6d:61:9a: 04:20:e3:fd:06:11:\n 8b:a4:5e:4f:6d:0d:93:8e:3b:cc:cb:19:b3:cb:74:\n
    7a:54:82:ae:52:9e:46:31:7a:02:44:0b:7b:26:e8:\n 84:aa:91:2b:25:c1:42:0c:cc:5d:c4:d5: c4:cf:df:\n
    de:4c:7c:22:99:ab:06:79:99:16:1e:a7:49:5b:9b:\n 89:97:18:3c:1e:4b:c6:c5:b5:b2:9d:7d:be:b9:91:\n
    c6:08:38:7d:dc:81:18:2b:0c:2c:da:29:f4:aa:a2:\n 72:46:d9:c2:68:31:89:51:ab:32:af:7a:8d:9b:a7:\n
    d8:b8:b5:37:21:03:91:1d:4e:d8:fc:f1:0e:1f:96:\n 17:d6:90:25:c1:3a:1a:76:4c:9e:2b:7e:b9:9c:f5:\n
    86:0a:cf:ea: 2f:eb:bc:33:ee:69:49:b9:c2:e6:a0:\n ef:ee:90:19:4a:2a:64:7e:ef:96:46:7e:7d:e2:35:\n
    ec:d9:cf:34:42:7a:3d:c1:22:b9:68:a2:b3:02:a3:\n 7f:f5\n Exponent: 65537 (0x10001)\n X509v3 extensions:\n
    X509v3 Subject Key Identifier: \n 6A:A1:EA:62:FB:B2:C4:AC:04:B0:43:DD:56:BE:8A:8D:FA:16:D3:F4\n
    X509v3 Authority Key Identifier: \n keyid:6A:A1:EA:62:FB:B2:C4:AC:04:B0:43:DD:56:BE:8A:8D:FA:16:D3:F4\n\n
    X509v3 Basic Constraints: \n CA:TRUE\n Signature Algorithm: sha1WithRSAEncryption\n
    3c:1e:f7:3d:20:1b:a2:bd:5c:d6:0f:2a:9e:f3:b0:83:bf:a9:\n a0:90:9b:96:b1:a6:1e:8b:be:7c:f5:72:58:a0:48:3e:68: 43:\n
    06:37:63:0a:cb:9c:23:98:c6:9e:f1:73:e8:4b:71:ac:07:fc:\n d0:5c:e1:55:4f:be:a7:75:5a:57:da:a1:c2:46:63:8f:3a:70:\n
    4c:42:3c:03:4c:a0:47:a3:fc: ae:15:03:25:a5:78:63:a2:73:\n cd:47:d5:64:7c:d4:f5:85:f7:03:b8:b4:d8:95:75:6a:78:5c:\n
    e6:c7:69:02:7b:a4:fc:4d:8c:80:7b:c7:1c:71:04:ba:53:71:\n 7a: ce:00:cb:0e:5e:21:89:02:ba:90:02:8e:b5:79:8e:84:50:\n
    b0:21:63:b0:ac:19:80:c5:1d:a2:95:68:b7:ee:35:10:fa:db:\n f5:bf:b0:16:b1:34:76:f2:d6:ee:07:3b:6d:b6:0c:1d:b4:e5:\n
    53:50:23:b8:c4:bf:fe:d6:77:ec:89:68:a0:d8:dd:f4:f5:fa:\n 7d:f6:c4:72:02:b1:e8:87:f7:e1:16:71:80:2e:e7:94:7b:eb:\n
    c6:a7:07:36:05:6d:34:b4:25:74:e9:c2:2c:9e:3d:bc:97:8e:\n 84:ce:cc:4f:1f:11:67:ad:30:f6:83:3e:be:bb:88:48:10:65:\n
    f7:4b:2f:80\n",
    "details": {
      "is_self_signed": 1,
      "validation_type":"dv",
        "signature_algorithm":"sha256WithRSAEncryption",
        "subject": {
        "commonName": "example.com",
        "stateOrProvinceName": "Texas",
        "organizationName": "Example",
        "emailAddress": "username@example.com",
        "countryName": "US",
        "localityName": "Houston"
      },
      "modulus": "THE MODULUS INFORMATION",
      "issuer": {
        "commonName": "example.com",
        "stateOrProvinceName": "Texas",
        "organizationName": "Example",
        "emailAddress": "username@example.com",
        "countryName": "US",
        "localityName": "Houston"
      },
      "not_before": 1365633490,
      "not_after": 1397169490,
      "domains": [
        "example.com"
      ],
      "key_algorithm": "rsaEncryption",
      "id": "example_com_c69ce_37ff5_1397169490_169c717cb2c260281df792788accf041",
      "friendly_name": "TestCert"
    }
  }
}

 

Note:

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

 

Parameters

Note:

You must include one of the following parameters:

Parameter

Type

Description

 Possible values 

Example

id

string

The certificate's ID.

A valid string.

 example_com_c69ce_37ff5_1397169490_169c717cb2c260281df792788accf041 

 friendly_name 

 string 

 The certificate's friendly name. 

A valid string.

TestCert

 

Returns

Return

Type

Description

Possible values

Example

cert

string

The contents of the certificate.

A valid certificate file in Base64 PEM format.

 

text

string

 The parsed information from the OpenSSL command-line tool.

A valid string.

 

details

 hash

A hash of the certificate's details.

This hash includes theis_self_signed, modulus,notbefore, notafter, domains, andkey_algorithm,signature_algorithm, andvalidation_type returns and thesubject and issuer hashes.

 

is_self_signed

 Boolean 

Whether the certificate is self-signed.

The functionreturns this value in the detailshash.

  • 1 — Self-signed.
  • 0 — Not self-signed.

1

validation_type

string

The certificate's validation type.

Note:

We introduced this return in cPanel & WHM version 56.

The function returns this value in the detailshash.

  • ev — Extended Validation.
  • ov — Organization Validation.
  • dv — Domain Validation.
  • undef — The system could not parse and determine the certificate's validation type.

dv

signature_algorithm

 

 

 

 

 

string

The signature algorithm of the certificate.

Note:

We introduced this return in cPanel & WHM version 56.

The function returns this value in the detailshash.

A valid OID hash algorithm name.

 sha256WithRSAEncryption

subject

hash

A hash of the certificate's ownership details.

The functionreturns this hash in the detailshash.

This hash includes the commonName,stateOrProvinceName,organizationName, emailAddress,countryName, and localityNamereturns.

 

commonName

string

The certificate's Common Name or Distinguished Name.

The functionreturns this value in the subjecthash.

A valid domain name.

example.com

stateOrProvinceName

string

The certificate's state or province name.

The functionreturns this value in the subjecthash.

A valid string.

Texas

organizationName

string

The certificate's organization name.

The functionreturns this value in the subjecthash.

A valid string.

Organization

emailAddress

string

The certificate's email address.

The functionreturns this value in the subjecthash.

A valid email address.

username@example.com

countryName

string

The certificate's country.

The function returns this value in the subjecthash.

A valid two-letter ISO-3166 country code.

US

localityName

string

The certificate's locality or city.

The functionreturns this value in the subjecthash.

A valid string.

Houston

modulus

string

The certificate's modulus.

The functionreturns this value in the detailshash.

A valid string.

 

issuer

hash

A hash of the issuer's details.

The functionreturns this value in the detailshash.

This hash includes the commonName,stateOrProvinceName,organizationName, emailAddress,countryName, and localityNamereturns.

 

commonName

string

The issuer's Common Name or Distinguished Name.

The functionreturns this value in the issuerhash.

A valid domain name.

example.com

 stateOrProvinceName 

string

The issuer's state or province name.

The functionreturns this value in the issuerhash.

A valid string.

Texas

organizationName

string

The issuer's organization name.

The functionreturns this value in the issuerhash.

A valid string.

Organization

emailAddress

string

The issuer's email address.

The functionreturns this value in the issuerhash.

A valid email address.

username@example.com

countryName

string

The certificate's country.

The functionreturns this value in the issuerhash.

A valid two-letter ISO-3166 country code.

US

localityName

string

The issuer's locality or city.

The functionreturns this value in the issuerhash.

A valid string.

Houston

not_before

integer

The certificate's start time.

The functionreturns this value in the detailshash.

A date in Unix time format.

1365633490

not_after

integer

The certificate's expiration time.

The functionreturns this value in the detailshash.

A date in Unix time format.

1397169490

domains

string

The certificate's domains or list of domains.

The functionreturns this value in the detailshash.

A valid domain or list of domains.

example.com

key_algorithm

string

The certificate's method of encryption.

The functionreturns this value in the detailshash.

A valid string.

rsaEncryption

id

string

The certificate's ID.

A valid string.

 

friendly_name

string

The certificate's friendly name.

A valid string.

TestCert

 

  • 17 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....