CakeFest 2024: The Official CakePHP Conference

実行時設定

php.ini の設定により動作が変化します。

openssl 設定オプション
名前 デフォルト 変更可能 変更履歴
openssl.cafile "" INI_PERDIR  
openssl.capath "" INI_PERDIR  
INI_* モードの詳細および定義については どこで設定を行うのか を参照してください。

以下に設定ディレクティブに関する 簡単な説明を示します。

openssl.cafile string

ローカルファイルシステム上の証明書ファイルの場所。 verify_peer コンテキストオプションで リモートサーバーとの認証の際に使用します。

openssl.capath string

cafile が指定されていなかったりその場所にファイルが 見つからなかったりした場合、capath が指す ディレクトリを検索して認証ファイルを探します。capath は認証ファイルのディレクトリを正確に指している必要があります。

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