Sunday, July 15, 2007

Locking up gifts?

You want to send a valuable object to a friend securely. You have a box which can be fitted with multiple locks, and you have several locks and their corresponding keys. However, your friend does not have any keys to your locks, and if you send a key in an unlocked box, the key could be copied en route. How can you send the object securely?

11 comments:

Anoop said...

Clue: Make the thieves( messenger boy) run !!!!

Sandeep said...

U should send the box with only two locks unlocked.Send it to your friend, with the key to a lock you have in hand in one of the unlocked locks.Ur friend would lock it after taking the key from it;with a lock and he will have the key to it too and send it back to you.You will now place the key in the remaining unlocked lock and lock it with the lock whose key is already with ur friend.AND send it back again..

Sandeep said...

For the above soln i have assumed there is multiple keys to a single lock...

Anoop said...

that is correct :)

Rakesh B.S said...

here is another solution.. lock the box with a lock and keep the key.. send the box to ur frnd without the key.. The frnd will again put a lock on the box and keep the key to himself. He will send the box bak to u. Now remove ur lock from the box and send it bak again. Now the frnd can open the box by opening his lock.

anzal said...

tat too is right....

Jiks said...

This is the anologue of the Public Key Encryption System [ http://en.wikipedia.org/wiki/Public_key_encryption ]

Deepak said...

Sandeep, Rakesh, what if the messenger does all the job that u assume the your friend would do?

Rakesh B.S said...

yea.. gud question sir.. dint notice the flaw in my reasonin there.. :(
sir do u hav a solution?

Deepak said...

Your friend (Bob) should have a lock and key such that

1. You can freely download Bob's lock from the Internet. (Ok. Or buy it from any local vendor) - Lets call that Bob's Lock.

2. Bob and Bob alone has the key to Bob's lock. (Only the lock is public - not the key)

3. The Bob's lock should be self locking. (It needs a key only to open, not to close)

Now if you want to send some object confidentially to Bob. Just download (or buy) one copy of Bob's lock and lock the object with that and send it to Bob.

This is half of what public key cryptography is about. (As Jikku had pointed out) I've intensionally omitted the other half and hence there is a flaw in the algorithm proposed here too. Can you figure that out? And also a solution to it.

Anyway we'll be learning this in the third module of our ITC course.

Deepak said...

Sandeep, don't stop at thinking about locks with multiple keys. Think about keys with multiple locks too.