Here's an example of how to use the Rijndael encryption algorithm using the EscNet micro framework
OBS: The cryptographic key must be a minimum of 16 characters and a maximum of 32.
First configure your dependency in your Startup.cs
services.AddRijndaelCryptography("YOUR ENCRYPTION KEY");
Now receive your dependency via constructor.
private readonly IRijndaelCryptography _rijndaelCryptography; public MyClass(IRijndaelCryptography rijndaelCryptography){ _rijndaelCryptography = rijndaelCryptography; }
To encrypt phrase use:
string encryptedPhrase = _rijndaelCryptography.Encrypt("phrase to be encrypted");
And to decrypt the phrase use
string decryptedPhrase = _rijndaelCryptography.Decrypt("phrase to be decrypted");
2021 ©
There was an error while loading. Please reload this page.