using Org.BouncyCastle.Asn1.Sec;
using Org.BouncyCastle.Asn1.X9;
using Renci.SshNet.Abstractions;
namespace Renci.SshNet.Security
{
internal sealed class KeyExchangeECDH256 : KeyExchangeECDH
{
///
/// Gets algorithm name.
///
public override string Name
{
get { return "ecdh-sha2-nistp256"; }
}
#if NET8_0_OR_GREATER
///
/// Gets the curve.
///
protected override System.Security.Cryptography.ECCurve Curve
{
get
{
return System.Security.Cryptography.ECCurve.NamedCurves.nistP256;
}
}
#endif
///
/// Gets Curve Parameter.
///
protected override X9ECParameters CurveParameter
{
get
{
return SecNamedCurves.GetByOid(SecObjectIdentifiers.SecP256r1);
}
}
///
/// 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)
{
return CryptoAbstraction.HashSHA256(hashData);
}
}
}