function.blenc-encrypt.html 5.51 KB
<!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>Encrypt a PHP script with BLENC.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ref.blenc.html">Blenc Funktionen</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.errorfunc.html">Fehlerbehandlung</a></div>
 <div class="up"><a href="ref.blenc.html">Blenc Funktionen</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.blenc-encrypt" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">blenc_encrypt</h1>
  <p class="verinfo">(PECL blenc &gt;= 5)</p><p class="refpurpose"><span class="refname">blenc_encrypt</span> &mdash; <span class="dc-title">
   Encrypt a PHP script with BLENC.
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.blenc-encrypt-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>blenc_encrypt</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$plaintext</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$encodedfile</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encryption_key</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Encrypt the plaintext content and write it into encodedfile
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.blenc-encrypt-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>

    
     <dt>

      <code class="parameter">plaintext</code>
     </dt>

     <dd>

      <p class="para">
       A source code to encrypt. Does not need to contain opening/closing PHP tags
      </p>
     </dd>

    
    
     <dt>

      <code class="parameter">encodedfile</code>
     </dt>

     <dd>

      <p class="para">
       The filename where BLENC will save the encoded source.
      </p>
     </dd>

    
    
     <dt>

      <code class="parameter">encryption_key</code>
     </dt>

     <dd>

      <p class="para">
       The key that BLENC will use to encrypt plaintext content. If not given
       BLENC will create a valid key.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.blenc-encrypt-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   BLENC will return the redistributable key that must be saved into key_file:
   the path of key_file is specified at runtime with the option blenc.key_file
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.blenc-encrypt-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-404">
    <p><strong>Beispiel #1 <span class="function"><strong>blenc_encrypt()</strong></span> example </strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;read&nbsp;the&nbsp;PHP&nbsp;source&nbsp;code&nbsp;*/<br /></span><span style="color: #0000BB">$source_code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">"my_source_to_protect.php"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;create&nbsp;the&nbsp;encrypted&nbsp;version&nbsp;*/<br /></span><span style="color: #0000BB">$redistributable_key&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">blenc_encrypt</span><span style="color: #007700">(</span><span style="color: #0000BB">$source_code</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"my_source_encoded.php"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;read&nbsp;which&nbsp;is&nbsp;the&nbsp;key_file&nbsp;*/<br /></span><span style="color: #0000BB">$key_file&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ini_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'blenc.key_file'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;save&nbsp;the&nbsp;redistributable&nbsp;key&nbsp;*/<br /></span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #0000BB">$key_file</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$redistributable_key</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">FILE_APPEND</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ref.blenc.html">Blenc Funktionen</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.errorfunc.html">Fehlerbehandlung</a></div>
 <div class="up"><a href="ref.blenc.html">Blenc Funktionen</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>