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
keySizeintThe AES key size in bits.
iterationCountintThe PBKDF2 iteration count.
passphrasestringThe 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
keySizeintThe AES key size in bits.
iterationCountintThe PBKDF2 iteration count.
saltstringThe hexadecimal salt.
ivstringThe hexadecimal initialization vector.
passphrasestringThe passphrase used to derive the encryption key.
AesEncryptionStrategy(string)
Creates an AES strategy with default key derivation settings.
public AesEncryptionStrategy(string passphrase)
Parameters
passphrasestringThe 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
Iv
The hexadecimal initialization vector used during encryption.
[DataMember(Name = "iv", EmitDefaultValue = false)]
public string Iv { get; }
Property Value
KeySize
The AES key size in bits.
[DataMember(Name = "keySize", EmitDefaultValue = false)]
public int KeySize { get; }
Property Value
Salt
The hexadecimal salt used during key derivation.
[DataMember(Name = "salt", EmitDefaultValue = false)]
public string Salt { get; }
Property Value
Type
Identifies this strategy as AES-based encryption.
public override string Type { get; }
Property Value
Methods
Decrypt(string)
Decrypts ciphertext previously produced by this strategy.
public override string Decrypt(string ciphertext)
Parameters
ciphertextstringThe Base64-encoded ciphertext.
Returns
- string
The decrypted plaintext.
Encrypt(string)
Encrypts plaintext using the configured AES parameters.
public override string Encrypt(string plaintext)
Parameters
plaintextstringThe plaintext to encrypt.
Returns
- string
The Base64-encoded ciphertext.