| | | 1 | | using Renci.SshNet.Abstractions; |
| | | 2 | | using Renci.SshNet.Security.Org.BouncyCastle.Asn1.Sec; |
| | | 3 | | using Renci.SshNet.Security.Org.BouncyCastle.Asn1.X9; |
| | | 4 | | |
| | | 5 | | namespace Renci.SshNet.Security |
| | | 6 | | { |
| | | 7 | | internal sealed class KeyExchangeECDH521 : KeyExchangeECDH |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Gets algorithm name. |
| | | 11 | | /// </summary> |
| | | 12 | | public override string Name |
| | | 13 | | { |
| | 9 | 14 | | get { return "ecdh-sha2-nistp521"; } |
| | | 15 | | } |
| | | 16 | | |
| | | 17 | | /// <summary> |
| | | 18 | | /// Gets Curve Parameter. |
| | | 19 | | /// </summary> |
| | | 20 | | protected override X9ECParameters CurveParameter |
| | | 21 | | { |
| | | 22 | | get |
| | 15 | 23 | | { |
| | 15 | 24 | | return SecNamedCurves.GetByName("P-521"); |
| | 15 | 25 | | } |
| | | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets the size, in bits, of the computed hash code. |
| | | 30 | | /// </summary> |
| | | 31 | | /// <value> |
| | | 32 | | /// The size, in bits, of the computed hash code. |
| | | 33 | | /// </value> |
| | | 34 | | protected override int HashSize |
| | | 35 | | { |
| | 0 | 36 | | get { return 512; } |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Hashes the specified data bytes. |
| | | 41 | | /// </summary> |
| | | 42 | | /// <param name="hashData">The hash data.</param> |
| | | 43 | | /// <returns> |
| | | 44 | | /// The hash of the data. |
| | | 45 | | /// </returns> |
| | | 46 | | protected override byte[] Hash(byte[] hashData) |
| | 24 | 47 | | { |
| | 24 | 48 | | using (var sha512 = CryptoAbstraction.CreateSHA512()) |
| | 24 | 49 | | { |
| | 24 | 50 | | return sha512.ComputeHash(hashData, 0, hashData.Length); |
| | | 51 | | } |
| | 24 | 52 | | } |
| | | 53 | | } |
| | | 54 | | } |