Public Key Cryptography



Overview
Symmetric ciphers use the same key for encryption and decryption, which creates a default insecurity due to Alice and Bob sharing the key knowledge. Technically, the true measure of security within a symmetrical cipher is to measure the security of the means by which the key is shared. Compromised keys can result in an incredibly easy decryption and potentially further security issues. As an alternative, asymmetric cryptography utilizes two (mandatory) different keys, in an attempt to eliminate the key sharing insecurities. These asymmetrical ciphers are found most commonly in Public Key Cryptography.
Public and Private Key
Within Public Key Cryptography, one key is kept private, while the other key is distributed publicly or without major restriction. (Hence the Name, Public Key Cryptography)
The Scheme
Alice obtains Bob’s public key (a copy of it at least). Alice creates a message for Bob, then encrypts that message using the public key, hereby generating ciphertext. Doing this is called performing a ‘padding scheme’ and is cryptographically theoretical to OTP (One-Time Pad). Alice then sends the ciphertext to Bob, who, using his private key, reverses the ‘padding scheme’ and hereby decrypts the message.
The Math
The two keys are mathematically related, always. For instance, the RSA cipher has two really large randomly generated prime numbers at it’s beginning. These primes are basically the private key; they are multiplied and the product becomes the public key. Although performing a simple multiplication is by no means a complex ordeal, having two really large primes, and needing to reverse the process creates an exponential level of difficulty, as there may be thousands of potential combinations, and a compromiser would have no clue which two (and sometimes, in what order!) [SPOILER: I get a little carried away with ElGamal and DSA below, please feel free to flame me]
The Attributing Benefits
- Being mathematically difficult to reverse the public key portion down to the private key is a good level of security, which is bolstered by longer keys; 1024-bit keys are often recommended.
- Once the plaintext is encrypted with the public key, the resultant ciphertext can only be decrypted by the private key. There is no way to get the plaintext back from the ciphertext, if the encrypting party only has the public key.
- Once the plaintext is encrypted with the private key, the resultant ciphertext can only be decrypted by the public key. Although in this scenario, the private key can be used to create the public key for decryption.
- Public Key Cryptography (Asymmetrical Ciphers) remove the issues attached to transmitting the decryption key. The security of this Cryptographic application is measured by how secure the private key is kept, albeit, this is a far easier thing to secure.
- The areas and situations which can (and do) leverage Public Key Cryptography is far reaching, from document sharing to chatrooms, its flexibility and utility is immense.
Some Asymmetric Ciphers
Diffie-Hellman
Overview
This is one of the oldest public key ciphers, created by Whitfield Diffie and Martin Hellman in 1976; in 2002 Hellman suggested that the name be changed to Diffie-Hellman-Merkle to recognize Ralph Merkle’s contributions to Public Key Cryptography. This cipher works through a series of mathematical steps, the sender and receiver calculate the same shared secret key using undisclosed private keys, beginning at predefined starting values, which are established before sender/receiver communication begins. After this, a new set of private values are selected to create the session key, which is destroyed at the close of the session. This cipher is the basis for PFS (Perfect Forward Secrecy) within TLS (Transport Layer Security) implementations.
Vulnerabilities
Diffe-Hellman is susceptible to a man-in-the-middle attack; in which a third party, Eve let’s say, positions herself to intercept the communications of Alice and Bob. And in so doing would calculate separate sessions with each. Alice and Bob would have no way of knowing that they were not communicating directly to one another.
RSA
Overview
Probably the most famous public key cipher, developed by Adi Shamir, Leonard Adleman and Ron Rivest. With this cipher, Alice and Bob both create a pair of public and private keys. To communicate securely, Alice acquires Bob’s public key and encrypts the plaintext, sending Bob the resultant ciphertext. If Bob wants to reply securely, he acquires Alice’s public key and encrypts the plaintext, sending Alice the resultant ciphertext.
Vulnerabilities
RSA is vulnerable to brute force attacks, which focus on attempting to calculate the private key from the public key, by repeatedly attempting mathematical ‘guesses’. This is only possible if the keys themselves are of a shorter length, which is why it is recommended to have keys of 1024-bits or longer. RSA is also mildly vulnerable to man-in-the-middle attacks. To work, Eve would need to compromise the communication between Alice and Bob, AND convince them that Eve’s key actually belongs to each other party. This is difficult, and further mitigated by PKI (Public Key Infrastructure system).
Elliptic Curve
Overview
Elliptic Curve (E-C), cipher is similar to RSA as it too uses a pair of keys; however, it utilizes a different mathematical system which is built from the algebra of elliptic curves of large finite fields. This is done in an effort to mitigate the issues found in RSA concerning brute force attacks against the large factorial numbers. Because of this increased complexity in calculation, the keys of Elliptic Curve can permissibly be shorter than RSA keys for comparable levels of security. Elliptic Curve is used widely in Java, C# and the .NET Framework, it is also the basis of OpenSSL.
Vulnerabilities
Elliptic Curve is vulnerable to brute force attacks, but in an almost negligible degree. Elliptic Curve is vulnerable to man-in-the-middle attacks, to the extent that RSA is.
ElGamal
Overview
ElGamal cipher is an algorithm for creating asymmetric keys; developed by Taher Elgamal in 1984. Alice creates a key by using an efficient description of a multiplicative cyclic group, and an exponential calculation from that group; the resultant calculation is published along with the cyclic group as the public key. Bob creates a random exponential calculation from the published cyclic group, he then calculates a new shared secret from the public key using his random exponential, this is called the ephemeral key. Using the cyclic group and his ephemeral key, Bob then generates the ciphertext and sends it to Alice; who, using Bob’s exponential calculcation and her secret key, calculates the ephemeral key. With the ephemeral key, she calculates the plaintext from the ciphertext. ElGamal is used in PGP and GNU Privacy Guard.
Vulnerabilities
ElGamal is vulnerable in a chosen-cipher attack scenario. In this scenario, the compromiser is permitted to know the plaintext and ciphertext of a message of his/her choice.
DSA
Overview
DSA (Digital Signature Algorithm) designed in 1991 by the NIST (National Institute of Standards and Technology) and attributed to Dr. David W. Kravitz, is an asymmetrical encryption system, used by the US Government. Alice choses an approved hash function (SHA-1/SHA-2) , a set of key lengths (Typically 1024 or longer [the second MUST be longer]), a prime less than or equal to the hash output length, a prime modulus based on the shorter key length such that it minus one is a multiple of the previously selected prime, and a number, whose multiplicative order modulo of the previously selected prime modulus is equal to the previously selected prime. With these, she calculates her public and private keys. Bob then calculates a random message number which is less than Alice’s prime, with this he calculates a signature equal to Alice’s multiplicative order modulo number, exponentially raised by Bob’s random message number and modulo to the prime number from Alice’s public key. Using this signature, Bob then generates the ciphertext. Alice, then verifies the signature and thereby the ciphertext.
Vulnerabilities
DSA is vulnerable only to the extent that the chosen components of ‘Alice’ are secured.


More
206 responses to "Public Key Cryptography"
Wow this is a great resource.. I’m enjoying it.. good article
great information you write it very clean. I am very lucky to get this tips from you.
Cheers for posting this it was used as a source for a paper I am at this time writing for my thesis. Thanks