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.
Prioritizing of encryption algorithms (might be SECURITY HOLE)
Sending SSH certificate to client
- Loading branch information
msvprogs
committed
Jul 24, 2019
1 parent
71a1c07
commit 97c6ce7
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.