using Renci.SshNet.Common;
using Renci.SshNet.Security.Cryptography;
namespace Renci.SshNet.Security
{
///
/// Base class for asymmetric cipher algorithms.
///
public abstract class Key
{
///
/// Gets the default digital signature implementation for this key.
///
protected internal abstract DigitalSignature DigitalSignature { get; }
///
/// Gets the public key.
///
///
/// The public.
///
public abstract BigInteger[] Public { get; }
///
/// Gets the length of the key.
///
///
/// The length of the key.
///
public abstract int KeyLength { get; }
///
/// Gets or sets the key comment.
///
public string Comment { get; set; }
///
/// Signs the specified data with the key.
///
/// The data to sign.
///
/// Signed data.
///
public byte[] Sign(byte[] data)
{
return DigitalSignature.Sign(data);
}
///
/// Verifies the signature.
///
/// The data to verify.
/// The signature to verify against.
/// is signature was successfully verifies; otherwise .
public bool VerifySignature(byte[] data, byte[] signature)
{
return DigitalSignature.Verify(data, signature);
}
}
}