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

 

Description

This function generates a private key file, a Certificate Signing Request (CSR), and a self-signed SSL certificate.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/generatessl?xemail=user@example.com&host=example.com&country=US&state=Texas&city=Houston&co=The%20Justice%20League&cod=Aquaman%27s%20Wading%20Pool&email=user@example.com&pass=12345luggage&keysize=2048
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/generatessl?xemail=user@example.com&host=example.com&country=US&state=Texas&city=Houston&co=The%20Justice%20League&cod=Aquaman%27s%20Wading%20Pool&email=user@example.com&pass=12345luggage&keysize=2048
 Command Line
whmapi0 generatessl xemail=user@example.com host=example.com country=US state=Texas city=Houston co="The Justice League" cod="Aquaman's Wading Pool" email=user@example.com pass=12345luggage keysize=2048

Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
   "results":{
      "statusmsg":"Key, Certificate, and CSR generated OK",
      "csr_id":"example_com_d7f16_18985_3de1922971c6654c97a80fb68a0e42b4",
      "cert":"-----BEGIN CERTIFICATE-----
        gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
         2A04vg7axd93FBUEMXqJCgb/cSV88Gu
        .............
        gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
         2A04vg7axd93FBUEMXqJCgb/cSV88Gu
         -----END CERTIFICATE-----\n",
      "key_id":"d7f16_18985_49a8e3c92b057fe6105ef388c0e10c3f",
      "status":1,
      "args":{
         "state":"TX",
         "country":"US",
         "xemail":"owner@example.com",
         "host":"example.com",
         "cod":"Web",
         "city":"Houston",
         "pass":"password",
         "co":"Domain LLC",
         "email":"admin@example.com",
		 "keysize":"2048"
      },
      "csrfile":"/etc/ssl/certs/example.com.csr",
      "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",
      "file_test":"DUMMY",
	  "fglob":"DUMMY",
      "uniq":"DUMMY",
	  "includes":"DUMMY",
	  "wildcard_safe":"DUMMY",
      "keyfile":"/var/cpanel/ssl/system/keys/d7f16_18985_49a8e3c92b057fe6105ef388c0e10c3f.key",
      "message":"Key, Certificate, and CSR generated OK",
      "certfile":"/etc/ssl/certs/example.com.crt",
      "sender_host":"host.example.com",
      "email_status":1,
      "sender":"admin",
      "cert_id":"example_com_d7f16_18985_1519836779_d2bc8e47772377cf94a8b3bf57417f6e"
   }
}
 Output (XML)
   <results>
      <cert>
        -----BEGIN CERTIFICATE-----
        gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
         2A04vg7axd93FBUEMXqJCgb/cSV88Gu
        .............
        gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
         2A04vg7axd93FBUEMXqJCgb/cSV88Gu
        -----END CERTIFICATE-----
        </cert>
      <cert_id>example_com_d7f16_18985_1519836779_d2bc8e47772377cf94a8b3bf57417f6e</cert_id>
      <certfile>/var/cpanel/ssl/system/certs/example_com_d7f16_18985_1519836779_d2bc8e47772377cf94a8b3bf57417f6e.crt</certfile>
        <csr>
            -----BEGIN CERTIFICATE REQUEST-----
        gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
         2A04vg7axd93FBUEMXqJCgb/cSV88Gu
        .............
        gCJZqVg1ozhK1LZanRtlDm2EFA1xOjs5Z
         2A04vg7axd93FBUEMXqJCgb/cSV88Gu
        -----END CERTIFICATE REQUEST-----
        </csr>
      <csr_id>example_com_d7f16_18985_3de1922971c6654c97a80fb68a0e42b4</csr_id>
      <csrfile>/var/cpanel/ssl/system/csrs/example_com_d7f16_18985_3de1922971c6654c97a80fb68a0e42b4.csr</csrfile>
      <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>
        <pass>password</pass>
        <state>TX</state>
        <xemail>owner@domain.com</xemail>
		<keysize>2048</keysize>
      </args>
      <key_id>d7f16_18985_49a8e3c92b057fe6105ef388c0e10c3f</key_id>
      <file_test>DUMMY</file_test>
      <fglob>DUMMY</fglob>
      <file_test>DUMMY</file_test>
	  <includes>DUMMY</includes>
	  <wildcard_safe>DUMMY</wildcard_safe>
      <keyfile>/var/cpanel/ssl/system/keys/d7f16_18985_49a8e3c92b057fe6105ef388c0e10c3f.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>
   </results>

Parameters

ReturnTypeDescriptionPossible valuesExample
xemailstring

Required

The email address that will receive the certificate.

A valid email address.user@example.com
host string

Required

The certificate's domains.

A comma-delimited list of valid domain names.

example.com
countrystring

The certificate's country.

Note:

This parameter is required in cPanel & WHM 11.56 and earlier.

If you do not use this parameter, your CSR will not include this field.
A valid two-character ISO-3166 country code.US
statestring

The certificate's state or province name.

Note:

This parameter is required in cPanel & WHM 11.56 and earlier.

If you do not use this parameter, your CSR will not include this field.
A valid string that contains the full name of the state or province.Texas
citystring

The certificate's city or locality.

Note:

This parameter is required in cPanel & WHM 11.56 and earlier.

If you do not use this parameter, your CSR will not include this field.
A valid string that contains the full name of the city or locality.Houston
costring

The certificate's organization.

Note:

This parameter is required in cPanel & WHM 11.56 and earlier.

If you do not use this parameter, your CSR will not include this field.
A valid string.The Justice League
codstring

The department of the organization that owns the certificate.

If you do not use this parameter,   your CSR will not include this field.

A valid string.Aquaman's Wading Pool
emailstring

The certificate's contact email address.

If you do not use this parameter, your CSR will not include this field.

A valid email address.user@example.com
passstring

The certificate's passphrase.

This value defaults to null.

A valid and secure password.12345luggage
keysizeinteger

The size of the certificate's key.

If you do not use this parameter, your CSR will not include this field.

A valid positive integer that represents the size of the key, in bits.2048

Returns

ReturnTypeDescriptionPossible valuesExample

results

hash

A hash of certificate information.

The function returns this value in the generatessl hash.

This hash includes the certcertfile, csr, csrfile, key, argskeyfile, messagestatusmsg, includes, uniq, fglob, status, file_test, wildcard_safe, sender, email_status, and sender_host returns. 

cert

string

The certificate's text.

The function returns this value in the results hash.

A certificate file in Base64 PEM format.
 -----BEGIN CERTIFICATE----- MIIECTCCAvGgAwIBAgIJAIbGEXBsc2sUMA0GCSqGSIb3DQEBBQUAMIGaMRYwFAYD VQQDEw10ZXN0c2ltb24uY29tMRYwFAYDVQQLEw1Eb2N1bWVudGF0aW9uMQ4wDAYD VQQIEwVUZXhhczEPMA0GA1UEChMGY1BhbmVsMSgwJgYJKoZIhvcNAQkBFhlsYXVy ZW5jZS5zaW1vbkBjcGFuZWwubmV0MQswCQYDVQQGEwJVUzEQMA4GA1UEBxMHSG91 c3RvbjAeFw0xMzA3MTAxNzE1MTNaFw0xNDA3MTAxNzE1MTNaMIGaMRYwFAYDVQQD Ew10ZXN0c2ltb24uY29tMRYwFAYDVQQLEw1Eb2N1bWVudGF0aW9uMQ4wDAYDVQQI EwVUZXhhczEPMA0GA1UEChMGY1BhbmVsMSgwJgYJKoZIhvcNAQkBFhlsYXVyZW5j ZS5zaW1vbkBjcGFuZWwubmV0MQswCQYDVQQGEwJVUzEQMA4GA1UEBxMHSG91c3Rv bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOAFTOieEINwyBVq/3ie RkZiAE2LCSHqSm6w8u9LKvrnXDvEfMcWpNKDGf/ZlHaY0jSv3y1U7gjtJMU30PVV FiZZV+04Q+mYfWb5Qv53/zhGS5t2W5wYLvK2wvBPcLgzpCmyS5yDYHYbaMCMnSyt jCfvqutmxVfPY5B1kzHCssqhxDaN4XPpZKXfb56fK2U4p2lW+519urkKgBWWEaPl lNBvzT7KuNEFUjKKj8chM+Kl6NIb7iJQl5sxWav+nwlTxCjy4UIDJqXQZDM+HVTm s0RH6l3YzA9vkF0jYgNQMFq/JdK+K7c5cRGAySEeNcl6dMTJdyqKJcTMrywamct9 p4kCAwEAAaNQME4wHQYDVR0OBBYEFPMow0vJpeoHxiTVXtcnUeS6AyxgMB8GA1Ud IwQYMBaAFPMow0vJpeoHxiTVXtcnUeS6AyxgMAwGA1UdEwQFMAMBAf8wDQYJKoZI hvcNAQEFBQADggEBAHRf+O4RxoHAGLnfR73zeU43+dj8OmsXak7Or65K7ojEyYvl 1rjcqxsXfHt7W3xwOqLjmPHRzUwAklFOcyb2qQ+kpEUmXNwNlIwzgBSyK+rm1YdU y3iKhGQbVIoTPoQRQwTABp3B/1MQDcMcFsneQWeuHCHS9DhCYLcl5IgupzmACDyN YNIqb6fqo6RngY7k6AEX1wzwZjWxw71TeLAUJeYPPFjWDZuejlpa7UIHav0Dl447 rLRkvSYTTmnUwVj+oaejooc2NsxVDy9d/S9Rx0+k1B/i0LCQSV36XvvIzPHP1mYJ jpuRyTUqkCS9p1f45mCRUYF/fI4yEYOW2TNQEmw= -----END CERTIFICATE-----

certfile

string

The certificate's location.

The function returns this value in the results hash.

A valid absolute file path.
/var/cpanel/ssl/system/certs/example_com_e0054_da789_1405012513_401c27501f5e0dd8d1b1d9caa902a0c8.crt

csr

string

The CSR's text.

The function returns this value in the results hash.

A CSR file in  Base64 PEM  format.
-----BEGIN CERTIFICATE REQUEST----- MIIC4DCCAcgCAQAwgZoxFjAUBgNVBAMTDXRlc3RzaW1vbi5jb20xFjAUBgNVBAsT DURvY3VtZW50YXRpb24xDjAMBgNVBAgTBVRleGFzMQ8wDQYDVQQKEwZjUGFuZWwx KDAmBgkqhkiG9w0BCQEWGWxhdXJlbmNlLnNpbW9uQGNwYW5lbC5uZXQxCzAJBgNV BAYTAlVTMRAwDgYDVQQHEwdIb3VzdG9uMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A MIIBCgKCAQEA4AVM6J4Qg3DIFWr/eJ5GRmIATYsJIepKbrDy70sq+udcO8R8xxak 0oMZ/9mUdpjSNK/fLVTuCO0kxTfQ9VUWJllX7ThD6Zh9ZvlC/nf/OEZLm3ZbnBgu 8rbC8E9wuDOkKbJLnINgdhtowIydLK2MJ++q62bFV89jkHWTMcKyyqHENo3hc+lk pd9vnp8rZTinaVb7nX26uQqAFZYRo+WU0G/NPsq40QVSMoqPxyEz4qXo0hvuIlCX mzFZq/6fCVPEKPLhQgMmpdBkMz4dVOazREfqXdjMD2+QXSNiA1AwWr8l0r4rtzlx EYDJIR41yXp0xMl3KoolxMyvLBqZy32niQIDAQABoAAwDQYJKoZIhvcNAQEFBQAD ggEBAEaCn+rg6qlhp6SEKuZg1G6z1M+1XQoTN3E6bTdM3rD1wXjqtyFfYGTy5Bvv gUKrl6t312owJ2si8/K9v/ocVxdjc0rPWSOWScfSc1Od3i1L1YuqbboL2aQSak3y gpGnZMHCUED1y4xyABAFOaXUurFiZj5u3P2mBAYGt2ez2afiPlo5YpTRNCoTUlVz KNKkyUnptBLOvlwGgerBmOoP4QdVhTSuxO9TECsiPdldE1BVZrlFclDFvoP01jFZ WOTWz+k3O202gK4w/tPP2VMVldNFrC0QoENu85ohT1nJj6F3mrM1CZ+1c8zYzr+S 6aAXFhHE6FweeunRAGjEJggoTPo= -----END CERTIFICATE REQUEST-----

csrfile

string

The CSR's location.

The function returns this value in the results hash.

A valid absolute file path.
/var/cpanel/ssl/system/csrs/example_com_e0054_da789_96b6625681492b7c43844b6ec37764de.csr

key

string

The private key's text.

The function returns this value in the results hash.

A private key file in  Base64 PEM format.
 -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEA4AVM6J4Qg3DIFWr/eJ5GRmIATYsJIepKbrDy70sq+udcO8R8 xxak0oMZ/9mUdpjSNK/fLVTuCO0kxTfQ9VUWJllX7ThD6Zh9ZvlC/nf/OEZLm3Zb nBgu8rbC8E9wuDOkKbJLnINgdhtowIydLK2MJ++q62bFV89jkHWTMcKyyqHENo3h c+lkpd9vnp8rZTinaVb7nX26uQqAFZYRo+WU0G/NPsq40QVSMoqPxyEz4qXo0hvu IlCXmzFZq/6fCVPEKPLhQgMmpdBkMz4dVOazREfqXdjMD2+QXSNiA1AwWr8l0r4r tzlxEYDJIR41yXp0xMl3KoolxMyvLBqZy32niQIDAQABAoIBAQCmbGmhWmPsMeoC t1WJFxQgD4goE0U6k+Kt7vjbOt14Pk6v/B2yjaju1wSGpO59WLS4/XrwI2se6IXr mba7u3VUEgWXLriNHoLy7/SMNTs+ZEKhAMG36eNe3tVdT7busTag31r6sEMGGwCs IwpU+azosk0oylWLEX/m/uHWEs1eaIEWWWtgHB+KZrrP7Rr9RYfVQ144DxmOxS3C a9+mST62WqAVPR6POWGEfZqnZl/ePWZPcQYbFrhwnnefNoYBl/bnLZBo8rbNWxAq OEOuKfkrBzglKG/39WKPw8rj4JIVzY0yOuFCW6xCDWRkOrhU8Ol/3FvwDa3uJpkp mgPr4TgxAoGBAPGPLmxSuOYR97mDAXxrs037F2GCbqWvI6m7/ezWe9yn+bMpjSIW fsgtq4FsyqzPueEkDdQWi3xh6nu2WI/1Tl875opGAqEIJMqss/u11tnva5wzu1cC L6H85A5+HMOBvP3sm6CObKcVw92h7kxynVIUJJWhjfeZMN8gBFFpKIVFAoGBAO1p tXBmXLC/YKKvtHI3M16/ZopvM8ZqU2HcAHaw214Refw9JJ/e3/xTNfSerVTyCAQO 1AdWTzJKBN8jmSYv1Mk1D3RpQPNR7wVzi46KR081AU41uMpqIGVOwHtyVnW/ZfLr c1DLIK8Cx8aHfoxffwzoMO5SEQSooeZfOLhsfDN1AoGBAKQTUEINsj+75psgbAr6 ELGgItJ9yPBLVRr+cUzEpx9LDWVvjMihpP4NX1gq8EOPWT+ewLHVmmsjCyV6xw8J XXF8e2xif3in0m3D/wCzE7u2T06rKM3B017hKnrZmGoHnrqPU2osM4sOUpshWX6d v1Q4EF1+fbK3YCW+VpCBsB9NAoGAQo+uhNLODee56iKkzpjXWCsFTq6ar3hD5F3P 63buKdNwhd2GlSPhXFbf+7M5GWW6BZk6rMvv7EOAVice2uvyFm8/4/1WbmF8R+T7 LX1rPLO5p/m701QpvP11TabiwqRkqtSEQhSRF0AKTojSW/yyHCZFAawUhV/Z9EKi HmKb97kCgYAyzmFc2it0HqnsOnRybop603nqMtWGTQO4cxa93HUDpYajuK2K3Dfr xUj6lG3z/oKJGGE2JqgZ6LBAhNJtJWJu2ox3pKGE63QjLJnVwb8y1NFYpe/crbLe PuBwIR0L7drXxfv7O5btY7h6QI2d1/UIAQPAWbxLoTM+ndQ/uPEdfA== -----END RSA PRIVATE KEY-----

args

hash

A hash of the parameters that generate the certificate.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this hash in the results hash.

This hash includes the xemail, host, country, state, citycocod, email , and pass returns. 

xemail

string

The email address that will receive the certificate.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

A valid email address.user@example.com

host

string

The certificate's domains.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

A comma-delimited list of valid domain names.

example.com

country

string

The certificate's country.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

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

state

string

The certificate's state or province name.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

A valid string that contains the full name of the state or province.Texas

city

string

The certificate's city or locality.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

A valid string that contains the full name of the city or locality.Houston

co

string

The certificate's organization.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

A valid string.The Justice League

cod

string

The department in the certificate's organization.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

A valid string.Aquaman's Wading Pool

email

string

The certificate's contact email address.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

A valid email address.user@example.com

pass

string

The certificate's passphrase.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the args hash.

A secure password.12345luggage

keyfile

string

The private key's location.

The function returns this value in the results hash.

A valid absolute file path.
/var/cpanel/ssl/system/keys/e0054_da789_101721a053024156a34e0df8a9c388d4.key

message

string

Detailed results of the request.

The function returns this value in the results hash.

A valid string.
Key, Certificate, and CSR generated OK

statusmsg

string

Information about the status of the request.

The function returns this value in the results hash.

A valid string.
Key, Certificate, and CSR generated OK

includes

string

Internal variable for WHM communication.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the results hash.

  

uniq

string

Internal variable for WHM communication.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the results hash.

  

fglob

string

Internal variable for WHM communication.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the results hash.

  

status

Boolean

Whether the function succeeded.

The function returns this value in the results hash.

  • 1 — Success.
  • 0 — Failure.
1

file_test

string

Internal variable for WHM communication.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the results hash.

  

wildcard_safe

Boolean

Internal variable for WHM communication.

Note:

We removed this return in cPanel & WHM 11.50.

The function returns this value in the results hash.

  

sender

string

The username that generated the request.

The function returns this value in the results hash.

A valid username.
admin

sender_host

string

The host that generated the request.

The function returns this value in the results hash.

A valid hostname.
hostname.example.com