Arci.Networking
Arci.Networking.Security.AesEncryptor Class Reference

Aes encryptor More...

Inheritance diagram for Arci.Networking.Security.AesEncryptor:
Arci.Networking.Security.ISymmetricEncryptor

Public Member Functions

 AesEncryptor (AesEncryptionType type=AesEncryptionType.Aes128Bits)
 Creates AES instance More...
 
 AesEncryptor (byte[] key, byte[] iVec)
 Creates AES instance More...
 
byte [] Encrypt (string toEncrypt, Encoding encoding=null)
 Encrypts data with current encryptor More...
 
byte [] Encrypt (byte[] toEncrypt)
 Encrypts data More...
 
string Decrypt (byte[] toDecode, Encoding encoding)
 Decrypts data More...
 
byte [] Decrypt (byte[] toDecode)
 Decrypts data More...
 
void Dispose ()
 Clears allocated resources More...
 

Public Attributes

byte [] Key => aes.Key.ToArray()
 Returns copy of the current aes key More...
 
byte [] IVec => aes.IV.ToArray()
 Returns copy of the current aes iVec More...
 
byte [] Encryptors => aes.Key.Concat(aes.IV).ToArray()
 Current encryptors. More...
 

Properties

PaddingMode PaddingMode [get, set]
 Aes padding mode to be used More...
 

Detailed Description

Aes encryptor

Constructor & Destructor Documentation

§ AesEncryptor() [1/2]

Arci.Networking.Security.AesEncryptor.AesEncryptor ( AesEncryptionType  type = AesEncryptionType.Aes128Bits)
inline

Creates AES instance

Parameters
typeBit version type of Aes to be used

§ AesEncryptor() [2/2]

Arci.Networking.Security.AesEncryptor.AesEncryptor ( byte []  key,
byte []  iVec 
)
inline

Creates AES instance

Parameters
keyKey to be set as AES key
iVecIVec to be set as AES iVec

Member Function Documentation

§ Decrypt() [1/2]

string Arci.Networking.Security.AesEncryptor.Decrypt ( byte []  toDecode,
Encoding  encoding 
)
inline

Decrypts data

Parameters
toDecodeData to decrypt
encodingEncoding type of string. If null provided then ASCII will be used
Returns
Decrypted data

§ Decrypt() [2/2]

byte [] Arci.Networking.Security.AesEncryptor.Decrypt ( byte []  toDecode)
inline

Decrypts data

Parameters
toDecodeData to decrypt
Returns
Decrypted data

Implements Arci.Networking.Security.ISymmetricEncryptor.

§ Dispose()

void Arci.Networking.Security.AesEncryptor.Dispose ( )
inline

Clears allocated resources

§ Encrypt() [1/2]

byte [] Arci.Networking.Security.AesEncryptor.Encrypt ( string  toEncrypt,
Encoding  encoding = null 
)
inline

Encrypts data with current encryptor

Parameters
toEncryptData to encrypt
encodingEncoding type of string. If null provided then ASCII will be used
Returns
Encrypted data

§ Encrypt() [2/2]

byte [] Arci.Networking.Security.AesEncryptor.Encrypt ( byte []  toEncrypt)
inline

Encrypts data

Parameters
toEncryptData to encrypt
Returns
Encrypted data

Implements Arci.Networking.Security.ISymmetricEncryptor.

Member Data Documentation

§ Encryptors

byte [] Arci.Networking.Security.AesEncryptor.Encryptors => aes.Key.Concat(aes.IV).ToArray()

Current encryptors.

First 16/24/32 (based on AesEncryptionType) bytes represent key, last 16 bytes represent iVec

§ IVec

byte [] Arci.Networking.Security.AesEncryptor.IVec => aes.IV.ToArray()

Returns copy of the current aes iVec

§ Key

byte [] Arci.Networking.Security.AesEncryptor.Key => aes.Key.ToArray()

Returns copy of the current aes key

Property Documentation

§ PaddingMode

PaddingMode Arci.Networking.Security.AesEncryptor.PaddingMode
getsetadd

Aes padding mode to be used