<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'mongodb-driver-clientencryption.encrypt.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::encrypt',
    2 => 'Chiffre une valeur',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-driver-clientencryption.php',
    1 => 'MongoDB\\Driver\\ClientEncryption',
  ),
  'prev' => 
  array (
    0 => 'mongodb-driver-clientencryption.deletekey.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::deleteKey',
  ),
  'next' => 
  array (
    0 => 'mongodb-driver-clientencryption.encryptexpression.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::encryptExpression',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/mongodb/mongodb/driver/clientencryption/encrypt.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-driver-clientencryption.encrypt" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\ClientEncryption::encrypt</h1>
  <p class="verinfo">(mongodb &gt;=1.7.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\ClientEncryption::encrypt</span> &mdash; <span class="dc-title">Chiffre une valeur</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-clientencryption.encrypt-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><strong>MongoDB\Driver\ClientEncryption::encrypt</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>, <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.array.php" class="type array">array</a></span></span> <code class="parameter">$options</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.mongodb-bson-binary.php" class="type MongoDB\BSON\Binary">MongoDB\BSON\Binary</a></span></div>

  <p class="para rdfs-comment">
   Chiffre la valeur.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-driver-clientencryption.encrypt-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
    <dt><code class="parameter">value</code></dt>
    <dd>
     <p class="para">
      La valeur à chiffrer. Toute valeur qui peut être insérée dans MongoDB peut
      être chiffrée en utilisant cette méthode.
     </p>
    </dd>
   
   

  <dt>
    <code class="parameter">options</code>
  </dt>
  <dd>
    <p class="para">
      <table class="doctable table">
        <caption><strong>Options de chiffrement</strong></caption>
        
          <thead>
            <tr>
              <th>Option</th>
              <th>Type</th>
              <th>Description</th>
            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td>algorithm</td>
              <td>
                <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
              </td>
              <td>
                <p class="para">
                  L&#039;algorithme de chiffrement à utiliser. Cette option est requise. Spécifiez l&#039;une des constantes suivantes de
                  <a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants" class="link">ClientEncryption</a> :
                </p>
                <ul class="simplelist">
                  <li>
                    <strong><code>MongoDB\Driver\ClientEncryption::AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC</code></strong>
                  </li>
                  <li>
                    <strong><code>MongoDB\Driver\ClientEncryption::AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM</code></strong>
                  </li>
                  <li>
                    <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.algorithm-indexed">MongoDB\Driver\ClientEncryption::ALGORITHM_INDEXED</a></code></strong>
                  </li>
                  <li>
                    <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.algorithm-unindexed">MongoDB\Driver\ClientEncryption::ALGORITHM_UNINDEXED</a></code></strong>
                  </li>
                  <li>
                    <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.algorithm-range">MongoDB\Driver\ClientEncryption::ALGORITHM_RANGE</a></code></strong>
                  </li>
                </ul>
              </td>
            </tr>

            <tr>
              <td>contentionFactor</td>
              <td>
                <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
              </td>
              <td>
                <p class="para">
                  Le facteur de contention pour évaluer les requêtes avec des charges utiles chiffrées indexées.
                </p>
                <p class="para">
                  Cette option s&#039;applique uniquement et ne peut être spécifiée que lorsque
                  <code class="literal">algorithm</code> est
                  <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.algorithm-indexed">MongoDB\Driver\ClientEncryption::ALGORITHM_INDEXED</a></code></strong> ou
                  <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.algorithm-range">MongoDB\Driver\ClientEncryption::ALGORITHM_RANGE</a></code></strong>.
                </p>
              </td>
            </tr>

            <tr>
              <td>keyAltName</td>
              <td>
                <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
              </td>
              <td>
                <p class="para">
                  Identifie un document de collection de coffre à clés par <code class="literal">keyAltName</code>. Cette option est mutuellement exclusive
                  avec <code class="literal">keyId</code> et l&#039;une des deux est requise.
                </p>
              </td>
            </tr>

            <tr>
              <td>keyId</td>
              <td>
                <span class="classname"><a href="class.mongodb-bson-binary.php" class="classname">MongoDB\BSON\Binary</a></span>
              </td>
              <td>
                <p class="para">
                  Identifie une clé de données par <code class="literal">_id</code>. La valeur est un UUID (sous-type binaire 4). Cette option est mutuellement
                  exclusive avec <code class="literal">keyAltName</code> et l&#039;une des deux est requise.
                </p>
              </td>
            </tr>

            <tr>
              <td>queryType</td>
              <td>
                <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
              </td>
              <td>
                <p class="para">
                  Le type de requête pour évaluer les requêtes avec des charges utiles chiffrées indexées. Spécifiez l&#039;une des constantes suivantes de
                  <a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants" class="link">ClientEncryption</a> :
                </p>
                <ul class="simplelist">
                  <li>
                    <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.query-type-equality">MongoDB\Driver\ClientEncryption::QUERY_TYPE_EQUALITY</a></code></strong>
                  </li>
                  <li>
                    <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.query-type-range">MongoDB\Driver\ClientEncryption::QUERY_TYPE_RANGE</a></code></strong>
                  </li>
                </ul>
                <p class="para">
                  Cette option s&#039;applique uniquement et ne peut être spécifiée que lorsque
                  <code class="literal">algorithm</code> est
                  <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.algorithm-indexed">MongoDB\Driver\ClientEncryption::ALGORITHM_INDEXED</a></code></strong> ou
                  <strong><code><a href="class.mongodb-driver-clientencryption.php#mongodb-driver-clientencryption.constants.algorithm-range">MongoDB\Driver\ClientEncryption::ALGORITHM_RANGE</a></code></strong>.
                </p>
              </td>
            </tr>

            <tr>
              <td>rangeOpts</td>
              <td>
                <span class="type"><a href="language.types.array.php" class="type array">array</a></span>
              </td>
              <td>
                <p class="para">
                  Options d&#039;index pour un champ de chiffrement interrogeable prenant en charge les requêtes &quot;range&quot;. Les options ci-dessous doivent correspondre
                  aux valeurs définies dans <code class="literal">encryptedFields</code> de la collection cible. Pour les types de champ BSON double et decimal128,
                  <code class="literal">min</code>, <code class="literal">max</code> et <code class="literal">precision</code> doivent être tous définis ou tous non définis.
                </p>
                <p class="para">
                  <table class="doctable table">
                    <caption><strong>Options d&#039;index de plage</strong></caption>
                    
                      <thead>
                        <tr>
                          <th>Option</th>
                          <th>Type</th>
                          <th>Description</th>
                        </tr>

                      </thead>

                      <tbody class="tbody">
                        <tr>
                          <td>min</td>
                          <td>
                            <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span>
                          </td>
                          <td>Requis si <code class="literal">precision</code> est défini. La valeur BSON minimale de la plage.</td>
                        </tr>

                        <tr>
                          <td>max</td>
                          <td>
                            <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span>
                          </td>
                          <td>Requis si <code class="literal">precision</code> est défini. La valeur BSON maximale de la plage.</td>
                        </tr>

                        <tr>
                          <td>sparsity</td>
                          <td>
                            <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
                          </td>
                          <td>Optionnel.Entier positif sur 64 bits.</td>
                        </tr>

                        <tr>
                          <td>precision</td>
                          <td>
                            <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
                          </td>
                          <td>
                           Facultatif. Entier positif sur 32 bits spécifiant la précision à utiliser
                           pour le chiffrement explicite. Peut uniquement être défini pour les types
                           de champ BSON double ou decimal128.
                          </td>
                       </tr>

                       <tr>
                        <td>trimFactor</td>
                        <td><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></td>
                        <td>Optionnel. Entier positif sur 32 bits.</td>
                       </tr>

                      </tbody>
                    
                  </table>

                </p>
              </td>
            </tr>

          </tbody>
        
      </table>

    </p>
  </dd>


  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongodb-driver-clientencryption.encrypt-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Renvoie la valeur chiffrée en tant qu&#039;un objet 
   <span class="function"><a href="mongodb-driver-clientencryption.decrypt.php" class="function">MongoDB\Driver\ClientEncryption::decrypt()</a></span> de sous-type 6.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-clientencryption.encrypt-errors">
  <h3 class="title">Erreurs / Exceptions</h3>
  <ul class="simplelist">
   <li>Lance une exception <span class="classname"><strong class="classname">MongoDB\Driver\InvalidArgumentException</strong></span> lors d'une erreur survenue pendant l'analyse d'un argument.</li>
   <li>Lance une <span class="classname"><a href="class.mongodb-driver-exception-encryptionexception.php" class="classname">MongoDB\Driver\Exception\EncryptionException</a></span> si une erreur se produit lors du chiffrement de la valeur</li>
  </ul>
 </div>


 <div class="refsect1 changelog" id="refsect1-mongodb-driver-clientencryption.encrypt-changelog">
  <h3 class="title">Historique</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PECL mongodb 1.20.0</td>
       <td>
        Ajouté l&#039;option de plage <code class="literal">&quot;trimFactor&quot;</code>. L&#039;option de plage
        <code class="literal">&quot;sparsity&quot;</code> est désormais optionnelle.
       </td>
      </tr>

      <tr>
       <td>PECL mongodb 1.16.0</td>
       <td>
        Ajouté l&#039;option <code class="literal">&quot;rangeOpts&quot;</code>.
       </td>
      </tr>

      <tr>
       <td>PECL mongodb 1.14.0</td>
       <td>
        Ajout des options <code class="literal">&quot;contentionFactor&quot;</code> et
        <code class="literal">&quot;queryType&quot;</code>.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongodb-driver-clientencryption.encrypt-seealso">
  <h3 class="title">Voir aussi</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="mongodb-driver-clientencryption.decrypt.php" class="function" rel="rdfs-seeAlso">MongoDB\Driver\ClientEncryption::decrypt()</a> - D&eacute;chiffre une valeur</span></li>
   <li><span class="function"><a href="mongodb-driver-clientencryption.encryptexpression.php" class="function" rel="rdfs-seeAlso">MongoDB\Driver\ClientEncryption::encryptExpression()</a> - Chiffre une expression de correspondance ou d'agr&eacute;gation</span></li>
  </ul>
 </div>


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