PHP 8.1.28 Released!

MongoDB\Driver\Manager::createClientEncryption

(mongodb >=1.7.0)

MongoDB\Driver\Manager::createClientEncryptionCreate a new ClientEncryption object

Description

final public MongoDB\Driver\Manager::createClientEncryption(array $options): MongoDB\Driver\ClientEncryption

Constructs a new MongoDB\Driver\ClientEncryption object with the specified options.

Liste de paramètres

options

options
Option Type Description
keyVaultClient MongoDB\Driver\Manager Le Manager utilisé pour router les requêtes de clés de données à un cluster MongoDB différent. Par défaut, le Manager et cluster courant et utilisé.
keyVaultNamespace chaîne de caractères Un nom d'espace complètement qualifié (par exemple "databaseName.collectionName") dénotant la collection qui contient toutes les clés de données utilisé pour le chiffrement et déchiffrement. Cette option est requise.
kmsProviders tableau

Un document contenant la configuration d'un ou plusieurs fournisseurs KMS, qui sont utilisés pour chiffrer les clés de données. Les fournisseurs supporté sont "aws", "azure", "gcp" et "local", et au moins un doit être spécifié.

Si un document vide est spécifié pour "aws", "azure", ou "gcp", le pilote tentera de configurer le fournisseur en utilisant » Automatic Credentials.

Le format pour "aws" est le suivant :

aws: {
    accessKeyId: <string>,
    secretAccessKey: <string>,
    sessionToken: <optional string>
}

Le format pour "azure" est le suivant :

azure: {
    tenantId: <string>,
    clientId: <string>,
    clientSecret: <string>,
    identityPlatformEndpoint: <optional string> // Defaults to "login.microsoftonline.com"

}

Le format pour "gcp" est le suivant :

gcp: {
    email: <string>,
    privateKey: <base64 string>|<MongoDB\BSON\Binary>,
    endpoint: <optional string> // Defaults to "oauth2.googleapis.com"

}

Le format pour "kmip" est le suivant :

kmip: {
    endpoint: <string>
}

Le format pour "local" est le suivant :

local: {
    // 96-byte master key used to encrypt/decrypt data keys
    key: <base64 string>|<MongoDB\BSON\Binary>
}
tlsOptions array

Un document contenant la configuration TLS d'un ou plusieurs fournisseurs KMS. Les fournisseurs supporté sont "aws", "azure", "gcp" et "kmip". Tous les fournisseurs supportent les options suivantes :

<provider>: {
    tlsCaFile: <optional string>,
    tlsCertificateKeyFile: <optional string>,
    tlsCertificateKeyFilePassword: <optional string>,
    tlsDisableOCSPEndpointCheck: <optional bool>
}

Valeurs de retour

Returns a new MongoDB\Driver\ClientEncryption instance.

Erreurs / Exceptions

  • Lance une exception MongoDB\Driver\InvalidArgumentException lors d'une erreur survenue pendant l'analyse d'un argument.
  • Throws MongoDB\Driver\Exception\RuntimeException if the extension was compiled without libmongocrypt support

Historique

Version Description
PECL mongodb 1.16.0

The AWS KMS provider for client-side encryption now accepts a "sessionToken" option, which can be used to authenticate with temporary AWS credentials.

Added "tlsDisableOCSPEndpointCheck" to the "tlsOptions" option.

If an empty document is specified for the "azure" or "gcp" KMS provider, the driver will attempt to configure the provider using » Automatic Credentials.

PECL mongodb 1.15.0

If an empty document is specified for the "aws" KMS provider, the driver will attempt to configure the provider using » Automatic Credentials.

PECL mongodb 1.12.0

KMIP is now supported as a KMS provider for client-side encryption and may be configured in the "kmsProviders" option.

Added the "tlsOptions" option.

PECL mongodb 1.10.0 Azure and GCP are now supported as KMS providers for client-side encryption and may be configured in the "kmsProviders" option. Base64-encoded strings are now accepted as an alternative to MongoDB\BSON\Binary for options within "kmsProviders".

Voir aussi

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top