


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















CLASS : III B.Sc. - CS & V - SEM S UBJ ECT: COMPUTER NETWORKS
UNIT – V
DOMAIN NAME SYSTEM This is primarily used for mapping host and e- mail destinations to IP addresses but can also be used other purposes. DNS is defined in RFCs 1034 and 1035. To map a name onto an IP address, an application program calls a library procedure called Resolver, passing it the name as a parameter. The resolver sends a UDP packet to a local DNS server, which then looks up the name and returns the IP address to the resolver, which then returns it to the caller. Armed with the IP address, the program can then establish a TCP connection with the destination, or send it UDP packets. 1.The DNS name space.
**2. Resource Records.
Figure 5-1. A portion of the Internet domain name space.
Insertions of a domain into the tree can be done in 2 days:-
Domain_name Time_to_live Class Type Value
Domain _name : Tells the domain to which this record applies. Time- to- live : Gives an identification of how stable the record is (High Stable = 86400 i.e. no. of seconds /day) ( High Volatile = 1 min) Type: Tells what kind of record this is. Class: It is IN for the internet information and codes for non internet information Value: This field can be a number a domain name or an ASCII string. The most important types are listed in Fig. 7-2.
Figure 7-2.. The principal DNS resource record types for IPv4.
3. NAME SERVERS: It contains the entire database and responds to all queries about it. DNS name space is divided up
into non-overlapping zones, in which each zone contains some part of the tree and also contains
name servers holding the authoritative information about that zone.
Figure 5-2. Part of the DNS name space showing the division into zones.
(e). Disposition: It concerns what the recipient dose with the message after receiving it. Possibilities include throwing it away before reading (or) after reading, saving it and so on. Most systems allow users to create mailboxes to store incoming e-mail. Commands are needed to
create and destroy mailboxes, inspect the contents of mailboxes, insert and delete messages from
mailboxes, and so on.
Figure 5-4: Envelopes and messages. (a) Paper mail. (b) Electronic mail.
(1) THE USER AGENT
A user agent is normally a program (sometimes called a mail reader) that accepts a variety of commands for composing, receiving, and replying to messages, as well as for manipulating mailboxes. SENDING E-MAIL To send an e-mail message, a user must provide the message, the destination address, and possibly some other parameters. The message can be produced with a free-standing text editor, a word processing program, or possibly with a specialized text editor built into the user agent. The destination address must be in a format that the user agent can deal with. Many user agents expect addresses of the form user@dns-address. READING E-MAIL When a user agent is started up, it looks at the user's mailbox for incoming e -mail before displaying
anything on the screen. Then it may announce the number of messages in the mailbox or display a
one-line summary of each one and wait for a command.
Messages consist of a primitive envelope (described in RFC 821), some number of header fields,
a blank line, and then the message body. Each header field (logically) consists of a single line of
ASCII text containing the field name, a colon, and, for most fields, a value.
Figure 5-5: RFC 822 header fields related to message transport
MIME — The Multipurpose Internet Mail Extensions
RFC 822 specified the headers but left the content entirely up to the users. Nowadays, on the worldwide Internet, this approach is no longer adequate. The problems include sending and receiving
message body and define encoding rules for non-ASCII messages. By not deviating from RFC
822, MIME messages can be sent using the existing mail programs and protocols. All that has to
be changed are the sending and receiving programs, which users can do for themselves.
Figure 5-6: RFC 822 headers added by MIME
POP3 begins when the user starts the mail reader. The mail reader calls up the ISP (unless there is already a connection) and establishes a TCP connection with the message transfer agent at port 110. Once the connection has been established, the POP3 protocol goes through three states in sequence:
IMAP ( Inte rnet Message Access Protocol ). POP3 normally downloads all stored messages at each contact, the result is that the user's e-mail quickly gets spread over multiple machines, more or less at random; some of them not even the user's. This disadvantage gave rise to an alternative final delivery protocol, IMAP ( Internet Message
Access Protocol ).
IMAP assumes that all the e-mail will remain on the server indefinitely in multiple
mailboxes. IMAP provides extensive mechanisms for reading messages or even parts of
messages, a feature useful when using a slow modem to read the text part of a multipart
message with large audio and video attachments.
CRYPTOGRAPHY: Cryptography is the study of secret(crypto)writing(graphy)
The art of science encompassing the principles and methods of transforming an intelligible message into one that is intelligible,and then retransforming that message back to its original form. Some of the encryption scheme are. PLAINTEXT :This is the original intelligible message. CIPHERTEXT :Transformed message. ENCRYPTION ALGORITHMS :The encryption algorithm performs various substitutions and transformations on the plaintext. SECRET KEY: Some critical information used by the cipher knows only to sender a nd receiver. ENCIPHER(ENCODE): The process of converting plaintext to ciphertext. DECIPHER(DECODE): The process of converting ciphertext back into plaintext. CRYPTOGRAPHY SYSTEMS ARE CHARACTERISED INTO THREE: 1)The type of operation used for transforming plaintext to ciphertext. Two general principles
TRANSPOSITION :In which elements in plaintext are rearranged. 2)The numbers of keys used. Both sender and receiver use same key as
Both sender and receiver use different key Asymmetric ,two key or public key encryption. 3)The way in which plaintext is processed. A Block cipher processes the input one block of elements at a time ,producing an output block for each input block.(ie.Encrypt one bit/character at a time)
Eg:THIS IS EASY KEY(3) WKLV LV HDVB.
A stream cipher processs the input elements continuosly,producing output one element at a time.(ie. Break plaintext message in equal size blocks and encrypt each block as a unit). Eg: THIS IS EASY THI ISI SEA SY….. KEY(135) UKN JWN……
The messages to be encrypted, known as the plaintext, are transformed by a function that is parameterized by a key.
The output of the encryption process, known as the ciphertext, is then transmitted, often by messenger or radio.
We assume that the enemy, or intruder, hears and accurately copies down the complete ciphertext.
Fig; The encryption model (for a symmetric-key ciphe r).
To write the message in rectangle row by row and read the message off,column by column but permute the order of column.
The order of column then becomes keyword AUTHOR and order the column by lexicographic order of the letters in the keyword.
One-Time pad: Introduction: First described by Frank Miller in 1882. The one-time pad was re- invented in 1917 and patented a couple of years later. It is 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 punched tape. In its original form, Vernam's system was vulnerable because the key tape was a loop, which was reused whenever the loop made a full cycle. One-time use came later, when Joseph Mauborgne recognized that if the key tape were totally random, then cryptanalysis would be impossible. An Army Signal Corp officer, Joseph Mauborgne, proposed an improvement using a random key that was truly as long as the message, with no repetitions, which thus totally obscures the original message. Since any plaintext can be mapped to any ciphertext given some key, there is simply no way to determine which plaintext corresponds to a specific instance of ciphertext.
Define: Each new message requires a new key of the same length as the new message. Such a scheme, known as a one-time pad. It is unbreakable. It produces a random output that bears no statistical relationship to the plaintext. Because the ciphertext contains no information whatsoever about the plaintext, there is simply no way to break the code.
Example: Suppose Alice wishes to send the message "HELLO" to Bob. Assume two pads of paper containing identical random sequences of letters were somehow previously produced and securely issued to both. Alice chooses 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:
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 the computations "go past" Z, the sequence starts 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:
Similar to the above, if a number is negative then 26 is added to make the number zero or higher. The Security of the one-time pas is entirely due to the randomness of the key. If the Stream of characters that constitute the key is truly random, then the stream of characters that constitute the ciphertext will be truly random. Thus, there are no patterns or regularities that a cryptanalyst can use to attack the ciphertext.
The one-time pad offers complete security but, in practice, has two fundamental difficulties:
Symmetric-Key Algorithms They used the same key for encryption and decryption. Transpositions and substitutions can be implemented with simple electrical circuits. Figure 8-6(a) shows a device, known as a P- box (P stands for permutation), used to effect a transposition on an 8-bit input. If the 8 bits are designated from top to bottom as 01234567, the output of this particular P-box is 36071245. By appropriate internal wiring, a P-box can be made to perform any transposition and do it at practically the speed of light since no computation is involved, just signal propagation. This design follows Kerckhoff's principle: the attacker knows that the general method is permuting the bits. What he does not know is which bit goes where, which is the key.
Figure 8-6. Basic elements of product ciphers. (a) P-box. (b) S-box. (c)Product.
Substitutions are performed by S-boxes , as shown in Fig. 8-6(b). In this example a 3-bit plaintext is entered and a 3-bit ciphertext is output. The 3-bit input selects one of the eight lines exiting from the first stage and sets it to 1; all the other lines are 0. The second stage is a P-box. The third stage encodes the selected input line in binary again. With the wiring shown, if the eight octal numbers 01234567 were input one after another, the output sequence would be
DES—The Data Encryption Standard An outline of DES is shown in Fig. 8-7(a). Plaintext is encrypted in blocks of 64 bits, yielding 64 bits of ciphertext. The algorithm, which is parame terized by a 56-bit key, has 19 distinct stages. The first stage is a key- independent transposition on the 64-bit plaintext. The last stage is the exact inverse of this transposition. The stage prior to the last one exchanges the leftmost 32 bits with the rightmost 32 bits. The remaining 16 stages are functionally identical but
are parameterized by different functions of the key. The algorithm has been designed to allow decryption to be done with the same key as encryption, a property needed in any symmetric-key algorithm. The steps are just run in the reverse order.
Figure 8-7. The data encryption standard. (a) General outline. (b) Detail of one iteration. The circled + means exclusive OR
The operation of one of these intermediate stages is illustrated in Fig. 8-7(b). Each stage takes two 32-bit inputs and produces two 32-bit outputs. The left output is simply a copy of the right input. The right output is the bitwise XOR of the left input and a function of the right input and the key for this stage, Ki. All the complexity lies in this function. The function consists of four steps, carried out in sequence. First, a 48-bit number, E , is constructed by expanding the 32-bit Ri - 1 according to a fixed transposition and duplication rule. Second, E and Ki are XORed together. This output is then partitioned into eight groups of 6 bits each, each of which is fed into a different S-box. Each of the 64 possible inputs to an Sbox is mapped onto a 4-bit output. Finally, these 8 x 4 bits are passed through a P-box. In each of the 16 iterations, a different key is used. Before the algorithm starts, a 56-bit transposition is applied to the key. Just before each iteration, the key is partitioned into two 28- bit units, each of which is rotated left by a number of bits dependent on the iteration number. Ki is derived from this rotated key by applying yet another 56-bit transposition to it. A different 48- bit subset of the 56 bits is extracted and permuted on each round.
Triple DES
Using triple encryption (Tuchman, 1979). The method chosen, which has since been incorporated in International Standard 8732, is illustrated in Fig. 8-8. Here two keys and three stages are used. In the first stage, the plaintext is encrypted using DES in the usual way with K 1.
Like DES, Rijndael uses substitution and permutations, and it also uses multiple rounds. The number of rounds depends on the key size and block size, being 10 for 128-bit keys with 128- bit blocks and moving up to 14 for the largest key or the largest block. However, unlike DES, all operations involve entire bytes, to allow for efficient implementations in both hardware and software. An outline of the code is given in Fig. 8-9. The function rijndael has three parameters. They are: plaintext , an array of 16 bytes containing the input data, ciphertext , an array of 16 bytes where the enciphered output will be returned, and key , the 16-byte key. This initial setup of the 12 byte arrays of size 4 x 4 is illustrated in Fig. 8-10.
Figure 8-10. Creating of the state and rk arrays.
There is one more step before the main computation begins: rk [0] is XORed into state byte for byte. In other words each of the 16 bytes in state is replaced by the XOR of itself and the corresponding byte in rk [0]. Now it is time for the main attraction. The loop executes 10 iterations, one per round, transforming state on each iteration. The contents of each round consist of four steps. Step 1 does a byte- for-byte substitution on state. Each byte in turn is used as an index into an S-box to replace its value by the contents of that S-box entry. This step is a straight monoalphabetic substitution cipher. Unlike DES, which has multiple S-boxes, Rijndael has only one S-box. Step 2 rotates each of the four rows to the left. Row 0 is rotated 0 bytes (i.e., not changed), row 1 is rotated 1 byte, row 2 is rotated 2 bytes, and row 3 is rotated 3 bytes. This step diffuses the contents of the current data around the block, analogous to the permutations of Fig. 8-6. Step 3 mixes up each column independently of the other ones. The mixing is done using matrix multiplication in which the new column is the product of the old column and a constant matrix, with the multiplication done using the finite Galois field, GF (28). Although this may sound complicated, an algorithm exists that allows each element of the new column to be computed using two table lookups and three XORs (Daemen and Rijmen, 2002, Appendix E). Finally, step 4 XORs the key for this round into the state array.
Cipher Modes Electronic Code Book Mode This mode is a most straightforward way of processing a series of sequentially listed message blocks. Ope ration
The user takes the first block of plaintext and encrypts it with the key to produce the first block of ciphertext. He then takes the second block of plaintext and follows the same process with same key and so on so forth. The ECB mode is deterministic , that is, if plaintext block P1, P2,…, Pm are encrypted twice under the same key, the output ciphertext blocks will be the same. In fact, for a given key technically we can create a codebook of ciphertexts for all possible plaintext blocks. Encryption would then entail only looking up for required plaintext and select the corresponding ciphertext. Thus, the operation is analogous to the assignment of code words in a codebook, and hence gets an official name − Electronic Codebook mode of operation (ECB). It is illustrated as follows −
Analysis of ECB Mode
In reality, any application data usually have partial information which can be guessed. For example, the range of salary can be guessed. A ciphertext from ECB can allow an attacker to guess the plaintext by trial-and-error if the plaintext message is within predictable.
For example, if a ciphertext from the ECB mode is known to encrypt a salary figure, then a small number of trials will allow an attacker to recover the figure. In gene ral, we do not wish to use a deterministic cipher, and hence the ECB mode should not be used in most applications.
Cipher Block Chaining (CBC) Mode
CBC mode of operation provides message dependence for generating ciphertext and makes the system non-deterministic.
Ope ration
The operation of CBC mode is depicted in the following illustration. The steps are as follows −
Load the n-bit Initialization Vector (IV) in the top register.
XOR the n-bit plaintext block with data value in top register.
Encrypt the result of XOR operation with underlying block cipher with key K.
Feed ciphertext block into top register and continue the operation till all plaintext blocks are processed.
Take only „s‟ number of most significant bits (left bits) of output of encryption process and XOR them with „s‟ bit plaintext message block to generate ciphertext block.
Feed ciphertext block into top register by shifting already present data to the left and continue the operation till all plaintext blocks are processed.
Essentially, the previous ciphertext block is encrypted with the key, and then the result is XORed to the current plaintext block.
Similar steps are followed for decryption. Pre-decided IV is initially loaded at the start of decryption.
Analysis of CFB Mode
CFB mode differs significantly from ECB mode, the ciphertext corresponding to a given plaintext block depends not just on that plaintext block and the key, but also on the previous ciphertext block. In other words, the ciphertext block is dependent of message.
CFB has a very strange feature. In this mode, user decrypts the ciphertext using only the encryption process of the block cipher. The decryption algorithm of the underlying block cipher is never used.
Apparently, CFB mode is converting a block cipher into a type of stream cipher. The encryption algorithm is used as a key-stream generator to produce key-stream that is placed in the bottom register. This key stream is then XORed with the plaintext as in case of stream cipher.
By converting a block cipher into a stream cipher, CFB mode provides some of the advantageous properties of a stream cipher while retaining the advantageous properties of a block cipher.
On the flip side, the error of transmission gets propagated due to changing of blocks.
Stream Cipher Mode For these applications, a fourth option, stream cipher mode , exists. It works by encrypting an initialization vector, using a key to get an output block. The output block is then encrypted, using the key to get a second output block. This block is then encrypted to get a third block, and so on. The (arbitrarily large) sequence of output blocks, called the keystream , is treated like a one-time pad and XORed with the plaintext to get the ciphertext, as shown in Fig. 8-14(a). Note that the IV is used only on the first step. After that, the output is encrypted. Also note that the keystream is independent of the data, so it can be computed in advance, if need be, and is completely insensitive to transmission errors. Decryption is shown in Fig. 8-14(b).
Figure 8-14. A stream cipher. (a) Encryption. (b) Decryption.
Counter Mode
It can be considered as a counter-based version of CFB mode without the feedback. In this mode, both the sender and receiver need to access to a reliable counter, which computes a new shared value each time a ciphertext block is exchanged. This shared counter is not necessarily a secret value, but challenge is that both sides must keep the counter synchronized.
Ope ration
Both encryption and decryption in CTR mode are depicted in the following illustration. Steps in operation are −
Load the initial counter value in the top register is the same for both the sender and the receiver. It plays the same role as the IV in CFB (and CBC) mode.
Encrypt the contents of the counter with the key and place the result in the bottom register.
Take the first plaintext block P1 and XOR this to the contents of the bottom register. The result of this is C1. Send C1 to the receiver and update the counter. The counter update replaces the ciphertext feedback in CFB mode.
Continue in this manner until the last plaintext block has bee n encrypted.