Main |
Codex |
Librarium | Whitehat Advisories |
Blog | Pics |

Cryptography is a common, widespread and fundamental aspect of information security. It's most basic definition is that it is the practise of keeping secrets by encrypting the data, it also encompasses cryptanalysis which is the art of decrypting secret data. Both are opposite sides of the same coin. People who make cryptosystems are known as cryptographers, and those who break ciphers are known cryptanalysts. It is also important to understand the difference between codes and ciphers. Codes are words or symbols which are used to represent something ("cool" is often a code word for "looking good"), but are not meant to ensure confidentiality, whereas ciphers are designed to hide the true meaning of the message.

Cryptography takes plaintext -the unencrypted data-, transforms it into ciphertext -the encrypted data- by using a cipher -an encryption algorithm or method- and a key -a value used in conjunction with a cipher to create ciphertext. Most cryptosystems obey a fundamental idea regarding cryptosystems called

Any encryption algorithm also needs to ensure that certain aims are met. First is

- The amount of secrecy needed should determine the amount of work needed for the encryption and decrytption of the data.
- The set of keys and the enciphering algorithm should be free from complexity
- The implementation of the enciphering process should be as simple as possible
- Any errors in the enciphering should not propagate and cause corruption of further data
- The size of the ciphertext should be no larger than the text of the original message

- It is based upon sound mathematics
- It has been analyzed by competent experts and is sound
- It has "stood the test of time"

So we see that cryptography can provide confidentiality in it's hiding away of secret data, it can provide integrity as it can be used to detect any changes which may have happened to the data, and it can provide accountability as it can be used to verify the origin of the data. Although please bear in mind that not all cryptosystems are built to accomplish all three of these goals.

Cryptosystems are used to encipher data using a cipher, and can be broken down into a couple of broad categories;

- Symmetric encryption
- Asymmetric encryption
- Physical encryption
- Hashing encryption
- Quantum encryption

In this type of cryptosystem only one key is used. That means that there is only one key for both the encryption of the plaintext and the decryption of the resultant ciphertext. So if person A used a symmetric cryptosystem, with a key of X, to send an encrypted message to person B. Than person B would need to know, and use, the key of X as well as the same cryptosystem in order to decrypt the secret message. This type of encryption and decryption is very fast.

The weak point in the system is also it's strength, the key. If the key used is compromised then the entire process is compromised, so every person using the cryptosystem who wants to securely exchange data would have to keep the key secret. Now with group of a 100 people, each person would need a copy of the secret key, each of the 100 would need to securely receive their copy of the key, and then also securely use and keep it. Statistically the chances of one of 100 copies being compromised is much greater then a smaller group of 10. A similar problem is that if you want to securely exchange data with a 100 people separately, you would need to keep track of, securely keep and use, 100 different keys.

This is also known as "public key" encryption. In this system each user has two keys, one private key which is kept secret, and a public key which is shared. A user can encrypt data with another person's public key to ensure that only the person with the matching private key can decrypt it. Or they could encrypt data with their private key and allow anyone with access to the public key to decrypt it.

This system allows any new users to be easily added as the same key pair is used, users can be removed easily, the key only needs to be changed when the private key has been compromised, and the distribution of keys is safe as only the public keys are distributed. The drawback to this system is the that the encryption and decryption is slower than other systems.

This method of encryption is what many of the classical encryption systems fall into. By classical I mean those systems used by the Greeks, by Caesar, etc. A general definition of these systems is that they do not encipher the data using a mathematical process.

This encryption system uses a mathematical process to perform a calculation against the data and return a numeric or hash value. Unlike other encryption systems, hashing is a one-way system, this means that it is impossible to use the hash value to deduce the original data. But the hash value does serve as a highly effective checksum, meaning that it allows a way of seeing if the data has changed. If the checksum of data at the recipient is different to that of the originator, the data was tampered with in transit.

This system depends on the scientific method known as

Lets look at some of the ciphers used by cryptosystems to encode data;

- Substitution cipher
- Transposition cipher
- Steganongraphic cipher
- Block cipher
- Stream cipher

These are ciphers that changes one character or symbol into another one. The basic way of doing this is the

These are ciphers which involve scrambling the letters in some way, the message is generally broken into blocks then each block is scrambled, and the letters are interchanged in some way. An example would be "attack at five", take out the spaces would give "attackatfive", split into 2 blocks of 6 would be "attack atfive". Now stack the blocks;

take the 1 letter at the top, then second letter at bottom, and so on to get "attice", the remain characters are "atfavk", so the encrypted message is "attice atfavk".

These ciphers basically hide the secret data inside other data. The enciphered data could still look like normal data but the real message is encrypted inside it. A very basic example would be "please all gather to meet at seventeen one one", take every third word and the decrypted message is "gather at one".

Ciphers like this mathematically encipher data in blocks. The plaintext data is split into blocks and then each block is enciphered to produce the total ciphertext. The are multiple ways to do this;

- ECB, Electronic Code Book is where each block is encrypted independently.
- CBC, Code Book Cipher is where the block which is to be encrypted uses the results of a mathematical process run against the previous block to help secure the encryption.
- OFB, Output Feedback Cipher is where individual blocks are not used, but the key is used to generate data the same length as the data to be encrypted, and then uses a mathematical process against the generated data to securely encrypt the plaintext.

With this cipher each bit of data is sequentially encrypted using one bit of the key, the reverse process is followed to decrypt the data. Stream ciphers can be made mathematically impossible to break by using different random keys for the encryption. One implementation of such a system is

Well thats it, a general overview of some cryptographic principles. I hope it was interesting. It is worth getting to about cryptography as it is heavily used in our everyday lives, and the more we understand about it, the better we can chose what we use day in and day out.