<PackageReference Include="SSH.NET" Version="2023.0.0" />

DsaKey

public class DsaKey : Key, IDisposable
Contains DSA private and public key.
using Renci.SshNet.Common; using Renci.SshNet.Security.Cryptography; using System; namespace Renci.SshNet.Security { public class DsaKey : Key, IDisposable { private DsaDigitalSignature _digitalSignature; private bool _isDisposed; public BigInteger P => _privateKey[0]; public BigInteger Q => _privateKey[1]; public BigInteger G => _privateKey[2]; public BigInteger Y => _privateKey[3]; public BigInteger X => _privateKey[4]; public override int KeyLength => P.BitLength; protected internal override DigitalSignature DigitalSignature { get { if (_digitalSignature == null) _digitalSignature = new DsaDigitalSignature(this); return _digitalSignature; } } public override BigInteger[] Public { get { return new BigInteger[4] { P, Q, G, Y }; } set { if (value.Length != 4) throw new InvalidOperationException("Invalid public key."); _privateKey = value; } } public DsaKey() { _privateKey = new BigInteger[5]; } public DsaKey(byte[] data) : base(data) { if (_privateKey.Length != 5) throw new InvalidOperationException("Invalid private key."); } public DsaKey(BigInteger p, BigInteger q, BigInteger g, BigInteger y, BigInteger x) { _privateKey = new BigInteger[5] { p, q, g, y, x }; } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (!_isDisposed && disposing) { DsaDigitalSignature digitalSignature = _digitalSignature; if (digitalSignature != null) { digitalSignature.Dispose(); _digitalSignature = null; } _isDisposed = true; } } ~DsaKey() { Dispose(false); } } }