forked from sshnet/SSH.NET
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Prioritizing of encryption algorithms (might be SECUR…
…ITY HOLE)"" This reverts commit 242c48a.
- Loading branch information
smazov
committed
Jul 25, 2019
1 parent
242c48a
commit 46ce8a7
Showing
10 changed files
with
179 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
|
||
namespace Renci.SshNet | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public sealed class PriorityString : IEquatable<PriorityString> | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public string Value { get; private set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public int Priority { get; private set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="value"></param> | ||
/// <param name="priority"></param> | ||
public PriorityString(string value, int priority) | ||
{ | ||
Value = value; | ||
Priority = priority; | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="other"></param> | ||
/// <returns></returns> | ||
public bool Equals(PriorityString other) | ||
{ | ||
if (ReferenceEquals(null, other)) return false; | ||
if (ReferenceEquals(this, other)) return true; | ||
return string.Equals(Value, other.Value) && Priority == other.Priority; | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="obj"></param> | ||
/// <returns></returns> | ||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
return obj is PriorityString && Equals((PriorityString) obj); | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <returns></returns> | ||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
return ((Value != null ? Value.GetHashCode() : 0) * 397) ^ Priority; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="src"></param> | ||
/// <returns></returns> | ||
public static implicit operator PriorityString(string src) | ||
{ | ||
return new PriorityString(src, 0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace Renci.SshNet.Security | ||
{ | ||
/// <inheritdoc /> | ||
public class CertificateKeyHostAlgorithm : KeyHostAlgorithm | ||
{ | ||
private readonly byte[] _data; | ||
|
||
/// <inheritdoc /> | ||
public override byte[] Data | ||
{ | ||
get { return _data; } | ||
} | ||
|
||
/// <inheritdoc /> | ||
public CertificateKeyHostAlgorithm(string name, Key key) | ||
: base(name, key) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
public CertificateKeyHostAlgorithm(string name, Key key, byte[] data, int maxKeyFields) | ||
: base(name, key, data, maxKeyFields) | ||
{ | ||
_data = data; | ||
} | ||
} | ||
} |
Oops, something went wrong.