PHP Classes

OpenSSL with PHP

Recommend this page to a friend!

      Crypt_OpenSSL  >  All threads  >  OpenSSL with PHP  >  (Un) Subscribe thread alerts  
Subject:OpenSSL with PHP
Summary:Signature Algorithm change from md5WithRSA to sha1WithRSA
Date:2011-09-05 07:50:42

  1. OpenSSL with PHP   Reply   Report abuse  
kerbarous - 2011-09-05 07:50:42
I want to make the Certificat using PHP's OpenSSL functions, yesterday I've managed to make but the Signature Algorithm md5WithRSAEncryption wear, I want it in the Signature Algorithm md5WithRSAEncryption be sha1WithRSAEncryption, can roughly ngak huh?.
Please help me...
This sample script that I've created :
$dn = array(
"countryName" => "ID",
"stateOrProvinceName" => "propinsi",
"localityName" => "kota",
"organizationName" => "oraganisasi",
"organizationalUnitName" => "unit",
"commonName" => "nama",
"emailAddress" => ""

$params = array(
'digest_alg' => 'sha1',
'x509_extensions' => 'v3_ca',
'req_extensions' => 'v3_req',
'private_key_bits' => 1024,

$private_key = openssl_pkey_new($params);
openssl_pkey_export($private_key,$private_key_stri ng,"password");

//generate certificate (to get a public key from it)
$csr = openssl_csr_new($dn, $private_key);
$cert = openssl_csr_sign($csr, null, $private_key, 365);

// get the private key

//get the public key from the certificate
openssl_x509_export($cert, $public_key_string);