This pair has a unique property-a message locked with one key can only be unlocked by the other matched key. The same key cannot be used to lock as well as unlock the secret message. One key (Grey) is his 'Public Key', that he must share with the whole world, while the other (Golden) key is his 'Private Key' that he must keep secret and give to no one.
Amar distributes his 'Public Key' by attaching it to email he sends, or on his personal web site, or with a 'Public Key' directory that anyone can look up. They could be Amar's friends or spies who snoop on all the messages he receives.
When Amar's colleague Birbal wants to send Amar a secret message, he locks (encrypts) the message using Amar's 'Public Key'. Now the message can be unlocked only using Amar's private key. He sends the message like any other but the contents look like garbage.
A Spy is tapping Amar's Internet connection and makes a copy of the message Birbal sends to Amar.
The message is encrypted so the Spy tries to use Amar's 'Public Key' to unlock it. But he fails. Once a message is locked with one key, it can only be unlocked by the other key in the pair!
Remember that a message locked by one key in the pair can only be unlocked by the other key of the pair.
If Amar wants to prove to everyone that a message is sent by him, he can "sign" the message by locking it using his 'Private Key'. Since it has been locked by Amar's 'Private Key', it can now only be unlocked by his 'Public Key'.
Q. How would Amar send Birbal a secret, signed message?
A. He would first lock it using his 'Private Key', then lock it using Birbal's 'Public Key'!
Anyone can unlock the message Amar sent to Birbal, using Amar's 'Public Key', so his message is not secret. But because the message can be unlocked only by Amar's 'Public Key', it proves to everyone that it has been locked by Amar's 'Private Key'. Since only Amar has his 'Private Key', he must have sent the message!
Amar receives the message from Birbal and sees that it is locked. He pulls out his secret 'Private Key' and tries to unlock (decrypt) the message. Since it has been locked using his own 'Public Key', he can unlock it and read the secret message.