Wednesday, December 3, 2008

The difference between Public Key & Private Key

There are 2 types of methods to encrypt and decrypt the data :
a) private key encryption & b) Public key encryption

Private key encryption
Private key encryption is the standard form. Both parties share an encryption key, and the encryption key is also the one used to decrypt the message. The difficulty is sharing the key before you start encrypting the message - how do you safely transmit it?
Many private key encryption methods use public key encryption to transmit the private key for each data transfer session.

If Bob and Alice want to use private key encryption to share a secret message, they would each use a copy of the same key. Bob writes his message to Alice and uses their shared private key to encrypt the message. The message is then sent to Alice. Alice uses her copy of the private key to decrypt the message. Private key encryption is like making copies of a key. Anyone with a copy can open the lock. In the case of Bob and Alice, their keys would be guarded closely because they can both encrypt and decrypt messages.

Public Key encryption
Public key encryption uses two keys - one to encrypt, and one to decrypt. The sender asks the receiver for the encryption key, encrypts the message, and sends the encrypted message to the receiver. Only the receiver can then decrypt the message - even the sender cannot read the encrypted message.

When Bob wants to share a secret with Alice using public key encryption, he first asks Alice for her public key. Next, Bob uses Alice's public key to encrypt the message. In public key encryption, only Alice's private key can unlock the message encrypted with her public key. Bob sends his message to Alice. Alice uses her private key to decrypt Bob's message.
The things that make public key encryption work is that Alice very closely guards her private key and freely distributes her public key. She knows that it will unlock any message encrypted with her public key.



Public vs. Private Key

The major differentiator between encryption methods is that of public vs. private key. In a traditional private key system, the encryption and decryption keys are identical and must be kept secret. Each pair of communicating partners or groups must have a secret key.
In a public key scheme, each individual has a pair of keys; a non-secret one for encrypting and a secret one for decrypting. The encryption key is known to anyone who wants it and is generally available from a well-known location to prevent spoofing. Because the encryption key is non-secret, anyone can encrypt a message for a particular recipient, but only the intended recipient has the decryption key allowing the message to be read.

Each user, i, has both a public key, Ei, which is made publicly available, and a private key, Di, which only user i knows. The keys are mathematically related, and both are generated by the user. Thus, there is no need for anyone else to hold the private key, which enhances security.

No comments: