@@ -36,82 +36,9 @@ Now, you can reference the SafeCrypt library in your C# project.
3636
3737## Aes
3838To use AES encryption in your C# application, access the static Aes class directly.
39- Call the provided methods; Here's a simple example:
40-
41- ``` csharp
42- using SafeCrypt .AES ;
43- using SafeCrypt .Models ;
44-
45- class Program
46- {
47- static async Task Main ()
48- {
49-
50- var encryptedData = await Aes .EncryptToBase64StringAsync (" Hello, World!" , " gdjdtsraewsuteastwerse=="
51-
52- Console .WriteLine ($" Encrypted Data: {encryptedData .EncryptedData }" );
53- Console .WriteLine ($" Initialization Vector: {encryptedData .Iv }" );
54-
55- var parameterToDecrypt = new DecryptionParameters
56- {
57- DataToDecrypt = encryptedData .EncryptedData ,
58- SecretKey = encryptedData .SecretKey ,
59- IV = encryptedData .IV
60-
61- };
62-
63- var data = await Aes .DecryptFromBase64StringAsync (parameterToDecrypt );
64-
65- Console .WriteLine ($" Decrypted Data: {data .DecryptedData }" );
66- Console .WriteLine ($" Initialization Vector: {data .Iv }" );
67- }
68- }
69-
70-
71- ------------------------------------------------------------------------------------------------------ -
72-
73- using SafeCrypt .AES ;
74- using SafeCrypt .Models ;
75-
76- class Program
77- {
78- static async Task Main ()
79- {
80- var dataToEncrypt = " Data to Encrypt" ;
81-
82- var iv = " gyrthusdgythisdg" ;
83- var secret = " hghjuytsdfraestwsgtere==" ;
84-
85- var encryptionParam = new EncryptionParameters
86- {
87- DataToEncrypt = dataToEncrypt ,
88- IV = iv ,
89- SecretKey = secret
90- };
91-
92-
93- var response = await Aes .EncryptToBase64StringAsync (encryptionParam .DataToEncrypt , secret );
94-
95- Console .WriteLine (response .EncryptedData );
96- Console .WriteLine (response .Iv );
97- Console .WriteLine (response .SecretKey );
98-
99- var decryptorParam = new DecryptionParameters
100- {
101- IV = response .Iv ,
102- SecretKey = secret ,
103- DataToDecrypt = response .EncryptedData
104- };
105-
106- var decryptionData = await Aes .DecryptFromBase64StringAsync (decryptorParam );
107-
108- Console .WriteLine (decryptionData .DecryptedData );
109- Console .WriteLine (decryptionData .Iv );
110- Console .WriteLine (decryptionData .SecretKey );
111- }
112- }
113- ```
39+ Call the provided methods;
11440
41+ Check the [ Aes.md] ( doc/Aes.md ) documentation for guidance.
11542
11643## Rsa
11744This library provides a straightforward implementation of RSA encryption and decryption in C# using the .NET ` RSACryptoServiceProvider ` .
0 commit comments