Skip to main content

RSA Class

NuGet: GHIElectronics.TinyCLR.Cryptography
Assembly: System.Security.Cryptography
Namespace: System.Security.Cryptography

Abstract RSA implementation; create concrete instances via RSACryptoServiceProvider.

public abstract class RSA : AsymmetricAlgorithm

Methods​

ExportParameters(bool includePrivateParameters)​

public abstract RSAParameters ExportParameters(bool includePrivateParameters)

Exports the RSA key, optionally including the private parameters.

Returns RSAParameters

ImportParameters(RSAParameters parameters)​

public abstract void ImportParameters(RSAParameters parameters)

Imports the given RSA key parameters.

Encrypt(byte[] data, RSAEncryptionPadding padding)​

public virtual byte[] Encrypt(byte[] data, RSAEncryptionPadding padding)

Encrypts data with the public key using the given padding.

Returns byte[]

Decrypt(byte[] data, RSAEncryptionPadding padding)​

public virtual byte[] Decrypt(byte[] data, RSAEncryptionPadding padding)

Decrypts data with the private key using the given padding.

Returns byte[]

SignData(byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)​

public virtual byte[] SignData(byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)

Signs data with the private key.

Returns byte[]

SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)​

public virtual byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)

Signs a precomputed hash with the private key.

Returns byte[]

VerifyData(byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)​

public virtual bool VerifyData(byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)

Verifies a data signature against the public key.

Returns bool

VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)​

public virtual bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)

Verifies a hash signature against the public key.

Returns bool