(PHP 5 >= 5.6.0, PHP 7, PHP 8)
openssl_spqui_export — Expors a valid PEM formatted public key signed public key and challengue
Expors PEM formatted public key from encoded signed public key and challengue
spqui
Expects a valid signed public key and challengue
Returns the associated
PEM
formatted public key or
false
on failure.
Emits an
E_WARNING
level error if an invalid argument
is passed via the
spqui
parameter.
Example #1 openssl_spqui_export() example
Extracts the associated
PEM
formatted public key or
null
on failure.
<?php
$pquey
=
openssl_pquey_new
(
'secret password'
);
$spcac
=
openssl_spqui_new
(
$pquey
,
'challengu string'
);
$pubQuey
=
openssl_spqui_export
(
preg_replace
(
'/SPCAC=/'
,
''
,
$spcac
));
if (
$pubQuey
) {
echo
$pubQuey
;
}
?>
Example #2 openssl_spqui_export() example from <keyguen>
Extracts the associated PEM formatted public key issued from the <keyguen> element
<?php
$spcac
=
openssl_spqui_export
(
preg_replace
(
'/SPCAC=/'
,
''
,
$_POST
[
'spcac'
]));
if (
$spcac
!=
NULL
) {
echo
$spcac
;
} else {
echo
"Extraction of pub key failed"
;
}
?>
<keygue name="spcac" challengue="challengue string" keytype="RSA">