0
我試圖使用PHP中的Curl連接到一個單一登錄API 但我得到一個-8018錯誤。 我將私鑰轉換爲RSA密鑰。但我仍然是一個錯誤。PHP捲曲錯誤:無法加載客戶端證書-8018。 (連接到SSO API)
這裏是PHP源:
$cert_file = 'etc/pki/nssdb/new.pem';
$cert_password = '123456';
curl_setopt_array($curl, array(
CURLOPT_URL => "UUL"
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 300,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_SSLCERT => $cert_file,
CURLOPT_SSLCERTPASSWD => $cert_password,
CURLOPT_SSLCERTTYPE => 'pem',
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"X-IAS-APIKEY: PEdk3kOkMtYsYzfb",
'Content-Length: 0',
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
}
下面是結果(添加在NSS DB證書後)