开发者

Verify p2p node

Hey guys, I have been working on a p2p namespace for some of my programs. I created a system to encrypt/decrypt the packets send/received with the class. I was using the basic public private key system: 1) encrypt the data with Symmetric encryption 2) encrypt the symmetric key with RSA. Then do the opposite when you decrypted..

I was wondering though, how would you verify if the packet was coming from where it said it was. I was going to use a basic certificate system (where you encrypt with your private RSA key, then they decrypt it with your publ开发者_JAVA百科ic key), but I don't know how to do this with C#. I am using the RSACryptoServiceProvider class.

Does anyone know how do this? Thanks, Max


The standard protocol for sending packets securely is SSL/TLS. The RFCs for TLS and DTLS (and a fix for a recent flaw) are the way to go. They should also be considered a resource for those learning and looking for ideas.

It sounds like you're a looking for a MAC. A very efficient set of crypto primitives that perform both encryption and MACing at the same time are the AEAD ciphers, see for example CCM and GCM block cipher modes.

I do not believe .NET supports any AEAD ciphers. You can also use the slower but perfectly adequate HMAC algorithm which is supported in .NET, or you can use the bouncycastle C# library which does support AEAD ciphers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜