Conversation
Pulling Changes
TSM doesn't use the Security Parameters part of the message, so set up SecurityParameters to have a default and Header, GetRequestMessage, and MessageFactory to not require them.
Added the SecurityModel enum to allow for either TSM or USM, keeping USM default. This required new constructors in GetRequestMessage to take in the SecurityModel
Test example:
var vList = new List<Variable>() { new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.3.0")) };
var receiver = new IPEndPoint(ip, port);
var auth = TsmAuthenticationProvider.Instance;
IPrivacyProvider priv = new TsmPrivacyProvider(auth);
using var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
var myCertCollection = store.Certificates.Find(X509FindType.FindByThumbprint, "", true);
var chain = new X509Chain();
chain.Build(myCertCollection[0]);
var client = new Client(new IPEndPoint(IPAddress.Any, 0));
client.LoadX509Certificate(chain);
client.SupportedCipherSuites.Add(TCipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA);
var request = new GetRequestMessage(VersionCode.V3, Messenger.NextMessageId, Messenger.NextRequestId, new OctetString(user), new OctetString(string.Empty), vList, priv, Messenger.MaxMessageSize);
var reply = request.GetSecureResponse(timeout, receiver, client);
foreach (var v in reply.Pdu().Variables)
{
Console.WriteLine($"RESPONSE: {v}");
}
…perly - it uses C#7.0
lextm
left a comment
There was a problem hiding this comment.
Thanks for your effort. Several parts need modification, and if possible unit test cases should also be added.
SharpSnmpLib/SecurityParameters.cs
Outdated
| /// <value>The privacy parameters.</value> | ||
| public OctetString PrivacyParameters { get; private set; } | ||
|
|
||
|
|
There was a problem hiding this comment.
Why do we need an empty constructor?
There was a problem hiding this comment.
This isn't a constructor. I'm not sure if you selected the wrong part of the code or if there's a problem with PrivacyParameters here?
| /// <returns></returns> | ||
| public ISnmpData GetData(VersionCode version) | ||
| { | ||
| //if empty SecurityParameters, return an empty OctetString |
…arameters Put the namespaces back in order
…to Samples). Moved SecureMessageExtensions to SharpSnmpLib/Messaging and updated the namespace
|
I believe I have updated everything you've asked for except for the 2 I've asked for clarification on. Please let me know if there's anything further, and thank you for getting back to me so quickly |
|
Do you have a round about ETA on when this could be released? |
|
Nope. No ETA at this moment. I am trying to set up a local lab environment to test out the changes, so it can take a relatively long period. |
|
Understood, thank you! |
…essage to allow for SNMPv3 TSM Removed the username parameter in GetRequestMessage setup for TSM
…cting to a server through DTLS. Default is 1 second
Updated the DTLS2.Net library
Added targeting for netstandard2.1
| /// <param name="receiver">The receiver.</param> | ||
| /// <returns></returns> | ||
| public ReportMessage GetResponse(int connectionTimeout, int responseTimeout, IPEndPoint receiver, Client client) | ||
| public async Task<ReportMessage> GetResponse(int connectionTimeout, int responseTimeout, IPEndPoint receiver, Client client) |
There was a problem hiding this comment.
Then you should rename it to GetResponseAsync.
| public static class SecureMessageExtensions | ||
| { | ||
| public static ISnmpMessage GetSecureResponse(this ISnmpMessage request, int connectionTimeout, int responseTimeout, IPEndPoint receiver, Client client) | ||
| public static async Task<ISnmpMessage> GetSecureResponse(this ISnmpMessage request, int connectionTimeout, int responseTimeout, IPEndPoint receiver, Client client) |
There was a problem hiding this comment.
It should be changed to GetSecureResponseAsync.
Simplified platform check.
Merging changes from master
af8c507 to
83a3a43
Compare
…lyzer.CSharp versions to match upstream master Few code feature updates in the DTLS specific stuff
|
Are there still plans to get this merged in at some point? |


Updated to use DTLS2.Net to allow for SNMPv3 over DTLS. I updated DTLS.Net but since they haven't been responding to pull requests or issues I had use it from my fork and called it DTLS2.Net.
TSM doesn't use the Security Parameters part of the message, so set up SecurityParameters to have a default and Header, GetRequestMessage, and MessageFactory to not require them.
Added the SecurityModel enum to allow for either TSM or USM, keeping USM default. This required new constructors in GetRequestMessage to take in the SecurityModel
Test example: