Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

Fetch SSL Information — fetchsslinfo

This function displays the SSL certificate, private key, and CA bundle/intermediate certificate associated with a specified domain. Alternatively, it can display the private key and CA bundle associated with a specified SSL certificate.

Calling Functions

Using the XML API

To use the XML API to perform the fetchsslinfo function from within your custom script:

  • Append the /xml-api/fetchsslinfo function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/xml-api/fetchsslinfo

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Using the JSON API

To use the JSON API to perform the fetchsslinfo function from within your custom script:

  • Append the /json-api/fetchsslinfo function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/json-api/fetchsslinfo

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Variables

Input

The fetchsslinfo function takes the following variables as input. You must specify one of these variables:
  • domain (string) — Domain name whose SSL information you wish to retrieve.
  • crtdata (string) — Specific SSL certificate you wish to retrieve (the SSL certificate must be URL-encoded).

Output

Show Hide
  • fetchsslinfo — Root-level XML tag for the output of the fetchsslinfo function.
    • sslinfo — Container for SSL certificate information.
      • key (string) — Private key.
      • cab (string) — CA bundle/intermediate certificate.
      • crt (string) — SSL certificate.
      • domain (string) — Domain name.
      • ip (string) — IP address where the SSL certificate is installed.
      • status (boolean) — Status of the fetchsslinfo request.
        • 1 — success.
        • 0 — failure.
      • statusmsg (string) — Details about the status of the request.
      • user (string) — User associated with the SSL certificate.

Examples

XML API

Show Hide

Calling https://example.com:2087/xml-api/fetchsslinfo?domain=example.com in WebHost Manager will produce output similar to the following:

<fetchsslinfo>
  	<sslinfo>
		<key>-----BEGIN RSA PRIVATE KEY-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		-----END RSA PRIVATE KEY-----
		</key>
		<cab>-----BEGIN CERTIFICATE-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z2
		 A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.......
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z2
		 A04vg7axd93FBUEMXqJCgb/cSV88Gu
		-----END CERTIFICATE-----
		</cab>
		<crt>-----BEGIN CERTIFICATE-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z2
		 A04vg7axd93FBUEMXqJCgb/cSV88Gu
		........
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z2
		 A04vg7axd93FBUEMXqJCgb/cSV88Gu
		-----END CERTIFICATE-----
		</crt>
    		<domain>example.com</domain>
	    	<ip>127.0.0.1</ip>
	    	<status>1</status>
	    	<statusmsg>ok</statusmsg>
	    	<user>joe</user>
	</sslinfo>
</fetchsslinfo>

JSON API

Show Hide

Calling the following function in WebHost Manager: https://example.com:2087/json-api/fetchsslinfo?domain=example.com in WebHost Manager will produce output similar to the following:

{
   "sslinfo":[
      {
         "ip":"127.0.0.1",
         "status":1,
         "statusmsg":"ok",
         "crt":"-----BEGIN CERTIFICATE-----
 		 gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		2A04vg7axd93FBUEMXqJCgb/cSV88Gu\n
 		 -----END CERTIFICATE-----\n",
         "domain":"example.com",
         "user":"joe",
         "key":"-----BEGIN RSA PRIVATE KEY-----
 		 gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		2A04vg7axd93FBUEMXqJCgb/cSV88Gu\n
 		 -----END RSA PRIVATE KEY-----\n",
         "cab":"-----BEGIN CERTIFICATE-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z2
		 A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.......
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z2
		 A04vg7axd93FBUEMXqJCgb/cSV88Gu
		-----END CERTIFICATE-----\n"
      }
   ]
}

Topic revision: r6 - 29 Sep 2009 - 19:07:54 - MelanieSeibert