Class AdvancedEncryptionStandardUtility
This utility class is designed to make System.Security.Cryptography.Aes operations easier to work with.
Inheritance
Namespace: Cuemon.Security.Cryptography
Assembly: Cuemon.Security.dll
Syntax
public static class AdvancedEncryptionStandardUtility
Fields
| Improve this DocBlockSize
Gets the block size (bits) for the Advanced Encryption Standard (AES)
Declaration
public static readonly byte BlockSize
Field Value
Type | Description |
---|---|
System.Byte |
Methods
| Improve this DocDecrypt(Byte[], Byte[], Byte[])
Decrypts the specified value from the provided key
and initializationVector
.
Declaration
public static byte[] Decrypt(byte[] value, byte[] key, byte[] initializationVector)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | value | The value to decrypt. |
System.Byte[] | key | The key to use in the decryption algorithm. |
System.Byte[] | initializationVector | The initialization vector (IV) to use in the decryption algorithm. |
Returns
Type | Description |
---|---|
System.Byte[] | The decrypted value. |
Encrypt(Byte[], Byte[], Byte[])
Encrypts the specified value from the provided key
and initializationVector
.
Declaration
public static byte[] Encrypt(byte[] value, byte[] key, byte[] initializationVector)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | value | The value to encrypt. |
System.Byte[] | key | The key to use in the encryption algorithm. |
System.Byte[] | initializationVector | The initialization vector (IV) to use in the encryption algorithm. |
Returns
Type | Description |
---|---|
System.Byte[] | The encrypted value. |
GenerateInitializationVector()
Generates a random 128 bit initialization vector (IV) to be used for the algorithm.
Declaration
public static byte[] GenerateInitializationVector()
Returns
Type | Description |
---|---|
System.Byte[] | A random 128 bit generated initialization vector (IV). |
GenerateKey(AdvancedEncryptionStandardKeySize)
Generates a random key to be used for the algorithm.
Declaration
public static byte[] GenerateKey(AdvancedEncryptionStandardKeySize keySize)
Parameters
Type | Name | Description |
---|---|---|
AdvancedEncryptionStandardKeySize | keySize | The size of the key. |
Returns
Type | Description |
---|---|
System.Byte[] | A random generated key with the specified |