What is Public Key Cryptography?
Public key cryptography is a cryptographic system that uses a pair of keys to share secrets. In public key cryptography a public key and a private key is used for each user.
The public key is public, and therefore anyone can see it. The private key is, as you can imagine, private and should not be shared with anyone.
These keys always go in pairs and are linked together through a cryptographic function. You are always able to calculate the corresponding public key to a private key, but it is impossible to calculate a corresponding private key from a public key.
From a private key you are able to decrypt something that was encrypted with your public key; anybody can encrypt something with a public key, but only who has the corresponding private key is able to decrypt it and get the message.
Public key cryptography is what is used in Bitcoin to create transactions and to know who the sender of a transaction is, and who the receiver is. Here is a slightly simplified explanation of the process of a Bitcoin transaction:
When a transaction is created the sender signs a message with a private key that has had bitcoins sent to it previously, to prove that it owns the funds; the sender then states an address to send it to, this address is the hash of a public key.
This message is then broadcast to the whole bitcoin network. This process informs the whole network that the balance has changed hands and now the bitcoins of that transaction can be spend by the person that just received them. Only the private key corresponding to the receiving address (hash of the public key) stated in the transaction will be able to spend the bitcoins in the future.