C# Class Yea.Encryption.SymmetricExtensions

Symmetric key extensions
显示文件 Open project: OxPatient/Rule-Engine

Public Methods

Method Description
Decrypt ( this data, DeriveBytes key, Encoding encodingUsing = null, SymmetricAlgorithm algorithmUsing = null, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : string

Decrypts a string

Decrypt ( this data, string key, Encoding encodingUsing = null, SymmetricAlgorithm algorithmUsing = null, string salt = "Kosher", string hashAlgorithm = "SHA1", int passwordIterations = 2, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : string

Decrypts a string

Encrypt ( this data, DeriveBytes key, Encoding encodingUsing = null, SymmetricAlgorithm algorithmUsing = null, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : string

Encrypts a byte array

Encrypt ( this data, string key, Encoding encodingUsing = null, SymmetricAlgorithm algorithmUsing = null, string salt = "Kosher", string hashAlgorithm = "SHA1", int passwordIterations = 2, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : string

Encrypts a string

Private Methods

Method Description
Decrypt ( this data, DeriveBytes key, SymmetricAlgorithm algorithmUsing = null, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : byte[]
Decrypt ( this data, string key, SymmetricAlgorithm algorithmUsing = null, string salt = "Kosher", string hashAlgorithm = "SHA1", int passwordIterations = 2, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : byte[]
Encrypt ( this data, DeriveBytes key, SymmetricAlgorithm algorithmUsing = null, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : byte[]
Encrypt ( this data, string key, SymmetricAlgorithm algorithmUsing = null, string salt = "Kosher", string hashAlgorithm = "SHA1", int passwordIterations = 2, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : byte[]

Method Details

Decrypt() public static method

Decrypts a string
public static Decrypt ( this data, DeriveBytes key, Encoding encodingUsing = null, SymmetricAlgorithm algorithmUsing = null, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : string
data this Text to be decrypted (Base 64 string)
key System.Security.Cryptography.DeriveBytes Key to use to encrypt the data (can use PasswordDeriveBytes, Rfc2898DeriveBytes, etc. Really anything that implements DeriveBytes)
encodingUsing System.Text.Encoding Encoding that the output string should use (defaults to UTF8)
algorithmUsing System.Security.Cryptography.SymmetricAlgorithm Algorithm to use for decryption (defaults to AES)
initialVector string Needs to be 16 ASCII characters long
keySize int Can be 64 (DES only), 128 (AES), 192 (AES and Triple DES), or 256 (AES)
return string

Decrypt() public static method

Decrypts a string
public static Decrypt ( this data, string key, Encoding encodingUsing = null, SymmetricAlgorithm algorithmUsing = null, string salt = "Kosher", string hashAlgorithm = "SHA1", int passwordIterations = 2, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : string
data this Text to be decrypted (Base 64 string)
key string Password to decrypt with
encodingUsing System.Text.Encoding Encoding that the output string should use (defaults to UTF8)
algorithmUsing System.Security.Cryptography.SymmetricAlgorithm Algorithm to use for decryption (defaults to AES)
salt string Salt to decrypt with
hashAlgorithm string Can be either SHA1 or MD5
passwordIterations int Number of iterations to do
initialVector string Needs to be 16 ASCII characters long
keySize int Can be 64 (DES only), 128 (AES), 192 (AES and Triple DES), or 256 (AES)
return string

Encrypt() public static method

Encrypts a byte array
public static Encrypt ( this data, DeriveBytes key, Encoding encodingUsing = null, SymmetricAlgorithm algorithmUsing = null, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : string
data this Data to encrypt
key System.Security.Cryptography.DeriveBytes Key to use to encrypt the data (can use PasswordDeriveBytes, Rfc2898DeriveBytes, etc. Really anything that implements DeriveBytes)
encodingUsing System.Text.Encoding Encoding that the original string is using (defaults to UTF8)
algorithmUsing System.Security.Cryptography.SymmetricAlgorithm Algorithm to use for encryption (defaults to AES)
initialVector string Needs to be 16 ASCII characters long
keySize int Can be 64 (DES only), 128 (AES), 192 (AES and Triple DES), or 256 (AES)
return string

Encrypt() public static method

Encrypts a string
public static Encrypt ( this data, string key, Encoding encodingUsing = null, SymmetricAlgorithm algorithmUsing = null, string salt = "Kosher", string hashAlgorithm = "SHA1", int passwordIterations = 2, string initialVector = "OFRna73m*aze01xY", int keySize = 256 ) : string
data this Text to be encrypted
key string Password to encrypt with
encodingUsing System.Text.Encoding Encoding that the original string is using (defaults to UTF8)
algorithmUsing System.Security.Cryptography.SymmetricAlgorithm Algorithm to use for encryption (defaults to AES)
salt string Salt to encrypt with
hashAlgorithm string Can be either SHA1 or MD5
passwordIterations int Number of iterations to do
initialVector string Needs to be 16 ASCII characters long
keySize int Can be 64 (DES only), 128 (AES), 192 (AES and Triple DES), or 256 (AES)
return string