Table of Contents

Class Aes256

Namespace
CryptoHives.Foundation.Security.Cryptography.Cipher
Assembly
CryptoHives.Foundation.Security.Cryptography.dll

AES-256 symmetric cipher implementation.

public sealed class Aes256 : SymmetricCipher, IDisposable
Inheritance
Aes256
Implements
Inherited Members

Remarks

AES-256 uses a 256-bit (32-byte) key with 14 rounds of encryption. It provides the highest security level of all AES variants.

Security level: 256 bits (quantum: 128 bits with Grover's algorithm)

Recommendations:

  • Use AES-256 for long-term security requirements
  • Required for TOP SECRET data per NSA Suite B
  • Recommended for post-quantum resistance (Grover's algorithm halves security)

Example usage:

using var aes = Aes256.Create();
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
aes.GenerateKey();
aes.GenerateIV();

byte[] ciphertext = aes.Encrypt(plaintext); byte[] decrypted = aes.Decrypt(ciphertext);

Constructors

Aes256()

Initializes a new instance of the Aes256 class.

public Aes256()

Fields

KeySizeBits

Key size in bits for AES-256.

public const int KeySizeBits = 256

Field Value

int

KeySizeBytes

Key size in bytes for AES-256.

public const int KeySizeBytes = 32

Field Value

int

Properties

AlgorithmName

Gets the name of the cipher algorithm.

public override string AlgorithmName { get; }

Property Value

string

Examples

"AES-256", "ChaCha20", "AES-256-GCM"

IVSize

Gets the required IV/nonce size in bytes for the current mode.

public override int IVSize { get; }

Property Value

int

Methods

Create()

Creates a new instance of the Aes256 cipher.

public static Aes256 Create()

Returns

Aes256

A new AES-256 cipher instance.

CreateCipherDecryptor(ReadOnlySpan<byte>, ReadOnlySpan<byte>)

Creates a decryptor transform using the specified key and IV.

protected override ICipherTransform CreateCipherDecryptor(ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)

Parameters

key ReadOnlySpan<byte>

The secret key.

iv ReadOnlySpan<byte>

The initialization vector or nonce.

Returns

ICipherTransform

A new cipher decryptor transform.

CreateCipherEncryptor(ReadOnlySpan<byte>, ReadOnlySpan<byte>)

Creates an encryptor transform using the specified key and IV.

protected override ICipherTransform CreateCipherEncryptor(ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)

Parameters

key ReadOnlySpan<byte>

The secret key.

iv ReadOnlySpan<byte>

The initialization vector or nonce.

Returns

ICipherTransform

A new cipher encryptor transform.