Study Material Unit :V Semester : VI Class : III BSc (A, B & C) Staff : R.Balakrishnan The Presentation Layer: Presentation layer is the 6th layer in the OSI reference model. Presentation layer is concerned with preserving the meaning of the information transported. Each computer has its own way of representing data internally like ASCII or EBCDIC. It is the job of presentation layer to encode structured data from the internal format used on the sending machine to a bit stream suitable for transmission and then to decode it to the required representation at the destination. Design Issues of the presentation layer: The presentation layer has four primary functions. 1. Giving users a way to execute the session service primitives 2. Providing a way to specify complex data structures 3. Managing set of data structures currently required 4. Converting data between internal and external form Data Representation: Different computers have different internal representation for data. All IBM mainframes use EBCDIC as the character code whereas all PC use ASCII. When these two incompatible system exchanges data then complexity will arise. It is up to the presentation layer to represent data in structured way such that smooth exchange of information takes place between incompatible systems Data Compression: Data compression refers to the technique of reducing the number of bits required to represent and transmit the information thru network without changing the original meaning. There are different types of compression techniques used. One is encoding a finite set of equally likely symbols. Another one is replacing frequently occurring information with equivalent code. Cryptography: The art of devising ciphers and breaking them is collectively called as cryptography. Intruder Plain Tex t P Encryption method Encryption key k Decryption method Plain Text Cipher text C=Ek(p) Decryption key 1 The message to be encrypted is known as plain text is transformed by a function that is parameterized by a key. The output of the encryption process known as the cipher text or cryptogram is then transmitted. Intruder refers to the unauthorized person accessing information flowing thru the network without the permission. There are two kinds of intruder. Passive Intruder is an intruder who can read information that is passing thru the network. Active Intruder is an intruder who can read and can alter the message that is passing thru the network. Encryption methods is divided into two categories 1. Substitution ciphers 2. Transposition ciphers Substitution ciphers: In substitution cipher each letter or group of letter is replaced by another letter In Caesar substitution cipher a becomes D, b becomes E, etc. and the key is 3. For example attack becomes DWWDFN. The next type of substitution cipher is that each alphabet is mapped into some other alphabet. This system is called as Mono Alphabetic substitution. The next method is Digrams in which common and frequently occurring two letter alphabets like th,in are replaced by another alphabet. Similarly three letter combinations like the, ing are replaced by another symbols and called as Trigrams. Codes: If the units encrypted become longer and longer the cipher begins to resemble a Code. The main difference between the cipher and code is that the former encrypts a fixed size unit of plaintext where as code encrypts a single variable-length linguistic unit. Encoding a coded message is called super encipherment. Transposition cipher: Transposition ciphers reorder the letters present in a plain text. The cipher is keyed by a word or phrase not containing any repeated letters. For example MEGABUCK is the key. The purpose of the key is to number the columns. The plaintext is written horizontally in rows. The cipher text is read out by columns starting with the column whose key is the lowest. The Data Encryption Standard (DES): Transposition and substitution ciphers can be implemented with simple circuits. The P box stands for permutation used to effect a transposition on an 8 bit input. If the 8bit input are designated from top to bottom as 01234567 the output of the P box is 36071245. The Substitutions are performed by S boxes. The 3-bit input is given and the output is a 3-bit cipher text. The 3-bit input selects one of the eight lines exiting from the first stage and sets it to 1 and all other lines are 0. The second stage is a P box. The third stage encodes the selected input line in binary. Both P and S box can be combined to have a effective encryption and the whole process can be called as Product Cipher. 2 Product Cipher Combination of P and S box. P stands for P box and S stands for S box. P1 S1 S5 S2 P2 S9 S6 P3 S10 S3 S7 S11 S4 S8 S12 P4 A Standard encryption was developed called Data Encryption Standard (DES). Plaintext is encrypted in blocks of 64 bits yielding 64 bits cipher text. The algorithm, which is parameterized by a 56-bit key, has 19 distinct stages. The first stage is a key independent transposition on the 64 bit key 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 functionally identical but are parameterized by different functions of the key. The algorithm will allow decryption 64 bit plain text Initial transposition 56 bit key Iteration 1 Iteration 16 32 bit swap Inverse transposition 64 bit cipher text The data encryption standard Stream Encryption: Effective encryption can be achieved through stream cipher instead of block cipher. When stream cipher is used both sender and receiver operate their the DES chips in encryption mode. Each DES chip has 64 bit input register, which operates as a shift 3 register and a 64 bit output register. When a plain text arrives it is EX – ORed with 8 bits of output register O1.The character thus created is both transmitted to the receiver and shifted into the input register pushing I8 off the end. The chip is activated and the output is computed for the new input. At the receiving end the incoming character is first EX –ORed with O1 and then shifted into I1.Since the incoming plain text character at the transmitter is being EX-Ored with the same character as the incoming cipher text character at the receiver, the output at the receiver is the plaintext. Public key cryptography: Key distribution is one important problem to be solved. Both the receiver and the transmitter should know the key to decrypt the message. Identical key pair is generated and should be distributed to both transmitter and receiver but distribution of key thru network or thru personal courier is a vulnerable one. Public key cryptography solves this key distribution problem. The encryption algorithm in which the key is made public is called Public key Cryptography. There are three requirements 1. D(E(P))=P 2. It is difficult to deduce D from E 3. E cannot be broken by a chosen plain text attack. Digital signatures with public key cryptography: In this A and B can have its own private key and still can use public key cryptography. A can send a plaintext message with its own secret decryption key Da as well as the public key B. When B receives the message it transforms it using its private key and then decrypts it using Ea i.e. the public key to get the original plain text. The MIT algorithm: Due to the advantages of public key cryptography many algorithms are developed based on it. One method is MIT algorithm. It is based on some principles from number theory. Algorithm: 1. Choose two large primes, p and q each greater than 10 power 100. 2. Compute n=p*q and z=(p-1)*(q-1) 3. Choose a number relatively prime to z and call it d 4. Find e such that e*d=1 mod z Divide the plain text into blocks, so that plaintext message p falls in the interval 0<=P<n. This can be done by grouping the plaintext into blocks of k bits where k is the largest integer for which 2 k<n is true. To encrypt a message P, compute C=Pe(mod n). To decrypt a message compute P=cd(mod n). Application Layer It is the top most layer in the OSI reference model. It holds the user programs that do the actual work. These programs make use of services offered by the presentation layer. Design Issues : The important design issues are 1. File Transfer, access and Management 2. E Mail 4 3. Virtual terminals File Transfer, Access and Management: File handling is the principal services in any network and important design issue of application layer. File Server: A file server can be characterized by three properties 1.File Structure 2.File attributes and 3.File Operations File Structure: Every file server has differrent file models. Three models are widely used. a) Unstructured: In this model file is an unstructured lump of data without any substructure known to the file server. File server cannot perform multiple operations on this kind of file. Only read and write operations can be performed. b) Flat File: It consists of ordered sequence of records and the records need not all be of the same size. c) Hierarchical file: Takes the shape of a tree. Each node of the tree may have label, data or both. File Attributes: All files have attributes that describe them. File Name, Date and time of creation last modified owner, file availability are some of the file attributes. File Operations: Various operations can be performed on a file. Creation deletion, selection, open close, read, insert, replace, extend are the different types of operations that can be performed on a file. Concurrency Control: Network file servers have multiple clients. If more than one client access a same file then problems will occur. One widely implemented solution to this problem is to permit clients to lock files before using the files. Two types of locks are there. 1. Shared Lock: Shared locks are typically used for reading. When a client just wants to read a file-shared lock can be applied which will not create too much problem. 2. Exclusive Lock: If exclusive lock is used no other client can access the file till it is unlocked. Some file servers support a concept called transactions. Transaction is nothing but an atomic actions in the context of file servers. Client can initiate a transaction followed by any number of open and file operations and finished by a command to end the transaction. It is upto the server to carry out all the requests in an atomic way without the interference from other client requests. At any time transaction can be aborted and file can be restored to its original state. Replicated Files: 5 Network can also have multiple file servers 1. To split the workload over multiple servers 2.To allow access to occur even if one file servers is down and 3. To increase reliability by having independent backups of each file. Problem: If the multiple copies of file in different file servers are not modified no problem will arise. Lot of complexity will arise if one copy of file is updated by the client in one file server such that any other client accessing the same copy of the file will get old copy and not the updated one. Solutions: Primary Copy Replication: The simplest solution is primary copy replication. One copy is considered as a master file and all others as slaves. If a client modifies a file updates are made to the master and propagates to all the slaves. So client irrespective of different file server will get the updated copy Voting: Another solution is voting. To read a file client must obtain a read quorum i.e. it has to get permission from all other file servers. To modify a file client has to get a write quorum. Since all file servers know about the operation and its status since it was the one which is giving the permission updates can be made easily. If any file server is down then a dummy file server is created whose main task is to give permission to clients and it is called voting with ghosts. Implementation Issues: 1. Simple File Server: The file server handles one request at a time. While it is busy with the current request all new requests are simply queued until the server completes the current job. So a file server can the viewed as simple loop Begin GetMessage(buffer); DoWork(buffer,result); SendReply(result); End The main problem is because of the clients invalid request server can be forced to enter an indefinite loop. 2. Multithreaded Server: In this type of server file server is split into several tasks that share a common address space. Each task is a separate thread of control with its own program counter and stack. When a request message form client comes the kernel accepts it and passes to the dispatcher task. The dispatcher task then inspects it and hands it off to an idle worker task. Each task handles a single request to completion. If a task blocks or goes into indefinite loop till other task can work well since each having its own stack and program counter. Various methods can be followed to improve the performance of the file server. One is to have the server maintain a buffer cache in memory. The buffer contains most recently and frequently accessed files. When client request a specific file it can access it from buffer if it was there instead of doing lengthy disk access. Another method is that client system to have the buffer but frequent updation has to be done to maintain integrity. E-Mail: 6 Architecture and services of MOTIS and X.400 E Mail systems: There are 6 aspects of email 1. Composition: Refers to the process of creating messages and answers. Any text editor can be used. 2. Transfer: Refers to the process of moving messages from the originator to the recipient 3. Reporting: Refers to the process of report on the successful delivery of the email message 4. Conversion: Refers to the process of converting the message suitable for display on the recipient’s terminal. 5. Formatting: Refers to the process of formatting the data that is displayed on the recipient’s terminal 6. Disposition: Concerned with what the recipient does with the message after receiving it Many other mail systems allow different features like mailboxes probes etc. General model of E-mail system: The user agent is a program that provides the interface to the mail system. It allows user to compose, send and receive and manipulate messages. The message transfer agent accepts mail from user agents and sees to it that the mail is transferred thru the network. Some computers may have limited storage capabilities and the user may not be logged in when message arrives. To sort out this type of the problem MTA contains a message store, which is used to store the mail messages temporarily. THE USER AGENT: The UA has three different kinds of interactions with the user. They are 1. It manages the dialog with the user at the terminal. 2. It talks to the MTA about accepting and delivering messages 3. It deals with the message server The UA is typically invoked by calling a program that accepts variety of commands that relate to composing, sending and receiving mails. For example the command s-> Stands for sending a message, f-> For forwarding a message and d-> Stands for deleting a message. The UA’s use a common protocol while exchanging mail. The protocol defines some standard headers, which each UA must adhere. Subject is one of the headers the UA will have. Similarly some common headers are used by UA, which ultimately helps UA to transfer mail in a effective way. THE MESSAGE TRANSFER AGENT: The MTA is concerned with relaying the message from the originator to the recipient. If the message is form UA the MTA will check the syntax for its validity. The next step is to see if the recipients UA is local. If so message is delivered. If not message is forwarded to another neighboring MTA and so on till it reaches the recipient UA. The important aspect of the MTA is the envelope which contains come important information like originator address , recipient address, priority etc. 7