<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mongodb-driver-clientencryption.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'mongodb-driver-clientencryption.construct.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::__construct',
    2 => 'Создаёт новый объект ClientEncryption',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-driver-clientencryption.php',
    1 => 'MongoDB\\Driver\\ClientEncryption',
  ),
  'prev' => 
  array (
    0 => 'mongodb-driver-clientencryption.addkeyaltname.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::addKeyAltName',
  ),
  'next' => 
  array (
    0 => 'mongodb-driver-clientencryption.createdatakey.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::createDataKey',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/mongodb/mongodb/driver/clientencryption/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-driver-clientencryption.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\ClientEncryption::__construct</h1>
  <p class="verinfo">(mongodb &gt;=1.14.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\ClientEncryption::__construct</span> &mdash; <span class="dc-title">Создаёт новый объект ClientEncryption</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-clientencryption.construct-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><strong>MongoDB\Driver\ClientEncryption::__construct</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$options</code></span>)</div>

  <p class="para rdfs-comment">
   Создаёт новый объект <span class="classname"><a href="class.mongodb-driver-clientencryption.php" class="classname">MongoDB\Driver\ClientEncryption</a></span> с указанными опциями.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-driver-clientencryption.construct-parameters">
  <h3 class="title">Список параметров</h3>
  <dl>
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <p class="para">
      <table class="doctable table">
       <caption><strong>Опции</strong></caption>
       
        <thead>
         <tr>
          <th>Опция</th>
          <th>Тип</th>
          <th>Описание</th>
         </tr>

        </thead>

        <tbody class="tbody">
         <tr>
          <td>keyVaultClient</td>
          <td><span class="classname"><a href="class.mongodb-driver-manager.php" class="classname">MongoDB\Driver\Manager</a></span></td>
          <td>
           Менеджер, используемый для маршрутизации запросов ключей данных.
           Опция является обязательной (в отличие от функции
           <span class="function"><a href="mongodb-driver-manager.createclientencryption.php" class="function">MongoDB\Driver\Manager::createClientEncryption()</a></span>).
          </td>
         </tr>

         
         <tr>
          <td>keyVaultNamespace</td>
          <td><span class="type"><a href="language.types.string.php" class="type string">string</a></span></td>
          <td>Полное пространство имён (например, <code class="literal">&quot;databaseName.collectionName&quot;</code>), обозначающее коллекцию, которая содержит все ключи данных, используемые для шифрования и дешифрования. Обязательный параметр.</td>
         </tr>


         
         <tr>
          <td>kmsProviders</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <p class="para">
            Документ, содержащий конфигурацию для одного или нескольких провайдеров KMS, которые используются для шифрования ключей данных.
            Поддерживаются провайдеры <code class="literal">&quot;aws&quot;</code>, <code class="literal">&quot;azure&quot;</code>, <code class="literal">&quot;gcp&quot;</code> и <code class="literal">&quot;local&quot;</code>, и, по крайней мере, один из них должен быть указан.
           </p>
           <p class="para">
            Если для <code class="literal">&quot;aws&quot;</code>, <code class="literal">&quot;azure&quot;</code> или <code class="literal">&quot;gcp&quot;</code> указан пустой документ,
            драйвер попытается сконфигурировать провайдера, используя
            <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#automatic-credentials" class="link external">&raquo;&nbsp;Автоматические учётные данные</a>.
           </p>
           <p class="para">
            Формат для <code class="literal">&quot;aws&quot;</code> выглядит следующим образом:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">aws: {
    accessKeyId: &lt;string&gt;,
    secretAccessKey: &lt;string&gt;,
    sessionToken: &lt;optional string&gt;
}</pre>
</div>
           </div>

           <p class="para">
            Формат для <code class="literal">&quot;azure&quot;</code> выглядит следующим образом:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">azure: {
    tenantId: &lt;string&gt;,
    clientId: &lt;string&gt;,
    clientSecret: &lt;string&gt;,
    identityPlatformEndpoint: &lt;optional string&gt; // По умолчанию &quot;login.microsoftonline.com&quot;

}</pre>
</div>
           </div>

           <p class="para">
            Формат для <code class="literal">&quot;gcp&quot;</code> выглядит следующим образом:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">gcp: {
    email: &lt;string&gt;,
    privateKey: &lt;base64 string&gt;|&lt;MongoDB\BSON\Binary&gt;,
    endpoint: &lt;optional string&gt; // По умолчанию &quot;oauth2.googleapis.com&quot;

}</pre>
</div>
           </div>

           <p class="para">
            Формат для <code class="literal">&quot;kmip&quot;</code> выглядит следующим образом:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">kmip: {
    endpoint: &lt;string&gt;
}</pre>
</div>
           </div>

           <p class="para">
            Формат для <code class="literal">&quot;local&quot;</code> выглядит следующим образом:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">local: {
    // 96-байтовый главный ключ, используемый для шифрования/дешифрования ключей данных
    key: &lt;base64 string&gt;|&lt;MongoDB\BSON\Binary&gt;
}</pre>
</div>
           </div>

          </td>
         </tr>


         
         <tr>
          <td>tlsOptions</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <p class="para">
            Документ, содержащий конфигурацию TLS для одного или нескольких KMS провайдеров. Поддерживаются провайдеры <code class="literal">&quot;aws&quot;</code>, <code class="literal">&quot;azure&quot;</code>, <code class="literal">&quot;gcp&quot;</code> и <code class="literal">&quot;kmip&quot;</code>. Все провайдеры поддерживают следующие опции:
           </p>
           <div class="example-contents">
<div class="javascriptcode"><pre class="javascriptcode">&lt;provider&gt;: {
    tlsCaFile: &lt;optional string&gt;,
    tlsCertificateKeyFile: &lt;optional string&gt;,
    tlsCertificateKeyFilePassword: &lt;optional string&gt;,
    tlsDisableOCSPEndpointCheck: &lt;optional bool&gt;
}</pre>
</div>
           </div>

          </td>
         </tr>


        </tbody>
       
      </table>

     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-clientencryption.construct-errors">
  <h3 class="title">Ошибки</h3>
  <ul class="simplelist">
   <li>При ошибке парсинга аргумента метод выбрасывает исключение  <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span>.</li>
   <li>
    Выбрасывает исключение <span class="classname"><a href="class.mongodb-driver-exception-runtimeexception.php" class="classname">MongoDB\Driver\Exception\RuntimeException</a></span>,
    если модуль был скомпилирован без поддержки libmongocrypt.
   </li>
  </ul>
 </div>


 <div class="refsect1 changelog" id="refsect1-mongodb-driver-clientencryption.construct-changelog">
  <h3 class="title">Список изменений</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Версия</th>
       <th>Описание</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PECL mongodb 1.16.0</td>
       <td>
        <p class="para">
         Провайдер AWS KMS для шифрования на стороне клиента теперь принимает параметр
         <code class="literal">&quot;sessionToken&quot;</code>, который можно указывать для аутентификации
         с временными учётными данными AWS.
        </p>
        <p class="para">
         Добавлена поддержка поля <code class="literal">&quot;tlsDisableOCSPEndpointCheck&quot;</code>
         в опции <code class="literal">&quot;tlsOptions&quot;</code>.
        </p>
        <p class="para">
         Если для KMS-провайдеров <code class="literal">&quot;azure&quot;</code> или
         <code class="literal">&quot;gcp&quot;</code> указан пустой документ,
         драйвер попытается сконфигурировать провайдера, заполнив
         <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#automatic-credentials" class="link external">&raquo;&nbsp;Автоматические учётные данные</a>.
        </p>
       </td>
      </tr>

      <tr>
       <td>PECL mongodb 1.15.0</td>
       <td>
        <p class="para">
         Если для KMS-провайдера <code class="literal">&quot;aws&quot;</code> указан пустой документ,
         драйвер попытается сконфигурировать провайдера, заполнив
         <a href="https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#automatic-credentials" class="link external">&raquo;&nbsp;Автоматические учётные данные</a>.
        </p>
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongodb-driver-clientencryption.construct-seealso">
  <h3 class="title">Смотрите также</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="mongodb-driver-manager.createclientencryption.php" class="function" rel="rdfs-seeAlso">MongoDB\Driver\Manager::createClientEncryption()</a> - Создание нового объекта ClientEncryption</span></li>
   <li><a href="https://www.mongodb.com/docs/manual/core/security-explicit-client-side-encryption/" class="link external">&raquo;&nbsp;Явное (ручное) шифрование уровня полей на стороне клиента</a> в руководстве по MongoDB</li>
  </ul>
 </div>


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