C# Class EfficientlyLazy.Crypto.Engines.DPAPIEngine

Encryption/Decryption using the windows crypto API.
Inheritance: ICryptoEngine
Datei anzeigen Open project: jasonlaflair/EfficientlyLazy.Crypto Class Usage Examples

Public Methods

Method Description
DPAPIEngine ( DPAPIKeyType keyType ) : System

Initializes a new instance of the DPAPIEngine object.

Decrypt ( byte cipherText ) : byte[]

Decrypts the specified cipher text.

Decrypt ( string cipherText ) : string

Decrypts the specified cipher text.

Dispose ( ) : void

Encrypt ( byte plaintext ) : byte[]

Encrypts the specified plain text to a byte array.

Encrypt ( string plaintext ) : string

Encrypts the specified plain text to a string.

GetSetting ( string key ) : string

GetSqlConnectionString ( string key ) : System.Data.SqlClient.SqlConnectionStringBuilder

SetEncoding ( Encoding encoding ) : DPAPIEngine

Sets character encoding to use during encryption/decryption.

SetEntropy ( SecureString entropy ) : DPAPIEngine

Sets additional entropy used for encryption/decryption

SetEntropy ( string entropy ) : DPAPIEngine

Sets additional entropy used for encryption/decryption

Private Methods

Method Description
CryptProtectData ( DPAPINativeDataBlob &plainText, string description, DPAPINativeDataBlob &entropy, IntPtr reserved, DPAPINativeCryptPotectPromptStruct &prompt, int flags, DPAPINativeDataBlob &cipherText ) : bool
CryptUnprotectData ( DPAPINativeDataBlob &cipherText, string &description, DPAPINativeDataBlob &entropy, IntPtr reserved, DPAPINativeCryptPotectPromptStruct &prompt, int flags, DPAPINativeDataBlob &plainText ) : bool
DPAPIDecrypt ( byte cipherText, byte entropy ) : byte[]
DPAPIEncrypt ( DPAPIKeyType keyType, byte plainTextBytes, byte entropyBytes ) : byte[]
Dispose ( bool disposing ) : void
GetSecureConfigSection ( ) : SecureSection
ToSecureString ( IEnumerable text ) : SecureString
ToString ( SecureString secureString ) : string

Method Details

DPAPIEngine() public method

Initializes a new instance of the DPAPIEngine object.
public DPAPIEngine ( DPAPIKeyType keyType ) : System
keyType DPAPIKeyType Defines the method () to use for encryption/decryption.
return System

Decrypt() public method

Decrypts the specified cipher text.
public Decrypt ( byte cipherText ) : byte[]
cipherText byte The cipher text.
return byte[]

Decrypt() public method

Decrypts the specified cipher text.
public Decrypt ( string cipherText ) : string
cipherText string The cipher text.
return string

Dispose() public method

public Dispose ( ) : void
return void

Encrypt() public method

Encrypts the specified plain text to a byte array.
public Encrypt ( byte plaintext ) : byte[]
plaintext byte The plain text to encrypt.
return byte[]

Encrypt() public method

Encrypts the specified plain text to a string.
public Encrypt ( string plaintext ) : string
plaintext string The plain text to encrypt.
return string

GetSetting() public method

public GetSetting ( string key ) : string
key string
return string

GetSqlConnectionString() public method

public GetSqlConnectionString ( string key ) : System.Data.SqlClient.SqlConnectionStringBuilder
key string
return System.Data.SqlClient.SqlConnectionStringBuilder

SetEncoding() public method

Sets character encoding to use during encryption/decryption.
encoding is null
public SetEncoding ( Encoding encoding ) : DPAPIEngine
encoding System.Text.Encoding Character encoding to use during encryption/decryption.
return DPAPIEngine

SetEntropy() public method

Sets additional entropy used for encryption/decryption
public SetEntropy ( SecureString entropy ) : DPAPIEngine
entropy System.Security.SecureString Additional entropy used for encryption/decryption
return DPAPIEngine

SetEntropy() public method

Sets additional entropy used for encryption/decryption
public SetEntropy ( string entropy ) : DPAPIEngine
entropy string Additional entropy used for encryption/decryption
return DPAPIEngine