RE: [Algorithms] Message signature in token ring
Brought to you by:
vexxed72
From: Tom F. <to...@mu...> - 2003-04-15 16:30:28
|
>Does such an encryption algorithm ("encrypt with private key, decrypt with public key") exist? Certainly - PGP for example. But they're very slow. Best way to do this is to securely (e.g. with public/private key stuff) send a client ID to each client at start of day - just a fairly big random number. Then for each message, the client takes the message, appends their key, throws the thing through a good hash algo (not sure CRC is good enough, there's plenty more secure ones), and sends the message in clear, and appends the hash. The server recieves the message, appends the client's key, hashes it, and checks the hashes agree. Another user can't spoof because they don't know the key, and so can't generate a valid hash. Make sure there's some sort of sequence number in there as well, or it will be vulnerable to replay attacks. But really, you need a proper crypto book - this has all been solved before, with a lot more rigour. Tom Forsyth - Muckyfoot bloke and Microsoft MVP. This email is the product of your deranged imagination, and does not in any way imply existence of the author. -----Original Message----- From: Space Needle Exchange Program [mailto:SPA...@ho...] Sent: 15 April 2003 16:55 To: gda...@li... Subject: Re: [Algorithms] Message signature in token ring Well, all the peers on the ring are running the same code. So if I only used CRC or MD5 of the message, anyone could also easily generate that same hash for a message they spoof or alter. It seems like I need some kind of algorithm like the following: Each peer has a private key that it encodes its message with. The message is sent with a public key attached to it. Any peer can use that public key to decode the message upon receipt. But even this won't work, because, again, anyone can encode any message and send the proper public key (their public key) with it. Something has to go into the message that uniquely identifies it as coming from a particular peer. Hmm. I think I have an idea, assuming that a "encrypt with private key, decrypt with public key" algorithm exists: Each peer at initialization generates a private key and a public key. The peer then generates an MD5 hash of the public key and sets its GUID as that hash. Now, any message sent by the peer looks like: [GUID][Public key][encrypted message] Upon receipt, the peer verifies that the GUID is a proper MD5 hash of the public key, and then decrypts the message using the public key. This guarantees that whatever contents lay in the message are only applied to the peer corresponding to that GUID, which makes spoofing a message on behalf of another player or tampering with a message impossible. (Again, other than outright destruction. The encrypted message should also contain a CRC or MD5 checksum to ensure that no one randomly fiddled with the bits in the encrypted message, hoping to "get lucky" and make something happen.) How does this sound? (Other than severe packet bloat.) Does such an encryption algorithm ("encrypt with private key, decrypt with public key") exist? snx ----- Original Message ----- From: Justin Heyes-Jones To: gda...@li... Sent: Tuesday, April 15, 2003 1:59 AM Subject: Re: [Algorithms] Message signature in token ring You could generate a CRC for the message and tag it to the end. Grab some CRC generating code from the web to do that. Then if a user wants to tamper with the message he needs to use the same CRC generation to get a legal message. To make it a little harder you could also XOR the CRC with a constant, then XOR it with the same constant on the receiving end. Justin, Genepool-UK ----- Original Message ----- From: Space Needle Exchange Program To: gda...@li... Sent: Tuesday, April 15, 2003 3:00 AM Subject: [Algorithms] Message signature in token ring I have a token ring-like networked communication structure where in order to send a message to another peer on the ring, I pass the message to my neighbor, and he sends it on, until it reaches its destination. My question is: how can this message be "signed" so that no one on the ring can spoof messages on my behalf, or more easily, modify the contents of messages that are supposed to be merely forwarded along? I don't need to keep the peers on the ring from reading the message as they forward it along (nothing sensitive will be sent this way), I just want to prevent spoofing/tampering. I don't need to worry about peers that outright choose not to send along messages right now. If it involves sending some kind of key/signature in every message, it would be nice to keep that <= 128 bits. The protection doesn't have to be super strong, since there is no incentive to crack, other than creating mischief. I don't know much about cryptography, what are the right tools to use here? Is what I'm talking about even possible? snx |