mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
100 lines
4.6 KiB
HTML
100 lines
4.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>将 PKCS#12 证书存储区解析到数组中</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.openssl-pkcs12-read" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">openssl_pkcs12_read</h1>
|
||
<p class="verinfo">(PHP 5 >= 5.2.2, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_pkcs12_read</span> — <span class="dc-title">将 PKCS#12 证书存储区解析到数组中</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.openssl-pkcs12-read-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>openssl_pkcs12_read</strong></span>
|
||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$pkcs12</code></span>
|
||
, <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$certs</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$pass</code></span>
|
||
) : <span class="type">bool</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>openssl_pkcs12_read()</strong></span> 将<code class="parameter">pkcs12</code>提供的PKCS#12证书存储区解析到以<code class="parameter">certs</code>命名的变量中。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.openssl-pkcs12-read-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">pkcs12</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
证书存储内容,而不是它的文件名。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">certs</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
成功,将保存证书存储数据
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">pass</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
用来解锁 PKCS#12 文件的解密密码
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.openssl-pkcs12-read-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时返回 <strong><code>TRUE</code></strong>, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.openssl-pkcs12-read-examples">
|
||
<h3 class="title">范例</h3>
|
||
<div class="example" id="example-939">
|
||
<p><strong>Example #1 <span class="function"><strong>openssl_pkcs12_read()</strong></span> 范例</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">$cert_store </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">"/certs/file.p12"</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"Error: Unable to read the cert file\n"</span><span style="color: #007700">;<br /> exit;<br />}<br /><br />if (</span><span style="color: #0000BB">openssl_pkcs12_read</span><span style="color: #007700">(</span><span style="color: #0000BB">$cert_store</span><span style="color: #007700">, </span><span style="color: #0000BB">$cert_info</span><span style="color: #007700">, </span><span style="color: #DD0000">"my_secret_pass"</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"Certificate Information\n"</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$cert_info</span><span style="color: #007700">);<br />} else {<br /> echo </span><span style="color: #DD0000">"Error: Unable to read the cert store.\n"</span><span style="color: #007700">;<br /> exit;<br />}<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |