<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.openssl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.openssl-x509-checkpurpose.php',
    1 => 'openssl_x509_checkpurpose',
    2 => 'Verifies if a certificate can be used for a particular purpose',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'OpenSSL Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.openssl-x509-check-private-key.php',
    1 => 'openssl_x509_check_private_key',
  ),
  'next' => 
  array (
    0 => 'function.openssl-x509-export.php',
    1 => 'openssl_x509_export',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/openssl/functions/openssl-x509-checkpurpose.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.openssl-x509-checkpurpose" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_x509_checkpurpose</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openssl_x509_checkpurpose</span> &mdash; <span class="dc-title">Verifies if a certificate can be used for a particular purpose</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.openssl-x509-checkpurpose-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_x509_checkpurpose</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="class.opensslcertificate.php" class="type OpenSSLCertificate">OpenSSLCertificate</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$certificate</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$purpose</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$ca_info</code><span class="initializer"> = []</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$untrusted_certificates_file</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>openssl_x509_checkpurpose()</strong></span> examines a certificate to
   see if it can be used for the specified <code class="parameter">purpose</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-x509-checkpurpose-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">certificate</code></dt>
     <dd>
      <p class="para">
       The examined certificate.
      </p>
     </dd>
    
    
     <dt><code class="parameter">purpose</code></dt>
     <dd>
      <p class="para">
       <table class="doctable table">
        <caption><strong><span class="function"><strong>openssl_x509_checkpurpose()</strong></span> purposes</strong></caption>
        
         <thead>
          <tr>
           <th>Constant</th>
           <th>Description</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>X509_PURPOSE_SSL_CLIENT</td>
           <td>Can the certificate be used for the client side of an SSL
           connection?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_SSL_SERVER</td>
           <td>Can the certificate be used for the server side of an SSL
           connection?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_NS_SSL_SERVER</td>
           <td>Can the cert be used for Netscape SSL server?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_SMIME_SIGN</td>
           <td>Can the cert be used to sign S/MIME email?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_SMIME_ENCRYPT</td>
           <td>Can the cert be used to encrypt S/MIME email?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_CRL_SIGN</td>
           <td>Can the cert be used to sign a certificate revocation list
           (CRL)?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_ANY</td>
           <td>Can the cert be used for Any/All purposes?</td>
          </tr>

         </tbody>
        
       </table>

       These options are not bitfields - you may specify one only!
      </p>
     </dd>
    
    
     <dt><code class="parameter">ca_info</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">ca_info</code> should be an array of trusted CA files/dirs
       as described in <a href="openssl.cert.verification.php" class="link">Certificate
       Verification</a>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">untrusted_certificates_file</code></dt>
     <dd>
      <p class="para">
       If specified, this should be the name of a <abbr title="Privacy-Enhanced Mail">PEM</abbr> encoded file holding
       certificates that can be used to help verify the certificate, although
       no trust is placed in the certificates that come from that file.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-x509-checkpurpose-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> if the certificate can be used for the intended purpose,
   <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if it cannot, or -1 on error.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.openssl-x509-checkpurpose-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versione</th>
      <th>Descrizione</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">certificate</code> accepts an <span class="classname"><a href="class.opensslcertificate.php" class="classname">OpenSSLCertificate</a></span> instance now;
       previously, a <a href="language.types.resource.php" class="link">resource</a> of type <code class="literal">OpenSSL X.509</code> was accepted.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">untrusted_certificates_file</code> is nullable now.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>

</div><?php manual_footer($setup); ?>