This commit is contained in:
fofolee
2019-04-08 23:22:26 +08:00
commit 7ca94f1141
5960 changed files with 530244 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
<!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>使用公钥加密数据</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.openssl-public-encrypt" class="refentry">
<div class="refnamediv">
<h1 class="refname">openssl_public_encrypt</h1>
<p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_public_encrypt</span> &mdash; <span class="dc-title">使用公钥加密数据</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.openssl-public-encrypt-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>openssl_public_encrypt</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$crypted</code></span>
, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$key</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$padding</code><span class="initializer"> = OPENSSL_PKCS1_PADDING</span></span>
] ) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>openssl_public_encrypt()</strong></span> 使用公钥<code class="parameter">key</code>解密数据 <code class="parameter">data</code>
并且将结果保存到变量<code class="parameter">crypted</code>中。 加密的数据可以通过<span class="function"><a href="openssl_private_decrypt.html" class="function">openssl_private_decrypt()</a></span>函数解密。
</p>
<p class="para">
该函数可以用来加密数据,供该公钥匹配的私钥拥有者读取。 它也可以用来在数据库中存储安全数据。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.openssl-public-encrypt-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">data</code></dt>
<dd>
<p class="para">
</p>
</dd>
<dt>
<code class="parameter">crypted</code></dt>
<dd>
<p class="para">
这将保存加密的结果。
</p>
</dd>
<dt>
<code class="parameter">key</code></dt>
<dd>
<p class="para">
公钥。
</p>
</dd>
<dt>
<code class="parameter">padding</code></dt>
<dd>
<p class="para">
<code class="parameter">padding</code> can be one of
<strong><code>OPENSSL_PKCS1_PADDING</code></strong>,
<strong><code>OPENSSL_SSLV23_PADDING</code></strong>,
<strong><code>OPENSSL_PKCS1_OAEP_PADDING</code></strong>,
<strong><code>OPENSSL_NO_PADDING</code></strong>.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.openssl-public-encrypt-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.openssl-public-encrypt-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="openssl_private_encrypt.html" class="function" rel="rdfs-seeAlso">openssl_private_encrypt()</a> - 使用私钥加密数据</span></li>
<li class="member"><span class="function"><a href="openssl_private_decrypt.html" class="function" rel="rdfs-seeAlso">openssl_private_decrypt()</a> - 使用私钥解密数据</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>