<?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.createdatakey.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::createDataKey',
    2 => 'Cr&eacute;er un document cl&eacute;',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-driver-clientencryption.php',
    1 => 'MongoDB\\Driver\\ClientEncryption',
  ),
  'prev' => 
  array (
    0 => 'mongodb-driver-clientencryption.construct.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::__construct',
  ),
  'next' => 
  array (
    0 => 'mongodb-driver-clientencryption.decrypt.php',
    1 => 'MongoDB\\Driver\\ClientEncryption::decrypt',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/mongodb/mongodb/driver/clientencryption/createdatakey.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-driver-clientencryption.createdatakey" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\ClientEncryption::createDataKey</h1>
  <p class="verinfo">(mongodb &gt;=1.7.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\ClientEncryption::createDataKey</span> &mdash; <span class="dc-title">Créer un document clé</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-clientencryption.createdatakey-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::createDataKey</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$kmsProvider</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">
   Crée un nouveau document clé et l&#039;insère dans la collection de coffre de clés.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-driver-clientencryption.createdatakey-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
    <dt><code class="parameter">kmsProvider</code></dt>
    <dd>
     <p class="para">
      Le fournisseur KMS (par exemple <code class="literal">&quot;local&quot;</code>,
      <code class="literal">&quot;aws&quot;</code>) qui sera utilisé pour chiffrer le nouveau document clé.
     </p>
    </dd>
   

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

        </thead>

        <tbody class="tbody">
         <tr>
          <td>masterKey</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <p class="para">
            Le document masterKey identifie une clé spécifique à KMS utilisée pour
            chiffrer le nouveau document clé. Cette option est requise à moins que
            <code class="parameter">kmsProvider</code> soit <code class="literal">&quot;local&quot;</code>.
           </p>
           
  <p class="para">
   <table class="doctable table">
    <caption><strong>Options du fournisseur <code class="literal">&quot;aws&quot;</code></strong></caption>
    
     <thead>
      <tr>
       <th>Option</th>
       <th>Type</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>region</td>
       <td>string</td>
       <td>Requis.</td>
      </tr>

      <tr>
       <td>key</td>
       <td>string</td>
       <td>Requis. Le nom de ressource Amazon (ARN) de la clé maîtresse du client AWS (CMK).</td>
      </tr>

      <tr>
       <td>endpoint</td>
       <td>string</td>
       <td>Optionnel. Un identifiant d&#039;hôte alternatif pour envoyer les demandes KMS. Peut inclure le numéro de port.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Options du fournisseur <code class="literal">&quot;azure&quot;</code></strong></caption>
    
     <thead>
      <tr>
       <th>Option</th>
       <th>Type</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>keyVaultEndpoint</td>
       <td>string</td>
       <td>Requis. Hôte avec port optionnel (par exemple, &quot;example.vault.azure.net&quot;).</td>
      </tr>

      <tr>
       <td>keyName</td>
       <td>string</td>
       <td>Requis.</td>
      </tr>

      <tr>
       <td>keyVersion</td>
       <td>string</td>
       <td>Optionnel. Une version spécifique de la clé nommée. Par défaut, la version primaire de la clé est utilisée.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Options du fournisseur <code class="literal">&quot;gcp&quot;</code></strong></caption>
    
     <thead>
      <tr>
       <th>Option</th>
       <th>Type</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>projectId</td>
       <td>string</td>
       <td>Requis.</td>
      </tr>

      <tr>
       <td>location</td>
       <td>string</td>
       <td>Requis.</td>
      </tr>

      <tr>
       <td>keyRing</td>
       <td>string</td>
       <td>Requis.</td>
      </tr>

      <tr>
       <td>keyName</td>
       <td>string</td>
       <td>Requis.</td>
      </tr>

      <tr>
       <td>keyVersion</td>
       <td>string</td>
       <td>Optionnel. Une version spécifique de la clé nommée. Par défaut, la version primaire de la clé est utilisée.</td>
      </tr>

      <tr>
       <td>endpoint</td>
       <td>string</td>
       <td>Optionnel. Hôte avec port optionnel. La valeur par défaut est &quot;cloudkms.googleapis.com&quot;.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Options du fournisseur <code class="literal">&quot;kmip&quot;</code></strong></caption>
    
     <thead>
      <tr>
       <th>Option</th>
       <th>Type</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>keyId</td>
       <td>string</td>
       <td>Optionnel. Identifiant unique d&#039;un objet géré de 96 octets de données secrètes KMIP. S&#039;il n&#039;est pas spécifié, le pilote crée un objet géré aléatoire de 96 octets de données secrètes KMIP.</td>
      </tr>

      <tr>
       <td>endpoint</td>
       <td>string</td>
       <td>Optionnel. Hôte avec port optionnel.</td>
      </tr>

      <tr>
       <td>delegated</td>
       <td>bool</td>
       <td>Optionnel. Si vrai, cette clé devrait être déchiffrer par le serveur KMIP.</td>
      </tr>

     </tbody>
    
   </table>

  </p>

          </td>
         </tr>

         <tr>
          <td>keyAltNames</td>
          <td><span class="type"><a href="language.types.array.php" class="type array">array</a></span></td>
          <td>
           <p class="para">
            Une liste optionnelle de noms alternatifs de chaîne utilisés pour référencer une clé.
            Si une clé est créée avec des noms alternatifs, alors le chiffrement peut se référer
            à la clé par le nom alternatif unique au lieu de par
            <code class="literal">_id</code>.
           </p>
          </td>
         </tr>

         <tr>
          <td>keyMaterial</td>
          <td><span class="classname"><a href="class.mongodb-bson-binary.php" class="classname">MongoDB\BSON\Binary</a></span></td>
          <td>
           <p class="para">
            Une valeur optionnelle de 96 octets à utiliser comme matériel de clé
            pour le document clé en cours de création. Si keyMaterial est donné,
            le matériel de clé personnalisé est utilisé pour chiffrer et déchiffrer
            les données. Sinon, le matériel de clé pour le nouveau document clé est
            généré à partir d&#039;un dispositif aléatoire cryptographiquement sécurisé.
           </p>
          </td>
         </tr>

        </tbody>
       
      </table>

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


 <div class="refsect1 returnvalues" id="refsect1-mongodb-driver-clientencryption.createdatakey-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Renvoie un identifiant du nouveau document clé en tant qu&#039;objet
   <span class="classname"><a href="class.mongodb-bson-binary.php" class="classname">MongoDB\BSON\Binary</a></span> avec le sous-type 4 (UUID).
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-clientencryption.createdatakey-errors">
  <h3 class="title">Erreurs / Exceptions</h3>
  <ul class="simplelist">
   <li>Lance une exception <span class="classname"><strong class="classname">MongoDB\Driver\AuthenticationException</strong></span> si une identification est nécessaire mais qu'elle échoue</li><li>Lance une exception <span class="classname"><strong class="classname">MongoDB\Driver\ConnectionException</strong></span> si la connexion au serveur échoue pour une autre raison qu'en raison d'un problème d'identification</li>
   <li>Lance une <span class="classname"><a href="class.mongodb-driver-exception-runtimeexception.php" class="classname">MongoDB\Driver\Exception\RuntimeException</a></span> sur d'autres erreurs.</li>
  </ul>
 </div>


 <div class="refsect1 changelog" id="refsect1-mongodb-driver-clientencryption.createdatakey-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 de <code class="literal">&quot;delegated&quot;</code> aux options masterKey du fournisseur KMIP.
       </td>
      </tr>

      <tr>
       <td>PECL mongodb 1.15.0</td>
       <td>
        Ajout de l&#039;option <code class="literal">&quot;keyMaterial&quot;</code>.
       </td>
      </tr>

      <tr>
       <td>PECL mongodb 1.10.0</td>
       <td>
        Azure et GCP sont désormais pris en charge en tant que fournisseurs KMS pour
        le chiffrement côté client.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


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