A private key, as the name suggests, is a randomly generated number that is kept secret and held privately by its users. Private keys need to be protected and no unauthorized access should be granted to that key; otherwise, the whole scheme of public key cryptography is jeopardized, as this is the key that is used to decrypt messages. Private keys can be of various lengths depending on the type and class of algorithms used. For example, in RSA, typically a key of 1024-bits or 2048-bits is used. The 1024-bit key size is no longer considered secure, and at least a 2048-bit key size is recommended.
A public key is freely available and published by the private key owner. Anyone who would then like to send the publisher of the public key an encrypted message can do so by encrypting the message using the published public key and sending it to the holder of the...