コード例 #1
0
 /// <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 Task <BsonBinaryData> EncryptAsync(BsonValue value, EncryptOptions encryptOptions, CancellationToken cancellationToken)
 {
     return(_libMongoCryptController.EncryptFieldAsync(
                value,
                encryptOptions.KeyId,
                encryptOptions.AlternateKeyName,
                encryptOptions.Algorithm,
                cancellationToken));
 }
コード例 #2
0
        /// <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 Task <BsonBinaryData> EncryptAsync(BsonValue value, EncryptOptions encryptOptions, CancellationToken cancellationToken)
        {
            var algorithm = (EncryptionAlgorithm)Enum.Parse(typeof(EncryptionAlgorithm), encryptOptions.Algorithm);

            return(_libMongoCryptController.EncryptFieldAsync(
                       value,
                       encryptOptions.KeyId,
                       encryptOptions.AlternateKeyName,
                       algorithm,
                       cancellationToken));
        }