<?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-manager.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'mongodb-driver-manager.createclientencryption.php',
    1 => 'MongoDB\\Driver\\Manager::createClientEncryption',
    2 => 'Создание нового объекта ClientEncryption',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-driver-manager.php',
    1 => 'MongoDB\\Driver\\Manager',
  ),
  'prev' => 
  array (
    0 => 'mongodb-driver-manager.construct.php',
    1 => 'MongoDB\\Driver\\Manager::__construct',
  ),
  'next' => 
  array (
    0 => 'mongodb-driver-manager.executebulkwrite.php',
    1 => 'MongoDB\\Driver\\Manager::executeBulkWrite',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/mongodb/mongodb/driver/manager/createclientencryption.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-driver-manager.createclientencryption" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\Manager::createClientEncryption</h1>
  <p class="verinfo">(mongodb &gt;=1.7.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\Manager::createClientEncryption</span> &mdash; <span class="dc-title">Создание нового объекта ClientEncryption</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-manager.createclientencryption-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\Manager::createClientEncryption</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>): <span class="type"><a href="class.mongodb-driver-clientencryption.php" class="type MongoDB\Driver\ClientEncryption">MongoDB\Driver\ClientEncryption</a></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-manager.createclientencryption-parameters">
  <h3 class="title">Список параметров</h3>
  <dl>
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <p class="para">
      <table class="doctable table">
       <caption><strong>options</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>Менеджер маршрутизации запросов ключей данных в отдельный кластер MongoDB. По умолчанию метод выбирает текущий менеджер и кластер.</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 returnvalues" id="refsect1-mongodb-driver-manager.createclientencryption-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
   <p class="para">
    Возвращает новый экземпляр <span class="classname"><a href="class.mongodb-driver-clientencryption.php" class="classname">MongoDB\Driver\ClientEncryption</a></span>.
   </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-manager.createclientencryption-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-manager.createclientencryption-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;tlsOptions&quot;</code>
         добавлена настройка <code class="literal">&quot;tlsDisableOCSPEndpointCheck&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>

      <tr>
       <td>PECL mongodb 1.12.0</td>
       <td>
        <p class="para">
         KMIP теперь поддерживается в качестве KMS провайдера для шифрования на стороне клиента
         и может быть настроен с помощью параметра <code class="literal">&quot;kmsProviders&quot;</code>.
        </p>
        <p class="para">
         Добавлен параметр <code class="literal">&quot;tlsOptions&quot;</code>.
        </p>
       </td>
      </tr>

      <tr>
       <td>PECL mongodb 1.10.0</td>
       <td>
        Azure и GCP теперь поддерживаются в качестве поставщиков KMS
         для шифрования на стороне клиента и могут быть настроены в поле <code class="literal">&quot;kmsProviders&quot;</code> параметра драйвера <code class="literal">&quot;autoEncryption&quot;</code>.
         Строки в кодировке Base64 теперь принимаются в качестве альтернативы <span class="classname"><a href="class.mongodb-bson-binary.php" class="classname">MongoDB\BSON\Binary</a></span>
         для параметров внутри <code class="literal">&quot;kmsProviders&quot;</code>.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


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


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