Assignment Of Network Security And Cryptography Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

An attack in computer and computer networks is any attempt to destroy, expose, alter, disable, steal or gain unauthorized access to or make unauthorized use of an asset. An attack vector is a path or means by which a hacker can gain access to a computer or network server in order to deliver a payload or malicious outcome. Attack vectors enable hackers to exploit system vulnerabilities, including the human element.

Security attack refers to a process whereby a person compromise your computer by installing harmful malicious software in your computer without your knowledge. These malicious software includes viruses, spywares, adwares, and trojan horses. These software often deletes certain vital files on your computer, making your computer to function abnormally, spying on your online surfing habits, and cause advertisements to pop up on your screen when you are online.

Passive Attack

A passive attack monitors unencrypted traffic and looks for clear text passwords and sensitive information that can be used in other types of attacks. Passive attacks include traffic analysis, monitoring of unprotected communications, decrypting weakly encrypted traffic, and capturing authentication information such as passwords. Passive interception of network operations enables adversaries to see upcoming actions. Passive attacks result in the disclosure of information or data files to an attacker without the consent or knowledge of the user.

Active Attack

In an active attack, the attacker tries to bypass or break into secured systems. This can be done through stealth, viruses, worms. Active attacks include attempts to circumvent or break protection features, to introduce malicious code, and to steal or modify information. These attacks are mounted against a network backbone, exploit information in transit, electronically penetrate an enclave, or attack an authorized remote user during an attempt to connect to an enclave. Active attacks result in the disclosure or dissemination of data files or modification of data.

The difference between passive and active attack:-

Passive attacks

In passive attack an unauthorized attacker monitors or listens in on the communication between two parties. Below illustrates a passive attack where Eve monitors the communication between Alice and Bob.


Active attacks

In this type of attack requires the attacker to be able to transmit data to one or both of the parties, or block the data stream in one or both directions. The attacker is located between the communicating parties. In this case the attacker can stop all or parts of the data sent by the communicating parties. This attacker can like try to take the place of the client or server when the authentication procedure has been performed. Without integrity checks of the received data, the server will not detect that the origin of the data is not the authenticated person. A clever programmer can, with not to much effort, implement a system like this on a computer acting as a gateway between two subnets.


A passive attack make use of information from the system but does not affect system resources.An active attack attempt to alter system resources or affect their operation.

An attack can be active or passive

An "active attack" attempts to alter system resources or affect their operation.

A "passive attack" attempts to learn or make use of information from the system but does not affect system resources. example wiretapping

Passive attacks do eavesdropping on, or monitoring, transmissions. Electronic mail, file transfers, and client/server exchanges are examples of transmissions that can be monitored. Active attacks include the modification of transmitted data and attempts to gain unauthorized access to computer systems.

For the active attack the attacker needs to first gain the physical control of the media where as for passive attack the attacker merely needs to observe the conversation , active attacks can be easily detected but passive cannot hence prevention is better for passive attacks and proper cure should be taken in case of active attack moreover attacker needs more time to get information about the target in passive attack but active attack the attacker uses these information to launch an successful attack on target.

For an active attack, the attacker needs to gain physical control of a portion of the link and be able to insert and capture transmissions like medium could be telephone twisted pair, coaxial cable, or optical fiber. For a passive attack, the attacker merely needs to be able to observe transmissions.

Active attack which the attacked entity gets aware of when attacked. That is the interruption from the attacker is of such kind that he gets aware of the attack, hence called active attack. For example trying to steal some information. In Passive Attack when the attacked entity is unaware of the attack e.g. the attacker is just trying to listen or observer you.

The attack can be active when it attempts to alter system resources or affect their operation so it compromises Integrity or Availability. A passive attack attempts to learn or make use of information from the system but does not affect system resources: so it compromises Confidentiality

Passive attack on a communications system is one in which the attacker only eavesdrop that may read messages but he does not alter messages. This contrasts with an active attack in which the attacker may create, forge, alter, replace or reroute messages.

Passive attack is used in the context of cryptanalysis. However, the term is actually considerably broader than that. For example, wiretapping an unencrypted line is a passive attack. So is traffic analysis, attempting to infer useful information from the source, destination, timing and size of messages without reading the content. There are also situations where the attacker is active in some way such as probing an air defense system to obtain data on their radar systems or tricking an enemy into encrypting known text but the actual cryptanalysis is a passive attack.

A passive attack on a cryptosystem is one in which the cryptanalyst cannot interact with any of the parties involved, attempting to break the system solely based upon observed data . This can also include known plaintext attacks where both the plaintext and its corresponding ciphertext are known. Active attack intrusion into a computer network which attempts to delete or modify the data stored on the computers which form part of the network. This is one of the most serious forms of attack since many companies' operations critically depend on data.

There are three passive attacks that break any cipher except a one-time pad; variants of these work for either block ciphers or stream ciphers:

1. Brute force attack - try all possible keys

2.Algebraic attack - write the cipher as a system of equations and solve for the key

3.Code book attack - collect all possible plaintext/ciphertext pairs for a block cipher, or the entire pseudorandom stream until it starts repeating for a stream cipher

A meet-in-the-middle attack:-That is quite effective if it can be used, but it cannot be used against most ciphers. A birthday attack can be used whenever the issue is finding repeated output from some cryptographic technique . for example a challenge-response protocol repeating a challenge, or two inputs hashing to the same result.

Two passive attacks linear cryptanalysis and differential cryptanalysis - are very powerful. They are the only known attacks that break DES with less effort than brute force, and are the most powerful known general-purpose attacks against block ciphers. Variants of them have also been applied against stream ciphers and cryptographic hashes. Both, however, require large samples of material encrypted with a single key, so frequent re-keying is a defense.

The term attack relates to some other basic security terms .

+ - - - - - - - - - - - - + + - - - - + + - - - - - - - - - - -+

| An Attack: | |Counter- | | A System Resource: |

| i.e., A Threat Action | | measure | | Target of the Attack |

| +----------+ | | | | +-----------------+ |

| | Attacker |<==================||<========= | |

| | i.e., | Passive | | | | | Vulnerability | |

| | A Threat |<=================>||<========> | |

| | Agent | or Active | | | | +-------|||-------+ |

| +----------+ Attack | | | | VVV |

| | | | | Threat Consequences |

+ - - - - - - - - - - - - + + - - - - + + - - - - - - - - - - -+

In this resource, called an assest can have one or more vulnerabilities that can be exploited by a threat agent in a threat action. The result can potentially compromises the Confidentiality, Integrity or Availability properties of resources of the organization and others involved parties .The so called CIA triad is the basis of Information Security.

Q2. List and briefly define categories of security services?

Ans:-Security services are defined by x.800 as a service provided by a protocol layer of communicating open system , which ensures adequate security of the system or of data transfers.RFC2828,which define a processing or communication service that is provided by a system to give a specific kind of protection to system resources,security services implement security policies and are implemented by security mechanisms.

x.800 divides these services into five cate categories and fourteen services.

Authentication: -Authentication is the act of establishing or confirming something as authentic, that is, that claims made by or about the subject are true . It involve confirming the identity of a person, tracing the origins of an artifact, ensuring that a product is what its packaging and labeling claims to be. The assurance that the communicating entity is the one that it claims to be. The problem of authorization is often thought to be identical to that of authentication; many widely adopted standard security protocols, obligatory regulations, and even statutes are based on this assumption.More precise usage describes authentication as the process of verifying a claim made by a subject that it should be treated as acting on behalf of a given principal like person, computer, while authorization is the process of verifying that an authenticated subject has the authority to perform a certain operation.

Peer Entity Authentication:-That used in association with a logical connection to provide confidence in the identity of the entites connected.

Data Origin Authentication:-In this connectionless transfer , provide assurance that the source of received data is as claimed.

The public-key-based remote authentication over mechanisms that mimic authentication to the local environment is that sensitive authenticating information, such as a password, is never sent over the network. If server Alice holds a copy of client Bob's password or thumbprint, Bob must authenticate himself by proving that he knows or has this information; this is typically accomplished by Bob conveying this information to Alice upon sign-on .

Access control is a system which enables an authority to control access to areas and resources in a given physical facility or computer-based information system. An access control system, within the field of physical security is generally seen as the second layer in the security of a physical structure. In this the prevention of unauthorized use of a resource as this service controls who can have access to a resource, under what conditions access can occur and what those accessing the resource are allowed.

Data confidentiality In this Confidentiality is the assurance of data privacy. No one may read the data except for the specific entity intended. Confidentiality is a requirement

When data is stored on a medium that can be read by an unauthorized individual.

Data when is backed up onto a device that can fall into the hands of an unauthorized individual.

When data is transmitted over unprotected networks.

The protection of data from unauthorized disclosure.

Connection Confidentiality:- The protection of all user data on a connection.

onnectionless Confidentiality:-The protection of all user data in a single data block.

Selective Field Confidentially:-The confidentiality of selected field within user data on a connection or in a single data block.

Traffic Flow Confidentiality:- In this the protection of information that might be derived from observation of traffic flows.

Data integrity: Here assurance that data received are exactly as sent by an authorized entity . Data integrity is the assurance of non-alteration.The data has not been undetectably altered.To protect data against this sort of attack, cryptographic techniques are required. Thus, appropriate algorithms and keys must be employed and commonly understood between the entity wanting to provide data integrity and the entity wanting to be assured of data integrity.

Connections integrity with recovery:- That Provides for integrity of all user data on a connection and dectects any modification ,insertion ,deletion or replay of any data within an entire data sequence with recovery attempted.

Connections integrity without recovery:- That provides detection without recovery.

Selective Field Connection Integrity:- That provides integrity of selected fields within the user data block transferred oves a connection ad takes the form of determination of whether the selected fields modified , inserted,deleted or replayed.

Connection Integrity:-That provide integrity of single connectionless data block and take a form of detection of data modification .

Selective Field Connectionless Integrity:-That provide integrity of selected fields within a single connectionless data block.

Non-repudiation :-The term is often seen in a legal setting wherein the authenticity of a signature is being challenged. In such an instance the authenticity is being "repudiated". Provides protection against denial by one of the entities involved in a communication of having participated in all or part of the communication.

Nonrepudiation , Origin:-Proof that the message was sent by the specified party.

Nonrepudiation ,Destination:-The message received by specified party.

Q3. Is there any problem with the one-time pad cipher? Discuss the Problems.

Ans:- One-time pad was invented in 1917 . It derived from the Vernam cipher, named after Gilbert Vernam, one of its inventors. Vernam's system was a cipher that combined a message with a key read from a paper tape loop. Vernam's system was not unbreakable because the key could be reused. One-time use came a little later when Joseph Mauborgne recognized that if the key tape were totally random, cryptanalytic difficulty would be increased. The "pad" part of the name comes from early implementations where the key material was distributed as a pad of paper, so the top sheet could be easily torn off and destroyed after use.

One time pad is unbreakable.It produce random output that beas no statistical relationship to the plaintext.Because the ciphertext contains no information whatover about the plaintext,there is no way to break the code.In cryptography, the one-time pad is a type of encryption, which is impossible to crack if used correctly. Each bit or character from the plaintext is encrypted by a modular addition with a bit or character from a secret random key like pad .of the same length as the plaintext, resulting in a ciphertext. If the key is truly random, as large as or greater than the plaintext, never reused in whole or part, and kept secret, the ciphertext will be impossible to decrypt or break without knowing the key. It has also been proven that any cipher with the perfect secrecy property must use keys with effectively the same requirements as OTP keys. Practical problems have prevented one-time pads from being widely used.


Like as an Alice wishes to send the message "HELLO" to Bob. Take two pads of paper containing identical random sequences of letters were somehow previously produced and securely issued to both. Alice select the appropriate unused page from the pad. The way to do this is normally arranged for in advance, as for instance 'use the 12th sheet on 1 May', or 'use the next available sheet for the next message'. The material on the selected sheet is the key for this message. Each letter from the pad will be combined in a predetermined way with one letter of the message. It is common, but not required, to assign each letter a numerical value: e.g. "A" is 0, "B" is 1, and so on. In this example, the technique is to combine the key and the message using modular addition. The numerical values of corresponding message and key letters are added together, modulo 26. If key material begins with "XMCKL" and the message is "HELLO", then the coding would be done as follows:

H E L L O message

7 (H) 4 (E) 11 (L) 11 (L) 14 (O) message

+ 23 (X) 12 (M) 2 (C) 10 (K) 11 (L) key

= 30 16 13 21 25 message + key

= 4 (E) 16 (Q) 13 (N) 21 (V) 25 (Z) message + key (mod 26)

E Q N V Z → ciphertext

In this if a number is larger than 25, then the remainder after subtraction of 26 is taken in modular arithmetic fashion. This simply means that if your computations "go past" Z, you start again at A.

The ciphertext to be sent to Bob is thus "EQNVZ". Bob uses the matching key page and the same process, but in reverse, to obtain the plaintext. Here the key is subtracted from the ciphertext, again using modular arithmetic:

E Q N V Z ciphertext

4 (E) 16 (Q) 13 (N) 21 (V) 25 (Z) ciphertext

- 23 (X) 12 (M) 2 (C) 10 (K) 11 (L) key

= -19 4 11 11 14 ciphertext - key

= 7 (H) 4 (E) 11 (L) 11 (L) 14 (O) ciphertext - key (mod 26)

H E L L O → message

Similar to the above, if a number is negative then 26 is added to make the number positive.

Thus Bob recovers Alice's plaintext, the message "HELLO". Both Alice and Bob destroy the key sheet immediately after use, thus preventing reuse and an attack against the cipher. The KGB often issued its agents one-time pads printed on tiny sheets of "flash paper" paper chemically converted to nitrocellulose, which burns almost instantly and leaves no ash.

The one-time pad of espionage used actual pads of minuscule, easily-concealed paper, a sharp pencil, and some mental arithmetic. The method can be implemented now as a software program, using data files as input (plaintext), output (ciphertext) and key material . The XOR operation is often used to combine the plaintext and the key elements, and is especially attractive on computers since it is usually a native machine instruction and is therefore very fast. The key material is actually random, is used only once, never becomes known to the opposition, and is completely destroyed after use is hard to do.

Perfect secrecy

One-time pads are "information-theoretically secure" in that the encrypted message provides no information about the original message to a cryptanalyst . This is a very strong notion of security first developed during WWII by Claude Shannon .Claude Shannon proved, using information theory considerations, that the one-time pad has a property he termed perfect secrecy.


The one time pad offers complete security but it has some fundamental problems:

1.The practical problem of making large quantities of random keys. Any heavily used system might require millions of random characters on a regular basis. Random characters supplying in this volume is a significant task.

2.More daunting is the problem of key distribution and protection.For every message to be sent,a key of equal length is needed by both sender and receiver. Thus a mammoth key distribution problem exists.

3.It requires perfectly random one-time pads, which is a non-trivial software requirement

4.The Secure generation and exchange of the one-time pad material, which must be at least as long as the message. The security of the one-time pad is only as secure as the security of the one-time pad key-exchange.

5. Careful treatment to make sure that it continues to remain secret from any adversary, and is disposed of correctly preventing any reuse in whole or part - hence "one time".

One-time pads solve few current practical problems in cryptography. High quality ciphers are widely available and their security is not considered a major worry at present. Such ciphers are almost always easier to employ than one-time pads; the amount of key material which must be properly generated and securely distributed is far smaller, and public key cryptography overcomes this problem.


Q4. Define types of attacks based on what is known to the attacker.

Ans: Attack are defined below:-

Ciphertext only

Encryption algorithm


Known plaintext

Encryption algorithm


One or more plaintext -ciphertext pairs formed with the secret key

Chosen plaintext

Encryption algorithm


Plaintext message chosen by cryptanalyst,together with its corresponding decrypted plaintext generated with the secret key

Chosen text

Encryption algorithm


Plaintext message chosen by cryptanalyst,together with its corresponding ciphertext generated with the secret key

Ciphertext chosen by cryptanalyst,together with its corresponding decrypted plaintext generated with the secret key.


That attack relay on the nature of algorithm plus knowledge of general characteristics of plaintext or some sample plaintext pairs.This attack exploits the characteristics of algorithm to attempt to deduce a specific plaintext or to deduce the key being used.

Brute force attack

The attacker use every possible key on a piece of ciphertext until intelligible translation into plaintext is obtained .All possible keys must be tried to achieve success.

Q5. Write a Program to implement Play fair cipher?




         Int k=0;

          Void main();



          Char key[5][5];

          Char m[7];

           Char pt[100];

            Int I, j, n ;

Char A[]={'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'};

Cout<<"enter the key";


For(I = 0; I <= 5; i++)


For(j = 0; j <= 5; j++)


If (m[k]! = '\0')


Key[i][j] = m[k];





Cout<<"entered key is";

For(I = 0, I <= 5; i++)


For(j = 0; j <=5; j++)


Cout<< key[i][j];



For(n =0; n < 25; n++)


If (A[n] == m[k])






Key[i][j] = A[n];



For(I = 1; I < 5; i++)


For(j = 0; j < 5; j++)










Q6. Given the speed of a current ordinary computer (for home or light office use), estimate the amount of time necessary to crack a DES encryption by testing all 256 possible keys. Make a similar estimate for a 128-bit AES key?

Ans:-DES is a data encryption standard.The most widely used encrypytion scheme is based on Data Encryption Standard.For DES data are encrypted in 64 bit blocks using a 56 bit key.The algorithm transforms 64 bit input in series of stepsd into a 64 bit output . The same steps with the same key are used to reverse the encryption.There are practical limits to the key sizes which can be cracked by brute-force searching, but since NSA deliberately limited the key size of DES to 56 bits, back in the 1970's when it was designed, DES is crack able by brute force. Today's technology might not be able to crack other ciphers with 64-bit or 128-bit keys--or it might. Nobody will know until they have tried, and published the details for scientific scrutiny. Most such ciphers have very different internal structure than DES, and it may be possible to eliminate large numbers of possible keys by taking advantage of the structure of the cipher. keys should have a minimum of 75 bits, and to protect information for twenty years, a minimum of 90 bits.

We assume that the household computer has a 2GHZ processor. Also we assume

that a machine takes a hundred cycles per brute force against a single 56-bit DES key

or 128 bit AES key.

To crack a DES encryption, we need:

(2^56 key)*100 cycles/60sec/60min/24hour/365days/2000000000hz = 114.246566


To crack a AES encryption, we need:

(2^128 key)*100 cycles/60sec/60min/24hour/365days/2000000000hz = 5.39514154 Ã-

1023 years