File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// See https://aka.ms/new-console-template for more information
2+ using SafeCrypt . App . Usage ;
23
3- using SafeCrypt . AES ;
4- using SafeCrypt . Models ;
4+ RsaUsage . Execute ( ) ;
55
6- var dataToEncrypt = "Data to Encrypt" ;
7- var secret = "hghjuytsdfraestwsgtere==" ;
8-
9- // Encryption process
10- // this method generates a random IV key for the encryption process
11- // the IV is returned in the response with other properties
12- var response = await Aes . EncryptToBase64StringAsync ( dataToEncrypt , secret ) ;
13-
14- Console . WriteLine ( "............Encryption Started............" ) ;
15-
16- Console . WriteLine ( $ "Encrypted data: { response . EncryptedData } ") ;
17- Console . WriteLine ( $ "IV key: { response . Iv } ") ;
18- Console . WriteLine ( $ "Secret key: { response . SecretKey } ") ;
19-
20-
21- // Decryption process
22- var decryptorParam = new DecryptionParameters
23- {
24- IV = response . Iv ,
25- SecretKey = secret ,
26- DataToDecrypt = response . EncryptedData
27- } ;
28-
29- var decryptionData = await Aes . DecryptFromBase64StringAsync ( decryptorParam ) ;
30-
31- Console . WriteLine ( "............Decryption Started............" ) ;
32- Console . WriteLine ( $ "Decrypted data: { decryptionData . DecryptedData } ") ;
33- Console . WriteLine ( $ "IV key: { decryptionData . Iv } ") ;
34- Console . WriteLine ( $ "Secret key: { decryptionData . SecretKey } ") ;
6+ AesUsage . Execute ( ) ;
357
368Console . ReadLine ( ) ;
You can’t perform that action at this time.
0 commit comments