C# Class CmisSync.Lib.Config.Crypto

Obfuscation for sensitive data, making password harvesting a little less straightforward. Web browsers employ the same technique to store user passwords.
Show file Open project: OpenDataSpace/CmisSync

Public Methods

Method Description
CalculateChecksum ( string hashAlgorithm, IFileInfo file ) : byte[]

Calculates the checksum over the given stream with a former created hashAlgorithm

CalculateChecksum ( string hashAlgorithm, Stream inputStream ) : byte[]

Calculates the checksum over the given stream.

CreateHashAlgorithm ( string name ) : HashAlgorithm

Creates the hash algorithm by the given name.

Deobfuscate ( string value ) : string

Deobfuscate a string.

GetCryptoKey ( ) : byte[]

Salt for the obfuscation.

Obfuscate ( string value ) : string

Obfuscate a string.

Private Methods

Method Description
UnixDeobfuscate ( string value ) : string

Deobfuscate a string on UNIX.

UnixObfuscate ( string value ) : string

Obfuscate a string on Unix. AES is used.

WindowsDeobfuscate ( string value ) : string

Deobfuscate a string on Windows.

WindowsObfuscate ( string value ) : string

Obfuscate a string on Windows. We use the recommended API for this: DPAPI (Windows Data Protection API) http://msdn.microsoft.com/en-us/library/ms995355.aspx Warning: Even though it uses the Windows user's password, it is not uncrackable.

Method Details

CalculateChecksum() public static method

Calculates the checksum over the given stream with a former created hashAlgorithm
public static CalculateChecksum ( string hashAlgorithm, IFileInfo file ) : byte[]
hashAlgorithm string Hash algorithm.
file IFileInfo File to be hashed.
return byte[]

CalculateChecksum() public static method

Calculates the checksum over the given stream.
public static CalculateChecksum ( string hashAlgorithm, Stream inputStream ) : byte[]
hashAlgorithm string Hash algorithm.
inputStream Stream Input Stream.
return byte[]

CreateHashAlgorithm() public static method

Creates the hash algorithm by the given name.
public static CreateHashAlgorithm ( string name ) : HashAlgorithm
name string Name of the has algorithm.
return System.Security.Cryptography.HashAlgorithm

Deobfuscate() public static method

Deobfuscate a string.
public static Deobfuscate ( string value ) : string
value string The string to deobfuscate
return string

GetCryptoKey() public static method

Salt for the obfuscation.
public static GetCryptoKey ( ) : byte[]
return byte[]

Obfuscate() public static method

Obfuscate a string.
public static Obfuscate ( string value ) : string
value string The string to obfuscate
return string