Table of Contents

Class AesEncryptionStrategy

Namespace
C4.Net.Encryption
Assembly
C4.Net.Client.dll

Encrypts workspace JSON using AES/CBC with PBKDF2-derived keys.

[DataContract]
public class AesEncryptionStrategy : EncryptionStrategy
Inheritance
AesEncryptionStrategy
Inherited Members

Constructors

AesEncryptionStrategy()

Initializes an empty AES strategy for serializers.

public AesEncryptionStrategy()

AesEncryptionStrategy(int, int, string)

Creates an AES strategy with generated salt and IV values.

public AesEncryptionStrategy(int keySize, int iterationCount, string passphrase)

Parameters

keySize int

The AES key size in bits.

iterationCount int

The PBKDF2 iteration count.

passphrase string

The passphrase used to derive the encryption key.

AesEncryptionStrategy(int, int, string, string, string)

Creates an AES strategy from persisted encryption parameters.

public AesEncryptionStrategy(int keySize, int iterationCount, string salt, string iv, string passphrase)

Parameters

keySize int

The AES key size in bits.

iterationCount int

The PBKDF2 iteration count.

salt string

The hexadecimal salt.

iv string

The hexadecimal initialization vector.

passphrase string

The passphrase used to derive the encryption key.

AesEncryptionStrategy(string)

Creates an AES strategy with default key derivation settings.

public AesEncryptionStrategy(string passphrase)

Parameters

passphrase string

The passphrase used to derive the encryption key.

Properties

IterationCount

The PBKDF2 iteration count used to derive the encryption key.

[DataMember(Name = "iterationCount", EmitDefaultValue = false)]
public int IterationCount { get; }

Property Value

int

Iv

The hexadecimal initialization vector used during encryption.

[DataMember(Name = "iv", EmitDefaultValue = false)]
public string Iv { get; }

Property Value

string

KeySize

The AES key size in bits.

[DataMember(Name = "keySize", EmitDefaultValue = false)]
public int KeySize { get; }

Property Value

int

Salt

The hexadecimal salt used during key derivation.

[DataMember(Name = "salt", EmitDefaultValue = false)]
public string Salt { get; }

Property Value

string

Type

Identifies this strategy as AES-based encryption.

public override string Type { get; }

Property Value

string

Methods

Decrypt(string)

Decrypts ciphertext previously produced by this strategy.

public override string Decrypt(string ciphertext)

Parameters

ciphertext string

The Base64-encoded ciphertext.

Returns

string

The decrypted plaintext.

Encrypt(string)

Encrypts plaintext using the configured AES parameters.

public override string Encrypt(string plaintext)

Parameters

plaintext string

The plaintext to encrypt.

Returns

string

The Base64-encoded ciphertext.