PHP 8.3.4 Released!

openssl_spki_export_challenge

(PHP 5 >= 5.6.0, PHP 7, PHP 8)

openssl_spki_export_challenge导出与签名公钥和 challenge 相关的 challenge

说明

openssl_spki_export_challenge(string $spki): string|false

从编码的签名公钥和 challenge 中导出 challenge

参数

spki

需要有效的签名公钥和 challenge

返回值

返回相关 challenge 字符串,失败返回 false

错误/异常

如果 spki 参数传递的是不可用的参数,则抛出 E_WARNING 级别的错误。

示例

示例 #1 openssl_spki_export_challenge() 示例

成功,提取相关联的 challenge 字符串,失败则返回 NULL。

<?php
$pkey
= openssl_pkey_new('secret password');
$spkac = openssl_spki_new($pkey, 'challenge string');
$challenge = openssl_spki_export_challenge(preg_replace('/SPKAC=/', '', $spkac));
?>

示例 #2 openssl_spki_export_challenge() 来自 <keygen> 的示例

从 <keygen> 元素中解压相关联的 challenge 字符串。

<?php
$challenge
= openssl_spki_export_challenge(preg_replace('/SPKAC=/', '', $_POST['spkac']));
?>
<keygen name="spkac" challenge="challenge string" keytype="RSA">

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top