RsaDigitalSignature
Implements RSA digital signature algorithm.
            
                using System;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
namespace Renci.SshNet.Security.Cryptography
{
    [NullableContext(1)]
    [Nullable(0)]
    public class RsaDigitalSignature : DigitalSignature, IDisposable
    {
        private readonly RsaKey _key;
        private readonly HashAlgorithmName _hashAlgorithmName;
        public RsaDigitalSignature(RsaKey rsaKey)
            : this(rsaKey, HashAlgorithmName.SHA1)
        {
        }
        public RsaDigitalSignature(RsaKey rsaKey, HashAlgorithmName hashAlgorithmName)
        {
            _key = rsaKey;
            _hashAlgorithmName = hashAlgorithmName;
        }
        public override bool Verify(byte[] input, byte[] signature)
        {
            return _key.RSA.VerifyData(input, signature, _hashAlgorithmName, RSASignaturePadding.Pkcs1);
        }
        public override byte[] Sign(byte[] input)
        {
            return _key.RSA.SignData(input, _hashAlgorithmName, RSASignaturePadding.Pkcs1);
        }
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        protected virtual void Dispose(bool disposing)
        {
        }
    }
}