Public/Private Keys Overview
Encryption is a means of communicating confidential information with someone so that the data being transferred is hidden (unreadable) to anyone whom it is not intended. Symmetric-key encryption is where the sender and the receiver of the message share the same key. This key is used to both encrypt and decrypt the message. If Joe and Carl want to communicate with each other, they both must know what the secret key it. They also need a secure means of exchanging the key with each other. Now if Carl also wants to comminute securely with George, they must have a different secret key that exists between Joe and Carl. (Carl and George wouldn't want Joe to be able to read their message.) One of the biggest downfalls of Symmetric-keys is key management. In an environment with many users, this can get quite cumbersome.
Public Key Cryptography
Public key cryptography solves both the management of keys and the ability to securely distribute keys to many people. In the public key scheme, each person will generate a public and a private key.
Each person can publish their public key while their secret key must remain confidential to them. Messages that are encrypted with a public key can ONLY be decrypted with its private key. Keys may not be deduced from each other. Unlike symmetric-keys, users do not share confidential information, since all communications involves only their public keys. A users private key is neither published nor shared.
Lets say that Joe wants to send Carl an encrypted message. Joe needs to first obtain Carl's public key. This is fairly easy since Carl's public key is public knowledge. Carl may elect to simply mail Joe a version of his public key. Joe then uses Carl's public key to encrypt a message. Once Carl gets the message, he uses his private key to decrypt the message. Since no one else has Carl's private key, no one else but Carl can read the message from Joe. (Not even the sender Joe). Keep in mind that if Carl wants to send encrypted information to Joe, Carl needs to obtain a copy of Joe's public key and perform the same steps that Joe did to encrypt the message.
Digital signatures are nothing more than using the above example and putting it into reverse. A digital signature is a non-forgeable way of digitally signing a message. This is a way of authenticating that the sender of a message is really and truly the person that they say they are. The sender cannot later claim that someone tried to impersonate them.
Lets say that Joe wants to send Carl a message. Carl wants to know for sure that the message really came from Joe. Before Joe sends the message, Carl asks him to digitally sign the message. Joe then uses his private key to sign the message. When Carl gets the message, he must have a copy of Joe's public key to verify the message. When Carl performs the verify, if the hash comes out exactly the same (using Joe's public key), then only Joe could have sent that message.
To ensure the confidence in the identity of a public key, public keys are incorporated into digital certificates. A digital certificate is a binding of a public key to a user by a trusted third party known as a Certificate Authority. The public key and the users identity, together with other information such as the certificate expiration date, are digitally signed by the Certificate Authority. Certificate Authorities are nothing more than electronic notaries, attesting to the identity of users and the validity of their public keys.
Certificates may be issued in several different ways. For example, Joe may generate his own public/private key pair and send the public key to an appropriate Certificate Authority with some proof of his identification. The Certificate Authority then validates the identity of Joe to ensure that Joe is really Joe. Next, the Certificate Authority sends Joe back a certificate attesting to the binding between Joe and his public key, along with a hierarchy of certificates verifying the Certificate Authorities public key. Joe can then publish this certificate chain whenever necessary to demonstrate the legitimacy of his public key.
Another way for Joe to obtain a certificate is to have an administrator generate the public/private key pair for him in a way that the person generating the keys does not know the private key for Joe. The private key is then given to Joe either on a disk or within a token. The public key belonging to Joe is then bond to a certificate by the Certificate Authority with a copy given to Joe and a copy posted to a public database of keys for download purpose.