EC8551 CN Unit 5 Notes
EC8551 CN Unit 5 Notes
EC8551 CN Unit 5 Notes
SMTP
UA H Sender
Body
SMTP
Receiver Mail Box
SMTP Commands: SMTP operations are executed using a series of commands and responses exchanged between
SMTP server and receiver. Each command consists of a single line text – beginning with 4 letter command code followed
by argument
Command Description
HELO<space><domain><CRLF> send identification
MAIL<sp> FROM <rev.path><CRLF> Originator identity
RCPT<sp> TO <forward path><CRLF> receiver’s identity
NOOP <CRLF> No operation
DATA <CRLF> Transfer message
SMTP Replies: Each reply begins with 3 digit code followed by additional information
Categories:
a) Positive Completion Reply Requested action has been successfully completed
211 System status
214 Help
251 User not local
b) Positive Intermediate Reply Command is accepted but action is held
354 Start mail input
c) Transient Negative Completion Reply The command was accepted and requested action did not occur
421 Service not available
450 Requested mail action not taken
451 Requested action aborted
d) Permanent Negative Completion Reply The Command was not accepted and requested action did not occur
500 Syntax error – command unrecognized
501 Syntax error – in parameters
502 Command not implemented
503 Bad sequence of command
com
gov edu jp
org net in
mil uk
yahoo rediff
purdue oxford
cse mca
prakash prakash.mca.purdue.edu
Search for a computer name under domain prakash, which is a domain mca which is under a domain purdue, which is
finally under edu. Each domain level is separated by a dot.
How a node locate root server?
In practice not all clients know about the root servers. Each client program running on each internet host is
initialized with the address of local name server. The local name server in turn has resource records for one or
more of root servers.
Resource Record (RR) is the basic data element in the domain name system. Each record has a type (A, MX,
etc.), an expiration time limit, a class, and some type-specific data. Resource records of the same type define a
resource record set. The order of resource records in a set, returned by a resolver to an application, is undefined,
but often servers implement round-robin ordering to achieve load balancing.
The World Wide Web or the web is a repository of information spread all over the world and linked together. The WWW
has a unique combination of flexibility, portability and user- friendly features that distinguish it from other services
provided by the Internet. The WWW Project was initiated by CERN to create the system to handle distributed resources
necessary for scientific research. The WWW today is distributed client services in which a client using a browser can
access a service using a server. However, the service provided is distributed over many locations called web sites.
Internet
3. Web browser
interprets the page
and displays its indexfile
contents on screen filwe
http://www.yahoo.com/index
URL signifies the full, unique path of any file on the Internet.
Some
HTTP Interpreter
Client ( 2 ) (4)
Static documents are fixed content documents that are created and stored in a server. The client can get only a copy of the
document. Although the contents in the server can be changed the user cannot change it. When a client accesses the
document, a copy of the document is sent, the user can then use a browsing program to display the document.
HTML HyperText Markup Language is language for creating a web page.
Structure of a Web page: A Web page is made up of two parts, the head and the body.
Head : It is the first part of the web page. It contains the title of the page and other parameters that the browser
will use.
Body: The actual contents of a page are in the body, which includes the text and the tags. Whereas the text is the
actual information contained in the page, the tags determine the appearance of the documents. Every HTML tags
is a name followed by an option list of attributes all enclosed between less than and greater than brackets ( < and
> ).
An attribute, if present , is followed by an equal sign and the value of the attribute. Some tags can be used alone;
some must be used in pairs. Those that are used in pairs are called starting and ending tags. The starting tag can
have attributes and values. The ending tag cannot have attributes or values but must have a slash (/) before the
name.
Tags The browser makes a decision about the structure of the text based on the tags, which are marks that are
embedded into the text. A tag is enclosed in two brackets and usually come in pairs. The begining tag starts with
the name of the tag and the ending tag starts with the slash followed by the name of the tag.
DYNAMIC DOCUMENTS
Client Server
Running the program and producing the
document
Client Document Server
Dynamic documents do not exist in a predefined format. Instead a dynamic document is created by a web server whenever
a browser requests a document. When a request arrives the web server runs an application program that creates the
dynamic documents. The server returns the output of the program as a response to browser that requested the document.
Because of fresh document is created for each request the contents of a dynamic document can vary from one request to
another. Avery simple example of a dynamic document is getting the time and date from the server.
A server that handles dynamic documents follows these steps.
1. The server examines the URL to find if it defines a dynamic document.
2. If the URL defines a dynamic document, the server executes the program
3. the server sends the output of the program to the client.
COMMON GATEWAY INTERFACE (CGI)
Common gateway Interface (CGI) is a technology that creates and handles dynamic documents. CGI is a set of
standards that defines how a dynamic document should be written how input data should be supplied to the
program, and how the output result should be used.
CGI is not a new language ; instead, it allows programmers to use any of several languages such as C, C++,
Bourne Shell, Korn Shell, Tcl, or Perl. The only thing that CGI defines is a set of rules and terms that the
programmer should follow.
The user of common in CGI indicates that the standard defines a set of rules that are common to any language or
platform. The term gateway here means that a CGI program is a gateway that can be used to access other
resources such as databases, graphic packages, and so on. The term interface here means that there is a set of
predefined terms variables calls and so on that can be used in any CGI program.CGI Program A CGI Program in
its simplest form is code written in one of the languages supporting the CGI. Any programmer that can encode a
sequence of thoughts in a program and knows the syntax of one of the above mentioned languages can write a
simple CGI program.
ACTIVE DOCUMENTS
For many applications we need a program to be run at the client site. These are called active documents. An active
document in the server is stored in the form of binary code. However, it does not create overhead for the server in the
same way that a dynamic document does. Although an active document is not run on the server, it is stored as a binary
document that is retrieved by a client. When a Client receives the document it can also store it in its own storage area. In
this way, the client can run the document again without making another request, an active document is transported from
the server to the client in binary form this means that it can be compressed at the server site and decompressed at the client
site, saving both bandwidth and transmission time.
JAVA is a combination of high level programming language, a run time environment, and a class library that allows a
programmer to write an active document and a browser to run it. It can also be used as a stand alone program without
using a browser. However Java is mostly used to create an applet ( a small application program ).
Network security
Network security is to protect data while transmitting.
Security Attack – Any action that compromises the security of information owned by an organization.
Security Mechanism – A Mechanism that detects, prevents or recover from security attack
Security Service – The service that enhances security of information transmitted.
Classification of security services
Confidentiality : Information can be accessible only for reading by authorized parties.
Authentication : Origin of message is identified with identity is not false
Integrity : Only authorized parties are able to modify transformation
Non repudiation : Neither sender nor receiver deny the transmission
Access Control : Access to info is controlled by target system
Availability : Info is available to authorized parties
General Categories of Attack
Interruption
Modification : An unauthorized party gains access and changes it. – attack on integrity
Conventional Encryption : It provides confidentiality for transmitted data. It is also known as symmetric encryption /
single key encryption.
Plaintext – original message that is the input to algorithm
Encryption algorithm – It does various substitutions and transformations on plaintext
Secret key – It is the key used for encryption by sender and for decryption by receiver.
Ciphertext – It is the scrambled message produced as o/p
Decryption algorithm – It converts ciphertext to original messages
P E C D P
key key
Block Cipher Mode: It process block of plaintext and produces a block of cipher text.
Stream cipher Mode: It process plaintext character by character and produces a character o/p.
DES : Data Encryption std.. DES is the block cipher algorithm that takes a fixed-length string of plaintext bits and
transforms it through a series of complicated operations into another cipher text string of the same length. In the case of
DES, the block size is 64 bits. DES also uses a key to customize the transformation, so that decryption can supposedly
only be performed by those who know the particular key used to encrypt. The key consists of 64 bits; however, only 56 of
these are actually used by the algorithm.
Algorithm : 64 bit plain text passes through initial permutation. It is followed by 16 rounds. Then a swap is done.
Preoutput is passed through IP.
Each Round:
F function consists of :
1. Expansion — the 32-bit half-block is expanded to 48 bits using the expansion permutation, denoted E in the diagram,
by duplicating half of the bits.
2. Key mixing — the result is combined with a subkey using an XOR operation. Sixteen 48-bit subkeys — one for each
round — are derived from the main key using the key schedule (described below).
3. Substitution — after mixing in the subkey, the block is divided into eight 6-bit pieces before processing by the S-boxes,
or substitution boxes. Each of the eight S-boxes replaces its six input bits with four output bits according to a non-linear
transformation, provided in the form of a lookup table. The S-boxes provide the core of the security of DES — without
them, the cipher would be linear, and trivially breakable.
4. Permutation — finally, the 32 outputs from the S-boxes is rearranged according to a fixed permutation, the P-box. This
is designed so that, after expansion, each S-box's output bits are spread across 6 different S boxes in the next round.
Decryption of DES is essentially same as encryption processand Use keys in Reverse order
Triple DES: K1 K2 K1
P E D E C
Triple DES uses a "key bundle" which comprises three DES keys, K1, K2 and K3, each of 56 bits
The encryption algorithm is: ciphertext = EK3(DK2(EK1(plaintext)))
DES encrypt with K1, DES decrypt with K2, then DES encrypt with K3.
Decryption is the reverse: plaintext = DK1(EK2(DK3(ciphertext)))
I.e., decrypt with K3, encrypt with K2, then decrypt with K1.
Each triple encryption encrypts one block of 64 bits of data.In each case the middle operation is the reverse of the first and
last. This improves the strength of the algorithm when using keying option 2, and provides backward compatibility with
DES with keying option 3.
Keying options
The standards define three keying options:
Keying option 1: All three keys are independent.
Keying option 2: K1 and K2 are independent, and K3 = K1.
Keying option 3: All three keys are identical, i.e. K1 = K2 = K3.
Keying option 1 is the strongest, with 3 × 56 = 168 independent key bits.
Keying option 2 provides less security, with 2 × 56 = 112 key bits. This option is stronger than simply DES encrypting
twice, e.g. with K1 and K2, because it protects against meet-in-the-middle attacks.
Keying option 3 is equivalent to DES, with only 56 key bits. This option provides backward compatibility with DES,
because the first and second DES operations cancel out
Key Distribution :
Permanent Key : It is a key used between source & Destination for distributing session keys.
Session Key : For a logical connection, one time session key is used. Using session key all user data are encrypted in one
connection
M MAC
M
11
K compare MAC
MAC
MAC
alg MAC(M)
One way Hash function :
It is a slight variation of MAC. A Hash function accepts a variable – size message M as input and
produces a fixed size message digest H(M). It can be done using conventional encryption / public key
encryption.
M 11 M
H
E(H(M)) Compare
D
H(M) E
Hash function is applied to a block of data of any size and produces a fixed length output.
It is easy to compute H(x) for given x.
It is computationally infeasible to find x show that h = H(x) for given h.
For a given block x, it is computationally infeasible to find y != x with H(y) = H(x)
Public Key Encryption - Asymmetrical Key Encryption
All public key encryption needs
2 separate keys – 1 for encryption and 1 for decryption.
2 separate algorithm – different for encryption and decryption
The private key consists of {d, n} and the public key consists of {e, n}. Suppose that user A has published
its public key and that user B wishes to send the message M to A. Then B calculates cipher text and
transmits C. On receipt of this cipher text, user A decrypts by calculating M = Cd mod n.
Example
Select primes: p=17 & q=11 Compute n = pq =17×11=187
Compute ø(n)=(p–1)(q-1)=16×10=160 Select e : gcd(e,160)=1; choose e=7
Determine d: de=1 mod 160 and d < 160 Value is d=23 since 23×7=161= 10×160+1 Publish public key
KU={7,187} Keep
secret private key KR={23,17,11}
RSA encryption/decryption is:
given message M = 88 (nb. 88<187)
encryption: C = 887 mod 187 = 11
decryption: M = 1123 mod 187 = 88
Security of RSA
Brute force: This involves trying all possible private keys.
Mathematical attacks: There are several approaches, all equivalent in effort to factoring the product of two
primes.
● Timing attacks: These depend on the running time of the decryption algorithm.
● Chosen cipher text attacks: This type of attack exploits properties of the RSA
algorithm.
PUBLIC KEY