Class CryptoAlgorithm
Crypto algorithm.
public class CryptoAlgorithm : Disposable, IDisposable
- Inheritance
-
CryptoAlgorithm
- Implements
- Inherited Members
- Extension Methods
Constructors
CryptoAlgorithm(AsymmetricCryptographer)
Initializes a new instance of the CryptoAlgorithm class.
public CryptoAlgorithm(AsymmetricCryptographer asymmetric)
Parameters
asymmetric
AsymmetricCryptographer
CryptoAlgorithm(HashCryptographer)
Initializes a new instance of the CryptoAlgorithm class.
public CryptoAlgorithm(HashCryptographer hash)
Parameters
CryptoAlgorithm(SymmetricCryptographer)
Initializes a new instance of the CryptoAlgorithm class.
public CryptoAlgorithm(SymmetricCryptographer symmetric)
Parameters
symmetric
SymmetricCryptographer
Fields
DefaultAsymmetricAlgoName
The default asymmetric algorithm name.
public const string DefaultAsymmetricAlgoName = "RSA"
Field Value
DefaultHashAlgoName
The default hash algorithm name.
public const string DefaultHashAlgoName = "SHA"
Field Value
DefaultSymmetricAlgoName
The default symmetric algorithm name.
public const string DefaultSymmetricAlgoName = "AES"
Field Value
Methods
Create(AlgorithmTypes, params byte[][])
Creates a symmetric cryptographer.
public static CryptoAlgorithm Create(AlgorithmTypes type, params byte[][] keys)
Parameters
type
AlgorithmTypeskeys
byte[][]The keys.
Returns
CreateAssymetricVerifier(byte[])
Creates a symmetric cryptographer.
public static CryptoAlgorithm CreateAssymetricVerifier(byte[] publicKey)
Parameters
publicKey
byte[]The public key.
Returns
- CryptoAlgorithm
The symmetric cryptographer.
CreateSignature(byte[])
Computes the hash value of the plaintext.
public byte[] CreateSignature(byte[] data)
Parameters
data
byte[]The plaintext in which you wish to hash.
Returns
- byte[]
The resulting hash.
Decrypt(byte[])
Decrypts the specified data.
public byte[] Decrypt(byte[] data)
Parameters
data
byte[]The encrypted data.
Returns
- byte[]
The decrypted data.
DisposeManaged()
Disposes the managed resources. Override this method to add custom clean up of managed resources.
protected override void DisposeManaged()
Encrypt(byte[])
Encrypts the specified data.
public byte[] Encrypt(byte[] data)
Parameters
data
byte[]The decrypted data.
Returns
- byte[]
The encrypted data.
VerifySignature(byte[], byte[])
Verifies the signature.
public bool VerifySignature(byte[] data, byte[] signature)
Parameters
Returns
- bool
true
if the signature is valid; otherwise,false
.