Class SymmetricEncryption
Inheritance
System.Object
SymmetricEncryption
Assembly: SensusAndroid.dll
Syntax
public class SymmetricEncryption : Object, IEncryptor
Constructors
SymmetricEncryption(Byte[], Byte[])
Declaration
public SymmetricEncryption(byte[] encryptionKeyBytes, byte[] initializationVectorBytes)
Parameters
Type |
Name |
Description |
System.Byte[] |
encryptionKeyBytes |
A 256-bit (32-byte) symmetric AES encryption key.
|
System.Byte[] |
initializationVectorBytes |
A 128-bit (16-byte) initialization vector.
|
SymmetricEncryption(String)
Initializes a new instance of the SymmetricEncryption class. Uses a zero-valued initialization vector.
Declaration
public SymmetricEncryption(string encryptionKeyHexString)
Parameters
Type |
Name |
Description |
System.String |
encryptionKeyHexString |
A 64-character hex-encoded string for a 256-bit symmetric AES encryption key. Can be generated with the following:
openssl enc -aes-256-cbc -k secret -P -md sha1
|
Methods
ConvertHexStringToByteArray(String)
Declaration
public static byte[] ConvertHexStringToByteArray(string hexString)
Parameters
Type |
Name |
Description |
System.String |
hexString |
|
Returns
Type |
Description |
System.Byte[] |
|
DecryptToString(Byte[], Encoding)
Declaration
public string DecryptToString(byte[] encryptedBytes, Encoding encoding)
Parameters
Type |
Name |
Description |
System.Byte[] |
encryptedBytes |
|
System.Text.Encoding |
encoding |
|
Returns
Type |
Description |
System.String |
|
Encrypt(Byte[])
Declaration
public byte[] Encrypt(byte[] unencryptedBytes)
Parameters
Type |
Name |
Description |
System.Byte[] |
unencryptedBytes |
|
Returns
Type |
Description |
System.Byte[] |
|
Encrypt(String, Encoding)
Declaration
public byte[] Encrypt(string unencryptedValue, Encoding encoding)
Parameters
Type |
Name |
Description |
System.String |
unencryptedValue |
|
System.Text.Encoding |
encoding |
|
Returns
Type |
Description |
System.Byte[] |
|
Implements