The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Generate SSL For Cpanel

Discussion in 'cPanel Developers' started by krisrmgua, Mar 2, 2007.

  1. krisrmgua

    krisrmgua Registered
    PartnerNOC

    Joined:
    Mar 2, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Im trying to write somecode to generate the KEY and CSR myself from a file on the site that needs the SSL. Yet when i generate the KEY with my code and copy it into cpanel for the key i get a message that Cpanel cant determin the host for the key. So i was wondering if anyone knows anything about the code on how to generate the key and csr? I am trying with php with this code

    Code:
    $ssl_configargs = array(
    "digest_alg" => "sha1",
    "private_key_bits" => 1024,
    "private_key_type" => OPENSSL_KEYTYPE_RSA,
    "encrypt_key" => false
    );
    $dn = array(
       "countryName" => "US",
       "stateOrProvinceName" => "CA",
       "localityName" => "domain",
       "organizationName" => "place",
       "organizationalUnitName" => "23",
       "commonName" => "www.mydomain.com",
       "emailAddress" => "test@mydomain.com"
    );
    
    $numberofdays = "365";
    
    $pkey = openssl_pkey_new( $ssl_configargs );
    $csr = openssl_csr_new( $dn, $privkey, $ssl_configargs );
    $sscert = openssl_csr_sign( $csr, null, $privkey, $numberofdays );
    
    openssl_csr_export( $csr, $csrout );
    openssl_x509_export( $sscert, $certout );
    openssl_pkey_export( $privkey, $pkeyout);
    
    
    Anyone have any suggestions?
     
Loading...

Share This Page