실행시 설정

이 함수의 작동은 php.ini 설정에 영향을 받습니다.

openssl 설정 옵션
이름 기본값 가변성 Changelog
openssl.cafile "" PHP_INI_PERDIR Available since PHP 5.6.0.
openssl.capath "" PHP_INI_PERDIR Available since PHP 5.6.0.
PHP_INI_* 모드에 대한 상세와 정의는 Where a configuration setting may be set를 참고하십시오.

위 설정 지시어에 대한 간단한 설명입니다.

openssl.cafile string

Location of Certificate Authority file on local filesystem which should be used with the verify_peer context option to authenticate the identity of the remote peer.

openssl.capath string

If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory.

See also the SSL stream context options.

add a note add a note

User Contributed Notes 3 notes

up
2
mmi at uhb-consulting dot de
6 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
6 years ago
above code should be corrected to:

                    $Destfile= $ParsedCertificatePbject["hash"].".0";
                    $TargetFilename = dirname($Sourcefile)."/".$Destfile;
up
-9
mmi at uhb-consulting dot de
6 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