Skip to main content

Posts

Showing posts from March, 2020

Encrypt Decrypt a string in C# dotnet core 3.x - Data Security!

Encryption is the process that converting normal message Plain-text into Cipher-text . It is a process of converting normal data into an unreadable form. It helps you to avoid any unauthorized access to data. Decryption is the process that converting Cipher-text into its original form Plain-text . It is a method of converting the unreadable/coded data into its original form. This example will help you to encrypt and decrypt a plan text as string in dotnet core c#, using System.IO; using System.Text; using System.Security.Cryptography; using System; public static class EncryptionHelper {   public static string Encrypt( string clearText)   {     string EncryptionKey = "Anilkey123" ;     byte [] clearBytes = Encoding.Unicode.GetBytes(clearText);     using (Aes encryptor = Aes.Create())     {         Rfc2898DeriveBytes pdb = new Rfc28...