Keys are pieces of information that determine the output from an encryption (or decryption) process. A single cipher can produce an almost limitless number of different outputs with different key values; allowing secure communication even if the cipher itself is known to hostile third parties.
It might surprise you to know that almost all ciphers are published in the scientific press or in standards documents, having them available for widespread scrutiny allows many people to check that they are secure and do not contain weaknesses which could be exploited to compromise the security of the data encrypted using that cipher.
A computer encryption key is nothing more than a string of bits where each bit can have a value of either 0 or 1. The number of possible values for a key is simply the total number of values that the key can have. So our one-bit long key can only have two possible values – 0 and 1. If we chose to have a two-bit key it could have one of four possible values – 00, 01, 10 and 11. In fact every time we increase the length of the key by one bit we double the number of possible keys – so a three-bit key has eight possible values – 000, 001, 010, 011, 100, 101, 110 and 111.
The total number of keys can be written in scientific form as 2key length; so a key with a length of eight has 28 – that is 256 – values.
But how long should a key be? How short is too short?
The problem with short keys
Short keys are vulnerable to what is known as a brute force attack about passwords. A brute force attack is where a computer, or a number of computers, try every possible value for a key until they produce recognisable plaintext.
Since computers can work through key values extremely rapidly, keys must be sufficiently long that they offer a very large number of possible values.
Keys may be known to the user in the form of passwords, or they may be stored in a computer’s hardware (such as the decryption keys stored on a DVD player that allow it to play the encrypted data stored on the movie disk), or they can be generated by a computer as and when they are needed (such as conducting a secure transaction on a shopping site).
The key distribution problem
Traditionally, symmetric encryption suffered one enormous shortcoming – it was necessary for either the sender or the recipient to create a key and then send it to the other party. While the key was in transit, it could be stolen or copied by a third party who would then be able to decrypt any ciphertexts encrypted with that key.
Another problem is that a large number of key pairs are needed between communicating parties. This quickly becomes difficult to manage the more there are. This can be calculated as n(n-1)/2 where n is the number of communicating parties.
For example, if ten parties want to communicate with each other securely they would need 45 different key pairs: 10(10-1)/2 = 45. This would increase to 4,950 if there were 100 communicating parties!
This problem, called the key distribution problem, affected anyone wishing to use encryption until the 1970s when a method of distributing keys without actually sending the keys themselves was developed independently by GCHQ in the United Kingdom and Whitfield Diffie and Martin Hellman in the United States. The British discovery was kept secret for many years, so today the solution is known as the Diffie–Hellman key exchange method.
Symmetric encryption methods have the advantage that encryption and decryption is extremely fast, making them ideal for transmitting large amounts of secure data.
Asymmetric or public key cryptography
Asymmetric cryptography, better known as public key cryptography, sidesteps the key distribution problem as each user creates their own keys:
- the private key which they keep safe and never distribute
- the public key which can be sent to anyone with whom they want exchange encrypted information.
Whereas symmetric encryption only provides confidentiality of the messages exchanged, the use of two different keys allows asymmetric encryption to provide both confidentiality and authenticity. To get confidentiality Alice encrypts the message with Bob’s public key. This message can only be decrypted with the Bob’s private key so Alice and Bob can be sure that nobody else will be able to read it. However, if Alice also wants to prove to Bob that the message is authentically from her, she can first encrypt it using her private key, and encrypt the resulting message again using Bob’s public key. Once Bob decrypts the message using his private key, he can try to decrypt the result again using Alice’s public key. If this is successful, he can be confident that message must have come from Alice (since nobody else should know her private key).
So an important property of asymmetric cryptography is that the private key is the only key that can decrypt ciphertext encrypted using the corresponding public key and the public key is the only key capable of decrypting files encrypted with the corresponding private key. Crucially, the value of one key cannot easily be determined from the other, so even if the public key falls into hostile hands, the value of the private key cannot be determined.
Public keys can be distributed using email attachments or through public key chain servers which act as distributors for large numbers of public keys. The creator of a public key uploads their key to the key chain server and it is freely available to anyone who wants to use it.
Although the mathematics behind public key cryptography is incredibly complex, the process of using it is relatively simple. To send a message using public key cryptography is simple. The sender obtains a copy of the recipient’s public key, either by email or from a key chain server, and uses it to encrypt the message. The resulting ciphertext is then sent to the recipient who uses their corresponding private key to restore the original plaintext.
Public key cryptography is popular because there does not have to be any initial secure exchange of secret keys for an encrypted message to be sent (remember, users only ever exchange their public keys). However, it is generally far slower than symmetric encryption; and because of a quirk in the underlying mathematics, traditional public key cryptographic techniques require far longer keys to offer the same level of protection as symmetric encryption.
A newer type of public key cryptography, known as ‘elliptic curve cryptography’, can be just as secure as symmetric encryption using similar key lengths.
No comments:
Post a Comment