From 6485968c3b04cedbcde2d448caa79d065507e1f5 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 8 Oct 2022 15:41:01 -0500 Subject: docs for Aes --- src/slskd/Common/Cryptography/Aes.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') 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; + /// + /// Decrypts the specified with the specified . + /// + /// The encrypted data to decrypt. + /// The encryption key. + /// The decrypted data. 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(); } + /// + /// Encrypts the specified with the specified . + /// + /// The plain data to encrypt. + /// The encryption key. + /// The encrypted data. 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(); } + /// + /// Generates a random key using the default key and block sizes. + /// + /// The generated key. public static byte[] GenerateRandomKey() { using var aes = System.Security.Cryptography.Aes.Create(); -- cgit v1.2.3