PHP 8.3.4 Released!

Configuration à l'exécution

Le comportement de ces fonctions est affecté par la configuration dans le fichier php.ini.

openssl Options de configuration
Nom Défaut Modifiable Historique
openssl.cafile "" INI_PERDIR  
openssl.capath "" INI_PERDIR  
Pour plus de détails sur les modes INI_*, reportez-vous à Où une directive de configuration peut être modifiée.

Voici un éclaircissement sur l'utilisation des directives de configuration.

openssl.cafile string

Emplacement du fichier Certificate Authority sur le système de fichier local qui devrait être utilisé avec l'option de contexte verify_peer pour authentifier l'identité du pair distant.

openssl.capath string

Si cafile n'est pas spécifié ou si le certificat n'y est pas trouvé, le dossier pointé par capath est fouillé pour un certificat convenable. capath doit être un répertoire de certificat correctement haché.

Voir aussi les options du contexte de flux SSL.

add a note

User Contributed Notes 3 notes

up
1
mmi at uhb-consulting dot de
5 years ago
in capath the Certificates must be placed with the certificates hash as name and .0 as Ending.

Here is how to get the hashes from Certificates lying in this folder and automatically rename them in a correct way:
<?php
$paths
=openssl_get_cert_locations();
$allowed=array("cer","crt","pem");
if (!empty(
$paths['ini_capath'])){
$capathDirectory = dir($paths['ini_capath']);
while (
false !== ($entry = $capathDirectory->read())) {
$Sourcefile=$paths['ini_capath']."/".$entry;
if (
file_exists( $Sourcefile)){
$path_parts = pathinfo($Sourcefile);
if (
in_array(strtolower($path_parts['extension']),$allowed)){
$ParsedCertificatePbject = openssl_x509_parse(file_get_contents($Sourcefile));
$Sourcefile= $ParsedCertificatePbject["hash"].".0";
$TargetFilename = dirname($Sourcefile)."/".$Sourcefile;
if (!
file_exists($TargetFilename)) {
rename ($Sourcefile ,$TargetFilename);
}
}
}
}
$capathDirectory->close();
}
?>
up
0
ofrick at bluewin dot ch
5 years ago
above code should be corrected to:

$Destfile= $ParsedCertificatePbject["hash"].".0";
$TargetFilename = dirname($Sourcefile)."/".$Destfile;
up
-19
mmi at uhb-consulting dot de
5 years ago
Hashed directory bedeutet die Dateinamen müssen mit dem Openssl hash, den ihr mittels openssl_x509_parse im Wert hash bekommt (Name) + die Dateiendung 0.
Bei doppelten HASH werten wird die Dateiendung incrementiert.
To Top