/// <summary> /// Encrypts the specified value. /// </summary> /// <param name="value">The value.</param> /// <param name="encryptOptions">The encrypt options.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The encrypted value.</returns> public BsonBinaryData Encrypt(BsonValue value, EncryptOptions encryptOptions, CancellationToken cancellationToken) { return(_libMongoCryptController.EncryptField( value, encryptOptions.KeyId, encryptOptions.AlternateKeyName, encryptOptions.Algorithm, cancellationToken)); }
/// <summary> /// [Beta] Encrypts the specified value. /// </summary> /// <param name="value">The value.</param> /// <param name="encryptOptions">The encrypt options.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The encrypted value.</returns> public BsonBinaryData Encrypt(BsonValue value, EncryptOptions encryptOptions, CancellationToken cancellationToken) { var algorithm = (EncryptionAlgorithm)Enum.Parse(typeof(EncryptionAlgorithm), encryptOptions.Algorithm); return(_libMongoCryptController.EncryptField( value, encryptOptions.KeyId, encryptOptions.AlternateKeyName, algorithm, cancellationToken)); }