openssl_spki_export

(PHP 5 >= 5.6.0, PHP 7)

openssl_spki_export通锟斤拷签锟斤拷锟斤拷钥锟斤拷锟斤拷战锟斤拷锟斤拷一锟斤拷锟斤拷锟矫碉拷PEM锟斤拷式锟侥癸拷钥

说锟斤拷

openssl_spki_export ( string &$spkac ) : string

锟接憋拷锟斤拷锟角╋拷锟斤拷锟皆匡拷锟斤拷锟秸斤拷锟斤拷锟絇EM锟斤拷式锟侥癸拷钥锟斤拷

锟斤拷锟斤拷

spkac

锟斤拷锟斤拷一锟斤拷锟斤拷效锟斤拷签锟斤拷锟斤拷钥锟斤拷锟斤拷战锟街凤拷锟斤拷锟斤拷

锟斤拷锟斤拷值

锟缴癸拷锟斤拷锟斤拷锟截癸拷锟斤拷锟斤拷PEM锟斤拷式锟侥癸拷钥锟斤拷失锟斤拷锟津返伙拷 NULL.

锟斤拷锟斤拷锟届常

锟斤拷锟斤拷锟斤拷莞锟� spkac 锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟矫的诧拷锟斤拷锟斤拷锟斤拷锟斤拷壮锟揭伙拷锟�E_WARNING锟斤拷锟侥撅拷锟芥。

锟斤拷锟斤拷

Example #1 openssl_spki_export() 锟斤拷锟斤拷锟斤拷

锟缴癸拷锟斤拷锟斤拷锟截癸拷锟斤拷锟斤拷PEM锟斤拷式锟侥癸拷钥锟斤拷失锟斤拷锟津返伙拷 NULL.

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

if (
$pubKey) {
    echo 
$pubKey;
}
?>

Example #2 openssl_spki_export() example from <keygen>

通锟斤拷<keygen> 元锟截碉拷锟斤拷锟斤拷锟斤拷锟斤拷PEM锟斤拷式锟侥癸拷钥锟斤拷

<?php
$spkac 
openssl_spki_export(preg_replace('/SPKAC=/'''$_POST['spkac']));
if (
$spkac != NULL) {
    echo 
$spkac;
} else {
    echo 
"Extraction of pub key failed";
}
?>
<keygen name="spkac" challenge="challenge string" keytype="RSA">

锟轿硷拷

  • openssl_spki_new() - 锟斤拷锟斤拷一锟斤拷锟铰碉拷签锟斤拷锟斤拷钥锟斤拷锟斤拷战
  • openssl_spki_verify() - 锟斤拷证签锟斤拷锟斤拷钥锟斤拷锟斤拷战锟斤拷
  • openssl_spki_export_challenge() - 锟斤拷锟斤拷锟斤拷签锟斤拷锟斤拷钥锟斤拷锟斤拷战锟斤拷氐锟斤拷锟秸斤拷址锟斤拷锟�
  • openssl_md_method()
  • openssl_csr_new() - 锟斤拷锟斤拷一锟斤拷 CSR
  • openssl_csr_sign() - 锟斤拷锟斤拷一锟斤拷证锟斤拷签锟斤拷 CSR (锟斤拷锟竭憋拷锟斤拷) 锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷证锟斤拷