<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.openssl-x509-checkpurpose.php',
    1 => 'openssl_x509_checkpurpose',
    2 => '証明書が特定の目的に使用可能かどうか確認する',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'OpenSSL 関数',
  ),
  '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' => 'ja',
    '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">証明書が特定の目的に使用可能かどうか確認する</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.openssl-x509-checkpurpose-description">
  <h3 class="title">説明</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> は証明書を調べ、
   <code class="parameter">purpose</code> で指定した目的に使用可能であるかどうかを確認します。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-x509-checkpurpose-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">certificate</code></dt>
     <dd>
      <p class="para">
       調べたい証明書。
      </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> の目的</strong></caption>
        
         <thead>
          <tr>
           <th>定数</th>
           <th>説明</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>X509_PURPOSE_SSL_CLIENT</td>
           <td>
            この証明書を SSL 接続のクライアント側で使用できるか?
           </td>
          </tr>

          <tr>
           <td>X509_PURPOSE_SSL_SERVER</td>
           <td>
            この証明書を SSL 接続のサーバー側で使用できるか?
           </td>
          </tr>

          <tr>
           <td>X509_PURPOSE_NS_SSL_SERVER</td>
           <td>この証明書を Netscape SSL サーバーで使用できるか?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_SMIME_SIGN</td>
           <td>この証明書を S/MIME email で使用できるか?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_SMIME_ENCRYPT</td>
           <td>この証明書を S/MIME email の暗号化で使用できるか?</td>
          </tr>

          <tr>
           <td>X509_PURPOSE_CRL_SIGN</td>
           <td>
            この証明書を証明書取消リスト(CRL)にサインをする際に使用できるか?
           </td>
          </tr>

          <tr>
           <td>X509_PURPOSE_ANY</td>
           <td>この証明書をあらゆる用途に使用できるか?</td>
          </tr>

         </tbody>
        
       </table>

       これらのオプションはビットフィールドではありません。
       指定できるのは一つだけです!
      </p>
     </dd>
    
    
     <dt><code class="parameter">ca_info</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">ca_info</code> は、<a href="openssl.cert.verification.php" class="link">証明書の認証</a>
       で説明したような信頼できる CA ファイル/ディレクトリの配列です。
      </p>
     </dd>
    
    
     <dt><code class="parameter">untrusted_certificates_file</code></dt>
     <dd>
      <p class="para">
       指定した場合は、これが証明書を含む<abbr title="Privacy-Enhanced Mail">PEM</abbr>エンコードされたファイルの名前になります。
       この証明書は、検証と証明を簡単化するために使用されます。
       そのファイル内にある証明書は、信頼されない(untrusted)証明書とみなされます。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-x509-checkpurpose-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   証明書が意図した目的に使用可能である場合に <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>、使用できない場合に
   <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> 、エラーの場合に -1 を返します。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.openssl-x509-checkpurpose-changelog">
  <h3 class="title">変更履歴</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">certificate</code> は、
       <span class="classname"><a href="class.opensslcertificate.php" class="classname">OpenSSLCertificate</a></span> クラスのインスタンスを受け入れるようになりました。
       これより前のバージョンでは、
       <code class="literal">OpenSSL X.509</code> 型のリソースを受け入れていました。
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">untrusted_certificates_file</code> は、nullable になりました。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>

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