'Error create Certificate 509 error with language PHP
I 'm trying to create a Certificate with language PHP, this is the code
$comN = "Nome Comune";
$on = "Nome Oragniazzationze";
$oun = "Oraganizazione Unit";
$mail = "email";
$ln = "NY";
$sopn = "IT";
$cn = "US";
//récupération des informations du certificat principal
$CAcrt = "certificat.crt";
$CAkey = array("cles.txt", "monmot2passe");
// Assigne les valeurs du nom distingué à utiliser avec le certificat.
$dn = array("countryName" => $cn, "stateOrProvinceName" => $sopn, "localityName" => $ln, "organizationName" => $on, "organizationalUnitName" => $oun, "commonName" => $comN, "emailAddress" => $mail);
// Génère les clés privée et publique
$privkey = openssl_pkey_new();
// Génère la requête de signature de certificat
$csr = openssl_csr_new($dn, $privkey);
// Cette commande crée une certificat signer par l'autorité supérieur valide 1 ans soit 365 jours
$sscert = openssl_csr_sign($csr, $CAcrt, $CAkey, 365);
// préserver la clé privée, la CSR et le certificat auto-signé,
//de façon à ce qu'ils puissent être installés sur le site internet.
// éléments dans des fichiers.
// Typiquement, l'autorité de certification émettra un "vrai" certificat.
openssl_csr_export_to_file($csr, "requeteSignaturePerso" . $comN . ".txt");
openssl_x509_export_to_file($sscert, "certificatPerso" . $comN . ".txt");
openssl_pkey_export_to_file($privkey, "clesPerso" . $comN . ".txt");
// Affiche les erreurs qui sont survenues
while (($e = openssl_error_string()) !== false) {
echo $e . "\n";
}
}
but i obtain this error to video
error:0906D06C:PEM routines:PEM_read_bio:no start line
someone know the solutions?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
