Tagged: encryption
- This topic has 10 replies, 2 voices, and was last updated 10 years, 6 months ago by Anonymous.
-
AuthorPosts
-
May 19, 2014 at 16:00 #2589AnonymousInactive
Hello,
My application has a few connections some encrypted and some not.
First I tried like that:Creating options:
var processors = new List<DataProcessor> { DPSManager.GetDataProcessor<SharpZipLibCompressor.SharpZipLibGzipCompressor>(), DPSManager.GetDataProcessor<RijndaelPSKEncrypter>() }; var dataOptions = new Dictionary<string, string>(); RijndaelPSKEncrypter.AddPasswordToOptions(dataOptions, "godlike"); var options = new SendReceiveOptions(DPSManager.GetDataSerializer<ProtobufSerializer>(), processors, dataOptions) { UseNestedPacket = true };
using them:
var listener = new TCPConnectionListener(_options, ApplicationLayerProtocolStatus.Enabled);
Doesn’t work. Got “Options must contain encryption key”. Which means that my key is not in the dictionary, but wait! I put it there.
Then I tried that:RijndaelPSKEncrypter.AddPasswordToOptions(NetworkComms.DefaultSendReceiveOptions.Options, "godlike");
Suddenly works!
This is not the bug. It is design flaw. Encryption takes key/pass only from NetworkComms.DefaultSendReceiveOptions, but what if I need two different encrypted connections with different passwords? I MUST be missing something. I can’t believe that it is like that by design. Anyway it is not obvious at all, how one should handle situations like that.
I hope I am wrong and there is a genuine and graceful way two handle to separate encrypted connections.
Please, let me know.Regards,
Igor.- This topic was modified 10 years, 6 months ago by .
May 19, 2014 at 19:06 #2591AnonymousInactiveHeya Igor,
Thanks for the post. How do you start listening for incoming connections?
Regards,
MarcMay 19, 2014 at 23:16 #2593AnonymousInactiveHi Marc,
I do it like that:
var listener = new TCPConnectionListener(_options, ApplicationLayerProtocolStatus.Enabled); listener.AppendIncomingPacketHandler<string>("some message", (header, connection, customObject) => { Console.WriteLine("\nReceived custom protobuf object from " + connection); }); .... Connection.StartListening(listener, new IPEndPoint(ip, 0));
Thanks for quick response.
- This reply was modified 10 years, 6 months ago by .
May 20, 2014 at 09:56 #2596AnonymousInactiveHeya iYalovoy,
I am investigating the problem.
Regards,
MarcMay 20, 2014 at 10:24 #2597AnonymousInactiveiYalovoy could you possible put together a simple console use case that demonstrates the problem and send me a download link, either forum or to support@networkcomms.net? This would allow me to find a solution faster.
Regards,
MarcMay 20, 2014 at 14:50 #2598AnonymousInactiveAlways happy to contribute to library development!
[linkremoved]May 20, 2014 at 21:35 #2602AnonymousInactiveThis is a genuine bug. For the time being you might be able to get around it by replacing the following line:
listener.AppendIncomingPacketHandler<string>("Kill all humans", (header, con, customObject) => { Console.WriteLine("\nReceived custom protobuf object from " + con); });
with:
listener.AppendIncomingPacketHandler<string>("Kill all humans", (header, con, customObject) => { Console.WriteLine("\nReceived custom protobuf object from " + con); }, options);
I’m working on a fix so that your use case works as expected. It should be released as part of 3.0.1.
Regards,
MarcMay 20, 2014 at 21:42 #2603AnonymousInactiveCompletly missed the fact, that AppendIncomingPacketHandler has SendReceiveOptions parameter.
Anyway, thanks for quick response. Keep going good work!May 20, 2014 at 22:27 #2604AnonymousInactiveWell…
“might be able to” Means you haven’t even checked?
Becauselistener.AppendIncomingPacketHandler<string>("Kill all humans", (header, con, customObject) => { Console.WriteLine("\nReceived custom protobuf object from " + con); }, options);
doesn’t work as well.
May 20, 2014 at 22:57 #2605AnonymousInactivehmmm, it did work for me, perhaps I was on a different revision. I should hopefully be able to release 3.0.1 in a day or two which fixes it correctly.
Marc
-
AuthorPosts
- You must be logged in to reply to this topic.