CakeFest 2024: The Official CakePHP Conference

Configuración en tiempo de ejecución

El comportamiento de estas funciones se ve afectado por la configuración de php.ini.

openssl Opciones de configuración
Nombre Por defecto Cambiable Registro de cambios
openssl.cafile "" INI_PERDIR Disponible desde PHP 5.6.0.
openssl.capath "" INI_PERDIR Disponible desde PHP 5.6.0.
Para más detalles y definiciones de los modos de INI_*, vea Dónde se puede realizar un ajuste de configuración.

He aquí una breve explicación de las directivas de configuración.

openssl.cafile string

Ubicación del fichero de la Autoridad de certificación (AC) en el sistema de ficheros local que debería emplearse con la opción de contexto verify_peer para autenticar la identidad del par remoto.

openssl.capath string

Si no se especifica cafile o si el certificado no se encuentra allí, se busca un certificado apropiado en el directorio al que apunta capath. capath debe ser un directorio de certificados con hash correcto.

Véase también las opciones de contexto de flujo de 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