C# Class Utilities.IO.Encryption.Manager

Compression manager
Mostra file Open project: JaCraig/Craig-s-Utility-Library

Public Methods

Method Description
CreateKey ( bool PrivatePublic ) : string

Creates a new set of keys

Decrypt ( byte Data, DeriveBytes Key, string Algorithm = "AES", string InitialVector = "OFRna73m*aze01xY", int KeySize = 256 ) : byte[]

Decrypts a byte array

Decrypt ( byte Data, byte Key ) : byte[]

Decrypt the data based on the key

Decrypt ( byte Input, string Key ) : byte[]

Decrypts a byte array using RSA

Decrypt ( byte Data, string Key, string Algorithm, string Salt = "Kosher", string HashAlgorithm = "SHA1", int PasswordIterations = 2, string InitialVector = "OFRna73m*aze01xY", int KeySize = 256 ) : byte[]

Decrypts a byte array

Encrypt ( byte Data, DeriveBytes Key, string Algorithm = "AES", string InitialVector = "OFRna73m*aze01xY", int KeySize = 256 ) : byte[]

Encrypts a byte array

Encrypt ( byte Data, byte Key ) : byte[]

Encrypts the data based on the key

Encrypt ( byte Input, string Key ) : byte[]

Encrypts a string using RSA

Encrypt ( byte Data, string Key, string Algorithm, string Salt = "Kosher", string HashAlgorithm = "SHA1", int PasswordIterations = 2, string InitialVector = "OFRna73m*aze01xY", int KeySize = 256 ) : byte[]

Encrypts a byte array

Hash ( byte Data, string Algorithm ) : byte[]

Hashes the data

Manager ( IEnumerable Asymmetric, IEnumerable Hashers, IEnumerable Shifts, IEnumerable Symmetric ) : System

Constructor

SignHash ( string Input, string Key, string &Hash, Encoding EncodingUsing = null ) : string

Takes a string and creates a signed hash of it

ToString ( ) : string

String info for the manager

VerifyHash ( string Hash, string SignedHash, string Key ) : bool

Verifies a signed hash against the unsigned version

Method Details

CreateKey() public method

Creates a new set of keys
public CreateKey ( bool PrivatePublic ) : string
PrivatePublic bool True if private key should be included, false otherwise
return string

Decrypt() public method

Decrypts a byte array
public Decrypt ( byte Data, DeriveBytes Key, string Algorithm = "AES", string InitialVector = "OFRna73m*aze01xY", int KeySize = 256 ) : byte[]
Data byte Data to be decrypted
Key System.Security.Cryptography.DeriveBytes Password to decrypt with
Algorithm string Algorithm to use for decryption
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 byte[]

Decrypt() public method

Decrypt the data based on the key
public Decrypt ( byte Data, byte Key ) : byte[]
Data byte Data to encrypt
Key byte Key to use
return byte[]

Decrypt() public method

Decrypts a byte array using RSA
public Decrypt ( byte Input, string Key ) : byte[]
Input byte /// Input byte array (should be small as anything over 128 bytes can not be decrypted) ///
Key string Key to use for decryption
return byte[]

Decrypt() public method

Decrypts a byte array
public Decrypt ( byte Data, string Key, string Algorithm, string Salt = "Kosher", string HashAlgorithm = "SHA1", int PasswordIterations = 2, string InitialVector = "OFRna73m*aze01xY", int KeySize = 256 ) : byte[]
Data byte Data to be decrypted
Key string Password to decrypt with
Algorithm string Algorithm to use for decryption
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 byte[]

Encrypt() public method

Encrypts a byte array
public Encrypt ( byte Data, DeriveBytes Key, string Algorithm = "AES", string InitialVector = "OFRna73m*aze01xY", int KeySize = 256 ) : byte[]
Data byte Data to be encrypted
Key System.Security.Cryptography.DeriveBytes Password to encrypt with
Algorithm string Algorithm
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 byte[]

Encrypt() public method

Encrypts the data based on the key
public Encrypt ( byte Data, byte Key ) : byte[]
Data byte Data to encrypt
Key byte Key to use
return byte[]

Encrypt() public method

Encrypts a string using RSA
public Encrypt ( byte Input, string Key ) : byte[]
Input byte /// Input byte array (should be small as anything over 128 bytes can not be decrypted) ///
Key string Key to use for encryption
return byte[]

Encrypt() public method

Encrypts a byte array
public Encrypt ( byte Data, string Key, string Algorithm, string Salt = "Kosher", string HashAlgorithm = "SHA1", int PasswordIterations = 2, string InitialVector = "OFRna73m*aze01xY", int KeySize = 256 ) : byte[]
Data byte Data to be encrypted
Key string Password to encrypt with
Algorithm string Algorithm
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 byte[]

Hash() public method

Hashes the data
public Hash ( byte Data, string Algorithm ) : byte[]
Data byte Data to hash
Algorithm string Algorithm
return byte[]

Manager() public method

Constructor
public Manager ( IEnumerable Asymmetric, IEnumerable Hashers, IEnumerable Shifts, IEnumerable Symmetric ) : System
Asymmetric IEnumerable The asymmetric.
Hashers IEnumerable The hashers.
Shifts IEnumerable The shifts.
Symmetric IEnumerable The symmetric.
return System

SignHash() public method

Takes a string and creates a signed hash of it
public SignHash ( string Input, string Key, string &Hash, Encoding EncodingUsing = null ) : string
Input string Input string
Key string Key to encrypt/sign with
Hash string This will be filled with the unsigned hash
EncodingUsing System.Text.Encoding Encoding that the input is using (defaults to UTF8)
return string

ToString() public method

String info for the manager
public ToString ( ) : string
return string

VerifyHash() public method

Verifies a signed hash against the unsigned version
public VerifyHash ( string Hash, string SignedHash, string Key ) : bool
Hash string The unsigned hash (should be 64bit string)
SignedHash string The signed hash (should be 64bit string)
Key string The key to use in decryption
return bool