Method | Description | |
---|---|---|
AnotherAES ( string key ) |
Initialize algo just with key Defaults for RijndaelManaged class: Block Size: 256 bits (32 bytes) Key Size: 128 bits (16 bytes) Padding Mode: PKCS7 Cipher Mode: CBC
|
|
AnotherAES ( string key, int blockSize, int keySize, PaddingMode, paddingMode, CipherMode, cipherMode ) |
Initialize algo with key, block size, key size, padding mode and cipher mode to be known.
|
|
Decrypt ( Array, cipherText, Array, IV ) : string |
Based on https://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged(v=vs.110).aspx
|
|
Dispose ( ) : void |
Dispose RijndaelManaged object initialized in the constructor
|
|
Encrypt ( string plainText, Array, IV ) : byte[] |
Based on https://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged(v=vs.110).aspx Encrypt a string using RijndaelManaged encryptor.
|
|
GenerateEncryptionVector ( ) : byte[] |
Generates a unique encryption vector using RijndaelManaged.GenerateIV() method
|
|
GetUniqueString ( int numBytes ) : string |
Based on http://stackoverflow.com/a/1344255 Generate a unique string given number of bytes required. This string can be used as IV. IV byte size should be equal to cipher-block byte size. Allows seeing IV in plaintext so it can be passed along a url or some message.
|
|
StringToByteArray ( String hex ) : byte[] |
Based on http://stackoverflow.com/a/311179/1541224 Converts a string to byte array. Useful when converting back hex string which was originally formed from bytes.
|
public AnotherAES ( string key, int blockSize, int keySize, PaddingMode, paddingMode, CipherMode, cipherMode ) | ||
key | string | ASCII key to be used for encryption or decryption |
blockSize | int | block size to use for AES algorithm. 128, 192 or 256 bits (default for incorrect size=256) |
keySize | int | key length to use for AES algorithm. 128, 192, or 256 bits (default for incorrect size=128) |
paddingMode | PaddingMode, | |
cipherMode | CipherMode, |
public Decrypt ( Array, cipherText, Array, IV ) : string | ||
cipherText | Array, | bytes to be decrypted back to plaintext |
IV | Array, | initialization vector used to encrypt the bytes |
return | string |
public Encrypt ( string plainText, Array, IV ) : byte[] | ||
plainText | string | string to be encrypted |
IV | Array, | initialization vector to be used by crypto algorithm |
return | byte[] |
public static GetUniqueString ( int numBytes ) : string | ||
numBytes | int | |
return | string |
public static StringToByteArray ( String hex ) : byte[] | ||
hex | String | |
return | byte[] |