diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-10-08 15:41:01 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-10-08 15:41:01 -0500 |
| commit | 6485968c3b04cedbcde2d448caa79d065507e1f5 (patch) | |
| tree | 8aa07ce97822d5210b5fc169da2afa268bacd001 /src | |
| parent | 216572289f0956ab9cb7461cc90b2f2c2c2f89a8 (diff) | |
| download | slskd-6485968c3b04cedbcde2d448caa79d065507e1f5.tar.gz | |
docs for Aes
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Common/Cryptography/Aes.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/slskd/Common/Cryptography/Aes.cs b/src/slskd/Common/Cryptography/Aes.cs index fd071403..9828d7f8 100644 --- a/src/slskd/Common/Cryptography/Aes.cs +++ b/src/slskd/Common/Cryptography/Aes.cs @@ -32,6 +32,12 @@ namespace slskd.Cryptography private static readonly int KeySizeInBits = 256; private static readonly int KeySizeInBytes = KeySizeInBits / 8; + /// <summary> + /// Decrypts the specified <paramref name="encryptedBytes"/> with the specified <paramref name="key"/>. + /// </summary> + /// <param name="encryptedBytes">The encrypted data to decrypt.</param> + /// <param name="key">The encryption key.</param> + /// <returns>The decrypted data.</returns> public static byte[] Decrypt(byte[] encryptedBytes, byte[] key) { using var aes = System.Security.Cryptography.Aes.Create(); @@ -51,6 +57,12 @@ namespace slskd.Cryptography return outputStream.ToArray(); } + /// <summary> + /// Encrypts the specified <paramref name="plainBytes"/> with the specified <paramref name="key"/>. + /// </summary> + /// <param name="plainBytes">The plain data to encrypt.</param> + /// <param name="key">The encryption key.</param> + /// <returns>The encrypted data.</returns> public static byte[] Encrypt(byte[] plainBytes, byte[] key) { using var aes = System.Security.Cryptography.Aes.Create(); @@ -71,6 +83,10 @@ namespace slskd.Cryptography return outputStream.ToArray(); } + /// <summary> + /// Generates a random key using the default key and block sizes. + /// </summary> + /// <returns>The generated key.</returns> public static byte[] GenerateRandomKey() { using var aes = System.Security.Cryptography.Aes.Create(); |
