<code><?php
error_reporting(-1);
function dump($Var) {
echo "<hr/><pre>";
var_dump($Var);
echo "
";} функция check_errors () {echo"
";
$Count = 0;
while (($e=openssl_error_string())!==false) {
echo $e."<br>";
$Count++;
}
if ($Count==0)
echo "No error";
echo "
";} $ Configs = array (" config "=>" e: /progetti/php/openssl/openssl.cfg "," digest_alg "=>" sha1 "," x509_extensions "=>" v3_ca "," req_extensions "=> "v3_req", "private_key_bits" => 1024, "private_key_type" => OPENSSL_KEYTYPE_RSA, "encrypt_key" => true, "encrypt_key_cipher" => OPENSSL_CIPHER_3DES); $ Info = массив ("countryName" => "имя_приложения",> VR "," VR ",>"=>" Ханой "," localityName "=>" Long Bien "," organizationName "=>" Тестовая компания "," organizUnitName "=>" Отдел тестирования "," commonName "=>" Tester "," emailAddress "=> "test@gmail.com"); $ Private_Key = null; $ Unsigned_Cert = openssl_csr_new ($ Info, $ Private_Key, $ Configs); check_errors (); dump ($ Private_Key); dump ($ Unsigned_Cert); $ Signed_Cert = openssl_csr_sign($ Unsigned_Cert, null, $ Private_Key, 365, $ Configs); check_errors (); dump ($ Signed_Cert); openssl_pkcs12_export_to_file ($ Signed_Cert, "test.p12", $ Private_Key, "123456"); check_errors (); 100;*