Skip to content

Um exemplo de como utilizar criptografia com MongoDB em C# com Advanced Encryption Standard algorithm (AES) e Galois Counter Mode (GCM).

Notifications You must be signed in to change notification settings

guilhermesalvi/mongodb-encryption-aes-gcm

Repository files navigation

mongodb-encryption-aes-gcm

An example of how you can encrypt data to be saved in MongoDb with C#. We are using Advanced Encryption Standard algorithm (AES) with Galois Counter Mode (GCM).

With this approach you can annotate any property of string type with ProtectedPersonalData attribute:

[ProtectedPersonalData]
public string CustomerName { get; set; }

Then register ProtectedPersonalDataConvention in startup with an extension method:

public static void AddMongoDb(this IServiceCollection services)
{
    //... other services

    services.AddSingleton<DataSecurityService>();
    var securityService = services.BuildServiceProvider().GetRequiredService<DataSecurityService>();
        ConventionsRegister.RegisterConventions(securityService);
}

About

Um exemplo de como utilizar criptografia com MongoDB em C# com Advanced Encryption Standard algorithm (AES) e Galois Counter Mode (GCM).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages