CryptoAlgorithm
Ecng.Security
Crypto algorithm.
Erbt von: Disposable
Konstruktoren
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
Methoden
Create
public static CryptoAlgorithm Create(AlgorithmTypes type, byte[][] keys)
result = CryptoAlgorithm.Create(type, keys)
Creates a symmetric cryptographer.
- type
- AlgorithmTypes
- keys
- The keys.
Rückgabe: CryptoAlgorithm
CreateAsymmetricVerifier
public static CryptoAlgorithm CreateAsymmetricVerifier(byte[] publicKey)
result = CryptoAlgorithm.CreateAsymmetricVerifier(publicKey)
Creates an asymmetric cryptographer for signature verification.
- publicKey
- The public key.
Rückgabe: 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.
Rückgabe: The resulting hash.
Decrypt
public byte[] Decrypt(byte[] data)
result = cryptoAlgorithm.Decrypt(data)
Decrypts the specified data.
- data
- The encrypted data.
Rückgabe: 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.
Rückgabe: 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.
Rückgabe: true if the signature is valid; otherwise, false.