27 lines
753 B
PHP
27 lines
753 B
PHP
|
<?php
|
||
|
|
||
|
require('./config.php');
|
||
|
|
||
|
$dn = array(
|
||
|
"countryName" => "FR",
|
||
|
"stateOrProvinceName" => "Sophia",
|
||
|
"localityName" => "Valbonne",
|
||
|
"organizationName" => "iut",
|
||
|
"organizationalUnitName" => "iut_iotia",
|
||
|
"commonName" => "b",
|
||
|
"emailAddress" => "iut@univ.fr"
|
||
|
);
|
||
|
|
||
|
$pk = openssl_pkey_new($config);
|
||
|
$req = openssl_csr_new($dn, $pk, $config);
|
||
|
$certif = openssl_csr_sign($req, null, $pk, (365*3), $config);
|
||
|
$exportCertif = openssl_x509_export_to_file($certif, "./a/certificat");
|
||
|
$exportReq = openssl_csr_export_to_file($req, "./a/requete");
|
||
|
$exportKey = openssl_pkey_export_to_file($pk, "./a/clePrivee", null, $config);
|
||
|
|
||
|
echo "Certificat exporté<br />";
|
||
|
echo "Requête exportée<br />";
|
||
|
echo "Clée privée exportée<br />";
|
||
|
|
||
|
|