Wednesday, October 21, 2009

Lab 4 Symmetric and Asymmetric Cryptography

In this lab we are focusing on understanding symmetric and asymmetric cryptography, as well as implementing Caesar Cipher, Vigenere Cipher and the RSA algorithm. 

As we all know that there are two types of encipherment in cryptosystems namely symmetric and asymmetric encipherment. Symmetric encipherment can be in the form of substitution, transposition or both. In substitution encipherment, alphabets in the plain text is replaced with another alphabetic character. There are two types of substitution namely monoalphabetic(eg. Caesar cipher) and polyalphabetic(eg. Vigenere cipher) substitution. The transposition encipherment changes the location of characters. Transposition can be either keyed or unkeyed. The asymmetric encipherment uses two keys, which are public key and private key, to encrypt and decrypt.

The Caesar Cipher is formed by shifting the letters of the original alphabet. The example of shift 3 Caesar Cipher is shown below:


plaintext alphabet A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

ciphertext key D E F G H I J K L M N O P Q R S T U V W X Y Z A B C


Cracking the Caesar ciphertext is easy by using brute-force cryptanalysis. The reasons of using the brute-force cryptanalysis are as follows:

  • The encryption and decryption algorithms are known

  • There are only 26 keys to try

  • The language of the plaintext is known and easily recognizable. The pattern is obvious.

Considering that the Caesar ciphertext is easily broken by using the brute-force attack, the Vigenere cipher is introduced in order to improve the deciphering process. The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. Generally, a key is needed to encrypt a plaintext using Vigenere cipher, either using a word or a phrase. 


Vigenere Cipher


Asymmetric encipherment uses keypairs namely the public and private key for encryption and decryption. The public key is known to all but the private key is kept secret. The asymmetric keys are usually generated using the RSA algorithm. The following steps involving calculations are required:

  1. Choose two distinct prime numbers, p and q

  2. Compute n=pq

  3. Compute totient(n) = (p-1)(q-1)
  4. Choose an integer e such that  1
  5. Determine d (using modular arithmetic) which satisfies the congruence relation  

    Regarding encryption, if a person A transmits a public key of (c,e) to person B and keeps the private key secret, person B send a message M to person A. To encrypt message M, it is turned into an integer 0

    For decryption however, person A can recover m from c by using the calculation below:

    m=c^d (mod n)




1 comments:

Amelia said...

Its a well written article. I appreciate you for your efforts and time which you used in writing such a detailed post. Both the main types of cryptography technique is described thoroughly. Thanks for posting.
digital signature software

Post a Comment