C# Class CryptoN.CryptoMonkey

显示文件 Open project: tamimsalem/CryptoN

Public Methods

Method Description
CryptoMonkey ( Key key, IV iv, PaddingMode paddingMode = PaddingMode.PKCS7, CipherMode cipherMode = CipherMode.CBC ) : System
Decrypt ( byte data ) : byte[]
DecryptFile ( string encryptedFilePath, string plainOutputPath ) : void
DecryptStream ( Stream encrypted, Stream plain, bool disposeWhenDone ) : void
DecryptString ( string base64String ) : string
Encrypt ( byte data ) : byte[]
EncryptFile ( string plainFilePath, string encryptedOutputPath ) : void
EncryptStream ( Stream plain, Stream encrypted, bool disposeWhenDone ) : void
EncryptString ( string value ) : string
GenerateRandomIv ( AllowedBlockSizes blockSize ) : IV
GenerateRandomKey ( AllowedKeySizes keySize ) : Key

Private Methods

Method Description
DecryptFromBytes ( byte encryptedData ) : byte[]
EncryptToBytes ( byte data ) : byte[]
GetAlgorithmObject ( ) : RijndaelManaged
GetDecryptionStrean ( Stream data ) : CryptoStream
GetEncryptingStream ( Stream data ) : CryptoStream

Method Details

CryptoMonkey() public method

public CryptoMonkey ( Key key, IV iv, PaddingMode paddingMode = PaddingMode.PKCS7, CipherMode cipherMode = CipherMode.CBC ) : System
key Key
iv IV
paddingMode PaddingMode
cipherMode CipherMode
return System

Decrypt() public method

public Decrypt ( byte data ) : byte[]
data byte
return byte[]

DecryptFile() public method

public DecryptFile ( string encryptedFilePath, string plainOutputPath ) : void
encryptedFilePath string
plainOutputPath string
return void

DecryptStream() public method

public DecryptStream ( Stream encrypted, Stream plain, bool disposeWhenDone ) : void
encrypted Stream
plain Stream
disposeWhenDone bool
return void

DecryptString() public method

public DecryptString ( string base64String ) : string
base64String string
return string

Encrypt() public method

public Encrypt ( byte data ) : byte[]
data byte
return byte[]

EncryptFile() public method

public EncryptFile ( string plainFilePath, string encryptedOutputPath ) : void
plainFilePath string
encryptedOutputPath string
return void

EncryptStream() public method

public EncryptStream ( Stream plain, Stream encrypted, bool disposeWhenDone ) : void
plain Stream
encrypted Stream
disposeWhenDone bool
return void

EncryptString() public method

public EncryptString ( string value ) : string
value string
return string

GenerateRandomIv() public static method

public static GenerateRandomIv ( AllowedBlockSizes blockSize ) : IV
blockSize AllowedBlockSizes
return IV

GenerateRandomKey() public static method

public static GenerateRandomKey ( AllowedKeySizes keySize ) : Key
keySize AllowedKeySizes
return Key