using Renci.SshNet.Abstractions;
using Renci.SshNet.Security.Org.BouncyCastle.Asn1.Sec;
using Renci.SshNet.Security.Org.BouncyCastle.Asn1.X9;
namespace Renci.SshNet.Security
{
internal sealed class KeyExchangeECDH256 : KeyExchangeECDH
{
///
/// Gets algorithm name.
///
public override string Name
{
get { return "ecdh-sha2-nistp256"; }
}
///
/// Gets Curve Parameter.
///
protected override X9ECParameters CurveParameter
{
get
{
return SecNamedCurves.GetByName("P-256");
}
}
///
/// Gets the size, in bits, of the computed hash code.
///
///
/// The size, in bits, of the computed hash code.
///
protected override int HashSize
{
get { return 256; }
}
///
/// Hashes the specified data bytes.
///
/// The hash data.
///
/// The hash of the data.
///
protected override byte[] Hash(byte[] hashData)
{
using (var sha256 = CryptoAbstraction.CreateSHA256())
{
return sha256.ComputeHash(hashData, 0, hashData.Length);
}
}
}
}