BogaNet 1.4.0
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
BogaNet.Helper.AESHelper Class Referenceabstract

Helper for AES cryptography. More...

Static Public Member Functions

static byte[] GenerateIV (int length=16)
 Generates a secure IV for AES.
 
static byte[] GenerateKey (int length=16)
 Generates a secure key for AES.
 
static bool EncryptFile (string file, byte[] key, byte[] IV)
 Encrypts a file with AES.
 
static async Task< bool > EncryptFileAsync (string file, byte[] key, byte[] IV)
 Encrypts a file with AES asynchronously.
 
static bool DecryptFile (string file, byte[] key, byte[] IV)
 Decrypts a file with AES.
 
static async Task< bool > DecryptFileAsync (string file, byte[] key, byte[] IV)
 Decrypts a file with AES asynchronously.
 
static byte[] Encrypt (string textToEncrypt, byte[] key, byte[] IV, Encoding? encoding=null)
 Encrypts a string with AES.
 
static byte[] Encrypt (byte[] dataToEncrypt, byte[] key, byte[] IV)
 Encrypts a byte-array with AES.
 
static async Task< byte[]> EncryptAsync (byte[] dataToEncrypt, byte[] key, byte[] IV)
 Encrypts a byte-array with AES asynchronously.
 
static byte[] Decrypt (byte[] dataToDecrypt, byte[] key, byte[] IV)
 Decrypts a byte-array with AES.
 
static async Task< byte[]> DecryptAsync (byte[] dataToDecrypt, byte[] key, byte[] IV)
 Decrypts a byte-array with AES asynchronously.
 

Detailed Description

Helper for AES cryptography.

Member Function Documentation

◆ Decrypt()

static byte[] BogaNet.Helper.AESHelper.Decrypt ( byte[] dataToDecrypt,
byte[] key,
byte[] IV )
static

Decrypts a byte-array with AES.

Parameters
dataToDecryptbyte-array to decrypt
keyKey for the byte-array as byte-array
IVIV (initial vector) for AES
Returns
Decrypted byte-array
Exceptions
Exception

◆ DecryptAsync()

static async Task< byte[]> BogaNet.Helper.AESHelper.DecryptAsync ( byte[] dataToDecrypt,
byte[] key,
byte[] IV )
static

Decrypts a byte-array with AES asynchronously.

Parameters
dataToDecryptbyte-array to decrypt
keyKey for the byte-array as byte-array
IVIV (initial vector) for AES
Returns
Decrypted byte-array
Exceptions
Exception

◆ DecryptFile()

static bool BogaNet.Helper.AESHelper.DecryptFile ( string file,
byte[] key,
byte[] IV )
static

Decrypts a file with AES.

Parameters
fileFile to decrypt
keyKey for the file as byte-array
IVIV (initial vector) for AES
Returns
True if the operation was successful
Exceptions
Exception

◆ DecryptFileAsync()

static async Task< bool > BogaNet.Helper.AESHelper.DecryptFileAsync ( string file,
byte[] key,
byte[] IV )
static

Decrypts a file with AES asynchronously.

Parameters
fileFile to decrypt
keyKey for the file as byte-array
IVIV (initial vector) for AES
Returns
True if the operation was successful
Exceptions
Exception

◆ Encrypt() [1/2]

static byte[] BogaNet.Helper.AESHelper.Encrypt ( byte[] dataToEncrypt,
byte[] key,
byte[] IV )
static

Encrypts a byte-array with AES.

Parameters
dataToEncryptbyte-array to encrypt
keyKey for the byte-array as byte-array
IVIV (initial vector) for AES
Returns
Encrypted byte-array
Exceptions
Exception

◆ Encrypt() [2/2]

static byte[] BogaNet.Helper.AESHelper.Encrypt ( string textToEncrypt,
byte[] key,
byte[] IV,
Encoding? encoding = null )
static

Encrypts a string with AES.

Parameters
textToEncryptstring to encrypt
keyKey for the byte-array as byte-array
IVIV (initial vector) for AES
encodingEncoding of the string (optional, default: UTF8)
Returns
Encrypted byte-array
Exceptions
Exception

◆ EncryptAsync()

static async Task< byte[]> BogaNet.Helper.AESHelper.EncryptAsync ( byte[] dataToEncrypt,
byte[] key,
byte[] IV )
static

Encrypts a byte-array with AES asynchronously.

Parameters
dataToEncryptbyte-array to encrypt
keyKey for the byte-array as byte-array
IVIV (initial vector) for AES
Returns
Encrypted byte-array
Exceptions
Exception

◆ EncryptFile()

static bool BogaNet.Helper.AESHelper.EncryptFile ( string file,
byte[] key,
byte[] IV )
static

Encrypts a file with AES.

Parameters
fileFile to encrypt
keyKey for the file as byte-array
IVIV (initial vector) for AES
Returns
True if the operation was successful
Exceptions
Exception

◆ EncryptFileAsync()

static async Task< bool > BogaNet.Helper.AESHelper.EncryptFileAsync ( string file,
byte[] key,
byte[] IV )
static

Encrypts a file with AES asynchronously.

Parameters
fileFile to encrypt
keyKey for the file as byte-array
IVIV (initial vector) for AES
Returns
True if the operation was successful
Exceptions
Exception

◆ GenerateIV()

static byte[] BogaNet.Helper.AESHelper.GenerateIV ( int length = 16)
static

Generates a secure IV for AES.

Parameters
lengthLength of the IV (optional, range: 16 - 32, default: 16)
Returns
IV as byte-array

◆ GenerateKey()

static byte[] BogaNet.Helper.AESHelper.GenerateKey ( int length = 16)
static

Generates a secure key for AES.

Parameters
lengthLength of the key (optional, range: 16 - 128, default: 16)
Returns
Secure key as byte-array

The documentation for this class was generated from the following file: