If you liked the project or if EntityFrameworkCore.DataEncryption helped you, please give a star.
EntityFrameworkCore.DataEncryption with the entity framework core value converter feature, it allows you to store your data by encrypting it.
Install-Package EntityFrameworkCore.DataEncryption.Conversions
Then mark the columns to be encrypted in DbContext.
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Author>(entity =>
{
entity
.Property(p => p.Id)
.UseIdentityColumn();
entity
.Property(p => p.Name)
.IsRequired()
.HasMaxLength(2048);
entity
.Property(p => p.Surname)
.IsRequired()
.HasMaxLength(2048);
entity
.Property(p => p.Phone)
.IsRequired()
.HasConversion(new EncryptValueConverter(key:"89acMXSBpuEBDWHZ"));
});
base.OnModelCreating(modelBuilder);
}
Visit wiki documentation. Wiki
See for more information visit sample project