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

Generate SSLCertificate — generatessl

This function generates an SSL certificate.

Calling Functions

Using the XML API

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

  • Append the /xml-api/generatessl 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/generatessl

  • 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 generatessl function from within your custom script:

  • Append the /json-api/generatessl 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/generatessl

  • 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 generatessl function takes the following required variables as input.
  • xemail (string) — Email address to which the certificate will be sent.
  • host (string) — Domain with which the SSL certificate will be associated.
  • country (string) — Country in which your organization is located.
  • state (string) — State in which your organization is located.
  • city (string) — City in which your organization is located.
  • co (string) — Name of your organization.
  • cod (string) — Name of the department associated with the SSL certificate.
  • email (string) — Email address of the domain owner.
  • pass (string) — Password associated with the SSL certificate.

Output

Show Hide

  • generatessl (string) — Root-level XML tag for the output of the generatessl function.
    • results (string) — Container for the results of the generatessl request.
      • key (string) — Private key.
      • args (string) — Container for the attributes of the SSL certificate.
        • city (string) — City in which your organization is located.
        • co (string) — Name of your organization.
        • cod (string) — Name of the department associated with the SSL certificate.
        • country (string) — Country in which your organization is located.
        • email (string) — Email address of the domain owner.
        • host (string) — Domain with which the SSL certificate is associated.
        • keysize (string) — The size of the private key, in bits.
        • pass (string) — Password associated with the SSL certificate.
        • state (string) — State in which your organization is located.
        • xemail (string) — Email to which the certificate was sent.
        • cert (string) — Contents of the SSL certificate.
        • certfile (string) — Location of the certificate on the server.
        • csr (string) — Content of the certificate signing request.
        • csrfile (string) — Location of the certificate signing request on the server.
        • email_message (string) — If the certificate was emailed, the address to which it was emailed.
        • email_status (boolean) — Whether or not the certificate was emailed.
        • fglob (string) — Internal variable for WHM communication.
        • file_test (string) — Internal variable for WHM communication.
        • includes (string) — Internal variable for WHM communication.
        • keyfile (string) — Location of the private key on the server.
        • message (string) — Detailed results of the request.
        • sender (string) — Internal variable for WHM communication.
        • sender_host (string) — Internal variable for WHM communication.
        • status (boolean) — Result of the SSL certificate generation request.
          • 1 — success.
          • 0 — failure.
        • statusmsg (string) — Information about the status of the request.
        • uniq (string) — Internal variable for WHM communication.
        • wildcard_safe (string) — Internal variable for WHM communication.

Examples

XML API

Show Hide

Calling https://example.com:2087/xml-api/generatessl?xemail=owner@example.com&host=example.com &country=US&state=TX&city=Houston&co=Domain%20LLC&cod=Web&pass=password&email=admin@example.com in WebHost Manager will produce output similar to:

<generatessl>
      <results>
	    <key>
		-----BEGIN RSA PRIVATE KEY-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		-----END RSA PRIVATE KEY-----
            </key>
	    <args>
	        <city>Houston</city>
	        <co>Domain LLC</co>
	        <cod>Web</cod>
	        <country>US</country>
	        <email>admin@example.com</email>
	        <host>example.com</host>
	         <keysize>1024</keysize>
	        <pass>password</pass>
	        <state>TX</state>
	        <xemail>owner@domain.com</xemail>
	    </args>
	    <cert>
		-----BEGIN CERTIFICATE-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		-----END CERTIFICATE-----
	    </cert>
	    <certfile>/usr/share/ssl/certs/example.com.crt</certfile>
	    <csr>
	        -----BEGIN CERTIFICATE REQUEST-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		-----END CERTIFICATE REQUEST-----
	    </csr>
	    <csrfile>/usr/share/ssl/certs/example.com.csr</csrfile>
	    <email_message>CSR email sent to test@example.com</email_message>
	    <email_status>1</email_status>
	    <fglob>DUMMY</fglob>
	    <file_test>DUMMY</file_test>
	    <includes />
	    <keyfile>/usr/share/ssl/private/example.com.key</keyfile>
	    <message>Key, Certificate, and CSR generated OK</message>
	    <sender>admin</sender>
	    <sender_host>host.example.com</sender_host>
	    <status>1</status>
	    <statusmsg>Key, Certificate, and CSR generated OK</statusmsg>
	    <uniq>DUMMY</uniq>
	    <wildcard_safe>DUMMY</wildcard_safe>
      </results>
</generatessl>

JSON API

Show Hide

Calling https://example.com:2087/json-api/generatessl?xemail=owner@example.com &host=example.com&country=US&state=TX&city=Houston&co=Domain%20LLC &cod=Web&pass=password&email=admin@example.com in WebHost Manager will produce output similar to:

{
   "results":{
      "cert":"-----BEGIN CERTIFICATE-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		 -----END CERTIFICATE-----\n",
      "wildcard_safe":"DUMMY",
      "file_test":"DUMMY",
      "status":1,
      "csrfile":"/etc/ssl/certs/example.com.csr",
      "args":{
         "keysize":1024,
         "state":"TX",
         "country":"US",
         "xemail":"owner@example.com",
         "host":"example.com",
         "cod":"Web",
         "city":"Houston",
         "pass":"password",
         "co":"Domain LLC",
         "email":"admin@example.com"
      },
      "email_message":"CSR email sent to owner@example.com",
      "csr":"-----BEGIN CERTIFICATE REQUEST-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu,
		\n-----END CERTIFICATE REQUEST-----\n",
      "key":"-----BEGIN RSA PRIVATE KEY-----
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		.............
		gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
		 2A04vg7axd93FBUEMXqJCgb/cSV88Gu
		 -----END RSA PRIVATE KEY-----\n",
      "fglob":"DUMMY",
      "uniq":"DUMMY",
      "keyfile":"/etc/ssl/private/example.com.key",
      "includes":{

      },
      "message":"Key, Certificate, and CSR generated OK",
      "statusmsg":"Key, Certificate, and CSR generated OK",
      "certfile":"/etc/ssl/certs/example.com.crt",
      "sender_host":"host.example.com",
      "email_status":1,
      "sender":"admin"
   }
}

Topic revision: r6 - 16 Aug 2011 - 15:57:23 - Main.JustinSchaefer