cPanel API 2 Functions - SSL::listcrts

Description

This function lists the account's SSL certificates.

Warning:

We strongly recommend that you use the following UAPI function instead of this function:

  • SSL::list_certs — This function lists an account's certificates.

Examples 


 WHM API (JSON)

https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=SSL&cpanel_jsonapi_func=listcrts

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Retrieve a list of SSL certificates.
$list_certificates $cpanel->api2(
    'SSL''listcrts'
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# Retrieve a list of SSL certificates.
my $list_certificates $cpliveapi->api2(
    'SSL''listcrts',
);

 cPanel Tag System (deprecated)

Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We strongly recommend that you only use theLiveAPI system to call the cPanel APIs.

cPanel API 2 calls that use cPanel tags vary widely in code syntax and in their output. For more information, read ourDeprecated cPanel Tag Usage documentation. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.


 Command Line

cpapi2 --user=username SSL listcrts

 

Notes:

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

 Output (JSON)

{
  "cpanelresult": {
    "apiversion": 2,
    "func": "listcrts",
    "data": [
      {
        "ssltxt": "Certificate:\n    Data:\n        Version: 3 (0x2)\n        Serial Number:\n            01:7e:9c:d4:f7\n    Signature Algorithm: sha1WithRSAEncryption\n        Issuer: CN = example.com, OU = Company Division, C = US, O = \"Company\", ST = State, L = City\n        Validity\n            Not Before: Oct  6 18:36:57 2014 GMT\n            Not After : Oct  6 18:36:57 2015 GMT\n        Subject: CN = example.com, OU = Company Division, C = US, O = \"Company", ST = State, L = City\n        Subject Public Key Info:\n            Public Key Algorithm: rsaEncryption\n                Public-Key: (2048 bit)\n                Modulus:\n                    00:d1:d7:80:05:80:67:e8:87:63:eb:e9:ee:92:d3:\n                    55:b3:61:10:06:0e:5e:4a:87:58:f4:da:9f:fe:57:\n                    42:85:d4:97:46:59:92:d0:a7:4b:ec:c0:ff:29:55:\n                    04:ee:83:ec:91:72:39:b6:ee:1f:00:af:c4:b7:57:\n                    56:f9:39:dc:c7:cc:65:cd:96:77:bc:78:56:de:c9:\n                    38:32:6a:37:1d:e1:58:f5:28:a3:fb:85:26:c4:41:\n                    96:20:2c:47:0f:a5:97:9b:56:5a:f6:68:18:1a:9a:\n                    ee:9b:17:d5:04:2e:04:4e:f7:bd:ee:18:0f:bd:20:\n                    9b:00:07:5c:86:c9:19:4a:f8:eb:f6:fd:10:f7:15:\n                    a2:25:7b:f2:29:11:f0:0c:80:43:52:08:75:dd:f9:\n                    95:cd:bd:5e:bd:5a:fc:62:c6:75:a6:59:c4:ff:3b:\n                    79:5c:89:fe:ed:21:2c:f4:1e:c0:02:43:67:2c:5d:\n                    a1:12:05:b2:43:d6:a7:1b:95:6a:bd:c4:06:52:c1:\n                    49:5f:26:11:5e:00:9a:0f:58:0a:d8:94:24:e6:73:\n                    0e:a1:ec:a3:87:9b:85:98:9e:68:b4:c8:d5:60:7d:\n                    a6:04:8b:15:ee:f2:fc:70:37:41:53:01:65:ef:5b:\n                    33:38:22:39:88:8e:83:f7:88:4c:88:56:17:e6:52:\n                    0f:77\n                Exponent: 65537 (0x10001)\n        X509v3 extensions:\n            X509v3 Subject Key Identifier: \n                07:57:32:C2:9C:E4:AA:22:61:0E:8E:F8:8B:D9:D1:8B:0B:B2:EE:98\n            X509v3 Authority Key Identifier: \n                keyid:07:57:32:C2:9C:E4:AA:22:61:0E:8E:F8:8B:D9:D1:8B:0B:B2:EE:98\n\n            X509v3 Basic Constraints: \n                CA:TRUE\n    Signature Algorithm: sha1WithRSAEncryption\n         88:03:68:51:68:f0:49:6d:3e:5d:0c:30:64:7d:46:ac:cf:03:\n         3e:dd:1d:65:12:0c:b9:70:4c:63:59:fc:99:ba:0e:bc:94:19:\n         b5:59:b2:05:e0:86:0a:3b:4b:24:d4:27:34:cf:9c:33:4e:27:\n         61:44:16:e1:65:8a:27:48:85:6b:49:3f:07:ef:eb:e7:a6:e3:\n         45:a2:2e:3a:ee:30:16:95:d1:36:a0:e7:ee:65:29:2f:c7:ae:\n         22:c9:7f:e4:6f:66:ff:79:ec:e2:02:0e:0a:18:31:d8:72:aa:\n         6c:27:cb:9f:65:e7:b9:21:a3:93:de:23:2e:75:7b:71:ac:16:\n         55:b4:a7:bf:a3:ed:4e:9d:87:b6:81:85:38:78:3f:e1:cc:1e:\n         bd:da:f3:ae:b1:66:75:ab:1c:43:2e:46:ee:81:8c:26:f8:38:\n         d9:48:a0:6c:60:a3:ac:61:3e:52:67:b0:88:1f:0f:21:b0:c0:\n         fd:89:f1:ae:4d:3e:9e:6a:c9:89:fe:fb:af:71:22:40:aa:89:\n         b5:0e:10:8d:73:e8:11:ea:29:58:39:bc:0a:93:a3:ad:42:78:\n         52:c1:b7:54:09:bc:5e:c0:85:fb:b0:ab:bd:20:7f:35:7c:36:\n         d3:bf:42:f1:b6:37:55:ef:bd:a8:0c:0c:66:db:ba:1e:87:3f:\n         ca:74:78:50\n",
        "issuer": "example.com",
        "expiredate": "Oct  6 18:36:57 2015 GMT",
        "host": "example.com"
      }
    ],
    "event": {
      "result": 1
    },
    "module": "SSL"
  }
}

 

Note:

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

 

Parameters

This function does not accept parameters.

Returns

Return

Type

Description

Possible values

Example

ssltxt

string

The certificate data.

The certificate file contents.

 This data always begins with -----BEGIN CERTIFICATE----- and ends with -----END CERTIFICATE-----. 

 

issuer

string

 The signing authority that issued the certificate. 

The signing authority's hostname.

Note:

Self-signed certificates will return the account's primary domain.

example.com

 expiredate 

string

The certificate's expiration date.

A date and time, in Mon DD HH:MM:SS YYYY Zoneformat.

  • Mon — The month's three-letter abbreviation.
  • DD — The date.
  • HH:MM:SS — The hour, minute, and second.
  • YYYY — The four-digit year.
  • Zone — The three-letter timezone designator.

 Oct  6 18:36:57 2015 GMT 

host

string

The certificate's hostname.

A valid hostname.

example.com

reason

string

A reason for failure.

A string that describes the error.

This is an error message. 

result

 Boolean 

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.

1

 

  • 8 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....