CryptoAlgorithm

Ecng.Security

Crypto algorithm.

Hereda de: Disposable

Constructores

CryptoAlgorithm
public CryptoAlgorithm(SymmetricCryptographer symmetric)
cryptoAlgorithm = CryptoAlgorithm(symmetric)

Initializes a new instance of the CryptoAlgorithm class.

symmetric
SymmetricCryptographer
CryptoAlgorithm
public CryptoAlgorithm(AsymmetricCryptographer asymmetric)
cryptoAlgorithm = CryptoAlgorithm(asymmetric)

Initializes a new instance of the CryptoAlgorithm class.

asymmetric
AsymmetricCryptographer
CryptoAlgorithm
public CryptoAlgorithm(HashCryptographer hash)
cryptoAlgorithm = CryptoAlgorithm(hash)

Initializes a new instance of the CryptoAlgorithm class.

hash
HashCryptographer

Métodos

Create
public static CryptoAlgorithm Create(AlgorithmTypes type, byte[][] keys)
result = CryptoAlgorithm.Create(type, keys)

Creates a symmetric cryptographer.

type
AlgorithmTypes
keys
The keys.

Devuelve: CryptoAlgorithm

CreateAsymmetricVerifier
public static CryptoAlgorithm CreateAsymmetricVerifier(byte[] publicKey)
result = CryptoAlgorithm.CreateAsymmetricVerifier(publicKey)

Creates an asymmetric cryptographer for signature verification.

publicKey
The public key.

Devuelve: The asymmetric cryptographer.

CreateSignature
public byte[] CreateSignature(byte[] data, Func<HashAlgorithm> createHash)
result = cryptoAlgorithm.CreateSignature(data, createHash)

Computes the hash value of the plaintext.

data
The plaintext in which you wish to hash.
createHash
A function that creates a HashAlgorithm instance to use for hashing.

Devuelve: The resulting hash.

Decrypt
public byte[] Decrypt(byte[] data)
result = cryptoAlgorithm.Decrypt(data)

Decrypts the specified data.

data
The encrypted data.

Devuelve: The decrypted data.

DisposeManaged
protected override void DisposeManaged()
cryptoAlgorithm.DisposeManaged()

Disposes the managed resources. Override this method to add custom clean up of managed resources.

Encrypt
public byte[] Encrypt(byte[] data)
result = cryptoAlgorithm.Encrypt(data)

Encrypts the specified data.

data
The decrypted data.

Devuelve: The encrypted data.

VerifySignature
public bool VerifySignature(byte[] data, byte[] signature)
result = cryptoAlgorithm.VerifySignature(data, signature)

Verifies the signature.

data
The data.
signature
The signature.

Devuelve: true if the signature is valid; otherwise, false.