C# Class OpenSSL.Crypto.CipherContext

Wraps the EVP_CIPHER_CTX object.
Inheritance: OpenSSL.Core.Base, IDisposable
Datei anzeigen Open project: langhuihui/csharprtmp Class Usage Examples

Public Methods

Method Description
BytesToKey ( OpenSSL.Crypto.MessageDigest md, byte salt, byte data, int count, byte &iv ) : byte[]

Calls EVP_BytesToKey

CipherContext ( Cipher cipher ) : System

Calls OPENSSL_malloc() and initializes the buffer using EVP_CIPHER_CTX_init()

Crypt ( byte input, byte key, byte iv, bool doEncrypt ) : byte[]

Encrypts or decrypts the specified payload.

Crypt ( byte input, byte key, byte iv, bool doEncrypt, int padding ) : byte[]

Calls EVP_CipherInit_ex(), EVP_CipherUpdate(), and EVP_CipherFinal_ex()

Crypt ( byte input, int count, byte key, byte iv, bool doEncrypt, int padding ) : byte[]

Calls EVP_CipherInit_ex(), EVP_CipherUpdate(), and EVP_CipherFinal_ex()

Decrypt ( byte input, byte key, byte iv ) : byte[]

Decrypts the specified ciphertext

Decrypt ( byte input, byte key, byte iv, int padding ) : byte[]

Decrypts the specified ciphertext

Encrypt ( byte input, byte key, byte iv ) : byte[]

Encrypts the specified plaintext

Encrypt ( byte input, byte key, byte iv, int padding ) : byte[]

Encrypts the specified plaintext

Open ( byte input, byte ekey, byte iv, OpenSSL.Crypto.CryptoKey pkey ) : byte[]

Calls EVP_OpenInit() and EVP_OpenFinal()

Print ( BIO bio ) : void

Returns the cipher's LongName

Seal ( OpenSSL.Crypto.CryptoKey pkeys, byte input ) : Envelope

Calls EVP_SealInit() and EVP_SealFinal()

Protected Methods

Method Description
OnDispose ( ) : void

Calls EVP_CIPHER_CTX_clean() and then OPENSSL_free()

Private Methods

Method Description
SetupIV ( byte iv ) : byte[]
SetupKey ( byte key ) : byte[]

Method Details

BytesToKey() public method

Calls EVP_BytesToKey
public BytesToKey ( OpenSSL.Crypto.MessageDigest md, byte salt, byte data, int count, byte &iv ) : byte[]
md OpenSSL.Crypto.MessageDigest
salt byte
data byte
count int
iv byte
return byte[]

CipherContext() public method

Calls OPENSSL_malloc() and initializes the buffer using EVP_CIPHER_CTX_init()
public CipherContext ( Cipher cipher ) : System
cipher Cipher
return System

Crypt() public method

Encrypts or decrypts the specified payload.
public Crypt ( byte input, byte key, byte iv, bool doEncrypt ) : byte[]
input byte
key byte
iv byte
doEncrypt bool
return byte[]

Crypt() public method

Calls EVP_CipherInit_ex(), EVP_CipherUpdate(), and EVP_CipherFinal_ex()
public Crypt ( byte input, byte key, byte iv, bool doEncrypt, int padding ) : byte[]
input byte
key byte
iv byte
doEncrypt bool
padding int
return byte[]

Crypt() public method

Calls EVP_CipherInit_ex(), EVP_CipherUpdate(), and EVP_CipherFinal_ex()
public Crypt ( byte input, int count, byte key, byte iv, bool doEncrypt, int padding ) : byte[]
input byte
count int
key byte
iv byte
doEncrypt bool
padding int
return byte[]

Decrypt() public method

Decrypts the specified ciphertext
public Decrypt ( byte input, byte key, byte iv ) : byte[]
input byte
key byte
iv byte
return byte[]

Decrypt() public method

Decrypts the specified ciphertext
public Decrypt ( byte input, byte key, byte iv, int padding ) : byte[]
input byte
key byte
iv byte
padding int
return byte[]

Encrypt() public method

Encrypts the specified plaintext
public Encrypt ( byte input, byte key, byte iv ) : byte[]
input byte
key byte
iv byte
return byte[]

Encrypt() public method

Encrypts the specified plaintext
public Encrypt ( byte input, byte key, byte iv, int padding ) : byte[]
input byte
key byte
iv byte
padding int
return byte[]

OnDispose() protected method

Calls EVP_CIPHER_CTX_clean() and then OPENSSL_free()
protected OnDispose ( ) : void
return void

Open() public method

Calls EVP_OpenInit() and EVP_OpenFinal()
public Open ( byte input, byte ekey, byte iv, OpenSSL.Crypto.CryptoKey pkey ) : byte[]
input byte
ekey byte
iv byte
pkey OpenSSL.Crypto.CryptoKey
return byte[]

Print() public method

Returns the cipher's LongName
public Print ( BIO bio ) : void
bio OpenSSL.Core.BIO
return void

Seal() public method

Calls EVP_SealInit() and EVP_SealFinal()
public Seal ( OpenSSL.Crypto.CryptoKey pkeys, byte input ) : Envelope
pkeys OpenSSL.Crypto.CryptoKey
input byte
return Envelope