/usr/bin/openssl req -x509 -newkey rsa:2048 -keyout server.key -out server.cert -days 365 -nodes -subj "/C=$countryCode/ST=$state/L=$location/O=$organization/OU=$orgUnit/CN=$hostname"Just a note, on 32-bit systems, OpenSSLs' use of time_t routine to calculate the epoch is limited to the year 2038 so your -days variable cannot exceed this date or the cert expiration will roll back in time and already be expired. 64-bit systems are not hindered with this limitation.
Showing posts with label SSL. Show all posts
Showing posts with label SSL. Show all posts
Thursday, April 4, 2013
How To Create A SSL Self-Signed Certificate, One-Liner
You'll need to change the values inside the -subj variable to suit your needs.
Thursday, March 28, 2013
Verify SSL Certificate And CSR Match
openssl x509 -noout -modulus -in server.crt | openssl md5 openssl req -noout -modulus -in server.csr | openssl md5
Verify SSL Private Key And Certificate Match
openssl x509 -noout -modulus -in server.crt | openssl md5 openssl rsa -noout -modulus -in server.key | openssl md5
Verify SSL Private Key And CSR Match
Compare the output from the following:
openssl rsa -noout -modulus -in server.key | openssl md5 openssl req -noout -modulus -in server.csr | openssl md5This can also be accomplished in PHP using:
<php //CERTIFICATE INFORMATION $dn = array( "countryName" => $countryName, "stateOrProvinceName" => $stateOrProvinceName, "localityName" => $localityName, "organizationName" => $organizationName, "organizationalUnitName" => $organizationalUnitName, "commonName" => $commonName, "emailAddress" => $emailAddress ); //GENERATE NEW PRIVATE KEY $priv = openssl_pkey_new(); //GENERATE CSR $csr = openssl_csr_new($dn, $priv); //LOAD DETAILS $privDetails = openssl_pkey_get_details($priv); $csrDetails = openssl_pkey_get_details(openssl_csr_get_public_key($csr)); //OUTPUT echo md5($privDetails['rsa']['n']); echo md5($csrDetails['rsa']['n']); ?>
How To Create A SSL Self-Signed Certificate
openssl genrsa -out ca.key 2048 openssl req -new -key ca.key -out ca.csr openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
How To Create A SSL CSR Certificate Signing Request
openssl genrsa -out ca.key 2048 openssl req -new -key ca.key -out ca.csr
Friday, February 1, 2013
Subscribe to:
Posts (Atom)