Provides correct 256-bit AES encryption and decryption for small data sets.
More...
|
| SimpleSecureEncryption (byte[] keyBasis) |
| Creates an encryption/decryption system using a 256-bit key derived from the specified byte sequence. 32-bit or longer phrases are suggested. More...
|
|
| SimpleSecureEncryption (string passPhrase) |
| Creates an encryption/decryption system using a 256-bit key derived from the specified pass phrase. 32-bit or longer phrases are suggested. More...
|
|
byte[] | Decrypt (byte[] data, byte[] iv) |
| Decrypts the specified data using a derived key and the specified IV More...
|
|
byte[] | Encrypt (byte[] data, out byte[] iv) |
| Encrypts the specified data using a derived key and a generated IV. More...
|
|
Provides correct 256-bit AES encryption and decryption for small data sets.
Definition at line 13 of file SimpleSecureEncryption.cs.
ImageResizer.Plugins.Security.SimpleSecureEncryption.SimpleSecureEncryption |
( |
byte[] |
keyBasis | ) |
|
|
inline |
Creates an encryption/decryption system using a 256-bit key derived from the specified byte sequence. 32-bit or longer phrases are suggested.
- Parameters
-
keyBasis | A password or key |
Definition at line 19 of file SimpleSecureEncryption.cs.
20 this.keyBasis = keyBasis;
ImageResizer.Plugins.Security.SimpleSecureEncryption.SimpleSecureEncryption |
( |
string |
passPhrase | ) |
|
|
inline |
Creates an encryption/decryption system using a 256-bit key derived from the specified pass phrase. 32-bit or longer phrases are suggested.
- Parameters
-
Definition at line 26 of file SimpleSecureEncryption.cs.
27 this.keyBasis = UTF8Encoding.UTF8.GetBytes(passPhrase);
byte [] ImageResizer.Plugins.Security.SimpleSecureEncryption.Decrypt |
( |
byte[] |
data, |
|
|
byte[] |
iv |
|
) |
| |
|
inline |
Decrypts the specified data using a derived key and the specified IV
- Parameters
-
- Returns
Definition at line 75 of file SimpleSecureEncryption.cs.
76 if (iv.Length !=
BlockSizeInBytes)
throw new ArgumentOutOfRangeException(
"The specified IV is invalid - an " +
BlockSizeInBytes +
" byte array is required.");
78 var rm = GetAlgorithm();
80 using (var decrypt = rm.CreateDecryptor(GetKey(), iv))
81 using (var ms =
new MemoryStream(data, 0, data.Length,
false,
true))
82 using (var s =
new CryptoStream(ms, decrypt, CryptoStreamMode.Read)) {
83 return StreamExtensions.CopyToBytes(s);
int BlockSizeInBytes
The number of bytes in a single block. Also the size of the IV (Initialization Vector).
byte [] ImageResizer.Plugins.Security.SimpleSecureEncryption.Encrypt |
( |
byte[] |
data, |
|
|
out byte[] |
iv |
|
) |
| |
|
inline |
Encrypts the specified data using a derived key and a generated IV.
- Parameters
-
- Returns
Definition at line 98 of file SimpleSecureEncryption.cs.
99 var rm = GetAlgorithm();
104 using (var encrypt = rm.CreateEncryptor())
106 using (var s =
new CryptoStream(ms, encrypt, CryptoStreamMode.Write)) {
107 s.Write(data, 0, data.Length);
110 ms.Seek(0, SeekOrigin.Begin);
111 return StreamExtensions.CopyToBytes(ms);
int BlockSizeInBytes
The number of bytes in a single block. Also the size of the IV (Initialization Vector).
int ImageResizer.Plugins.Security.SimpleSecureEncryption.BlockSizeInBytes |
|
get |
The number of bytes in a single block. Also the size of the IV (Initialization Vector).
Definition at line 47 of file SimpleSecureEncryption.cs.
int ImageResizer.Plugins.Security.SimpleSecureEncryption.KeySizeInBytes |
|
get |
The documentation for this class was generated from the following file: