Table of Contents

Class Aes

Namespace
System.Security.Cryptography
Assembly
nanoFramework.System.Security.Cryptography.dll

Provides an Advanced Encryption Standard (AES) algorithm to encrypt and decrypt data.

public class Aes
Inheritance
Aes
Inherited Members
Extension Methods

Constructors

Aes(CipherMode)

Initializes a new instance of the Aes class.

public Aes(CipherMode mode)

Parameters

mode CipherMode

Properties

IV

Gets or sets the initialization vector for the symmetric algorithm.

public byte[] IV { get; set; }

Property Value

byte[]

The initialization vector.

Key

Gets or sets the secret key for the symmetric algorithm.

public byte[] Key { get; set; }

Property Value

byte[]

The secret key for the symmetric algorithm.

Mode

Gets or sets the mode for operation of the symmetric algorithm.

public CipherMode Mode { get; set; }

Property Value

CipherMode

The mode for operation of the symmetric algorithm.

Methods

Decrypt(byte[])

Decrypts data using cipher specified in Mode.

public byte[] Decrypt(byte[] data)

Parameters

data byte[]

The data to decrypt.

Returns

byte[]

The decrypted plaintext data.

Exceptions

InvalidOperationException

If the Key hasn't been set.

ArgumentException

If the Key is not a multiple of the block size (16 bytes for AES).

-OR-

If the data is not a multiple of the block size (16 bytes for AES).

Encrypt(byte[])

Encrypts data using the cipher specified in Mode.

public byte[] Encrypt(byte[] data)

Parameters

data byte[]

The data to encrypt.

Returns

byte[]

The encrypted ciphertext data.

Exceptions

InvalidOperationException

If the Key hasn't been set.

ArgumentException

If the Key is not a multiple of the block size (16 bytes for AES).

-OR-

If the data is not a multiple of the block size (16 bytes for AES).

GenerateIV()

Generate a random initialization vector

public void GenerateIV()