CN (U5) 1
CN (U5) 1
UNIT-V
Application Layer – DNS – Name space – Resource records – name servers – e-mail -
Architecture and Services - The User Agent - Message Formats - Message Transfer - Final
Delivery – WWW – Architecture - Static Web Pages - Dynamic Web Pages and Web
Applications - HTTP– Network Security - Introduction to Cryptography - Substitution
Ciphers - Transposition Ciphers – Public key algorithms – RSA – Authentication Protocols -
Authentication Using Kerberos.
3. Define E-Mail?
Electronic mail, most commonly referred to as email or e-mail since c 1993, is a
method of exchanging digital messages from an author to one or more recipients.
Modern email operates across the Internet or other computer networks.
Short for electronic mail, email (or e-mail) is defined as the transmission of
messages over communications networks. Typically the messages are notes entered
from the keyboard or electronic files stored on disk. Most mainframes,
minicomputers, and computer networks have an email system.
Plain text This is a format that all email applications support. Plain text messages
don't support bold, italic, colored fonts, or other text formatting. .
Outlook Rich Text format (RTF) This is a Microsoft format that only the following
email applications support
19. Who are the people who cause security problem?(April/May 2012)
Outside people and hackers
The people who work for your company
The applications that your users use to perform their business tasks
The operating systems that run on your users' desktops and your servers, as well as
the equipment employed
The network infrastructure used to move data across your network, including
devices such as routers, switches, hubs, firewalls, gateways, and other devices
Many millions of PCs were connected to the Internet, everyone involved with it realized
that this approach could not continue to work forever. To solve these problems, DNS
(Domain Name System) was invented in 1983. It is primarily used for mapping host
names to IP addresses but can also be used for other purposes. DNS is defined in RFCs
1034, 1035, 2181, and further elaborated in many others.
• Name servers
– A domain name is separated into two or more sections that specify the
organization, and possibly a subset of an organization, of which the computer
is a part
– Two organizations can have a computer named the same thing because the
domain name makes it clear which one is being referred to
• The very last section of the domain is called its top-level domain (TLD) name
• Organizations based in countries other than the United States use a top-level
domain that corresponds to their two-letter country codes
• The domain name system (DNS) is chiefly used to translate hostnames into numeric
IP addresses
Every domain whether it is a single host or a top level domain can have a set of resource
records associated with it. Whenever a resolver (this will be explained later) gives the
domain name to DNS it gets the resource record associated with it. So DNS can be looked
upon as a service which maps domain names to resource records. Each resource record has
five fields and looks as below:
Name Servers
• Message formats
• Message transfer
• Final delivery
A user agent is a program (sometimes called an email reader) that accepts a variety
of commands for composing, receiving, and replying to messages, as well as for
manipulating mailboxes.
Message Formats
E-mail example
E-mail headers
MIME-Version: 1.0
Content-Type: Multipart/Mixed; Boundary=Mime_separator
Content-type: text/plain
MIME is extensible - sender and receiver agree on encoding scheme
Can arrange for e-mailbox to be associated with a program rather than a user's mail
reader
Incoming mail automagically processed as input to program
Example - mailing list subscription administration
Can be used to implement client-server processing
o Client request in incoming mail message
o Server response in returned mail reply
Message Transfer
SMTP
Simple Mail Transfer Protocol (SMTP) is standard application protocol for delivery
of mail from source to destination
Provides reliable delivery of messages
Uses TCP and message exchange between client and server
Mail gateways
Ralph_Droms droms@regulus.eg.bucknell.edu
Dan_Little dlittle@mail.bucknell.edu
Ruth_Miller miller@charcoal.eg.bucknell.edu
Mailbox access
Instead of TELNET, use prtocl that accesses mail on remote computer directly
TCP/IP protocol suite includes Post Office Protocol (POP) for remote mailbox access
o Computer with mailboxes runs POP server
o User runs POP client on local computer
o POP client can access and retrieve messages from mailbox
o Requires authentication (password)
o Local computer uses SMTP for outgoing mail
• Architectural overview
Architectural Overview
• The Web consists of a vast, worldwide collection of content in the form of Web
pages, often just called pages for short.
• Each page may contain links to other pages anywhere in the world. Users can follow
a link by clicking on it, which then takes them to the page pointed to.
• This process can be repeated indefinitely. The idea of having one page point to
another, now called hypertext, generally viewed with a program called a browser.
• This page shows text and graphical elements (that are mostly too small to read).
When an item is selected, the browser follows the hyperlink and fetches the page selected.
Therefore, the embedded hyperlink needs a way to name any other page on the Web. Pages
are named using URLs (Uniform Resource Locators).
URLs have three parts:
This URL consists of three parts: the protocol (http), the DNS name of the host
(www.cs.washington.edu), and the path name (index.html).
• The protocol (also known as the scheme),
• The DNS name of the machine on which the page is located, and the path uniquely
indicating the specific page (a file to read or program to run on the machine).
• In the general case, the path has a hierarchical name that models a file directory
structure.
As an example, the URL http://www.cs.washington.edu/index.html
The steps that occur at the client side are:
MIME TYPES
Many servers each processing module performs a series of steps. The front end passes each
incoming request to the first available module, which then carries it out using some subset
of the following steps.These steps occur after the TCP connection and any secure transport
mechanism (such as SSL/TLS,) have been established.
Resolve the name of the Web page requested.
Perform access control on the Web page.
Check the cache.
Fetch the requested page from disk or run a program to build it.
Determine the rest of the response (e.g., the MIME type to send).
Return the response to the client.
Make an entry in the server log.
Cookies
• Cookies are usually small text files, given ID tags that are stored on your computer's
browser directory or program data subfolders.
• Cookies are created when you use your browser to visit a website that uses cookies
to keep track of your movements within the site, help you resume where you left off,
remember your registered login, theme selection, preferences, and other
customization functions.
There are two types of cookies: session cookies and persistent cookies.
Session cookies are created temporarily in your browser's subfolder while you are
visiting a website. Once you leave the site, the session cookie is deleted.
<!DOCTYPE
html> <html>
<head>
<title>Page
Title</title> </head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Example Explained
Web Browsers
The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and
display them. The browser does not display the HTML tags, but uses them to determine
how to display the document:
Input form is an online form which ActionApps users use to manually add data into a slice..
Any input forms a collection (or sequence) of input elements, which correspond to slice
Fields. There are various types of input elements, like textarea, select box, simple text box.
Web Page
web page is a document available on world wide web. Web Pages are stored on web
server and can be viewed using a web browser.
A web page can cotain huge information including text, graphics, audio, video and hyper
links. These hyper links are the link to other web pages.
Collection of linked web pages on a web server is known as website. There is unique
Uniform Resource Locator (URL) is associated with each web page.
Static web pages are also known as flat or stationary web page. They are loaded on the
client’s browser as exactly they are stored on the web server. Such web pages contain only
static information. User can only read the information but can’t do any modification or
interact with the information.
Static web pages are created using only HTML. Static web pages are only used when the
information is no more required to be modified.
Dynamic web page shows different information at different point of time. It is possible
to change a portaion of a web page without loading the entire web page. It has been made
possible using Ajax technology.
It is created by using server-side scripting. There are server-side scripting parameters that
determine how to assemble a new web page which also include setting up of more client-
side processing.
It is processed using client side scripting such as JavaScript. And then passed in to
Document Object Model (DOM).
HTTP makes use of the Uniform Resource Identifier (URI) to identify a given
resource and to establish a connection.
Once the connection is established, HTTP messages are passed in a format similar
to that used by the Internet mail [RFC5322] and the Multipurpose Internet Mail
Extensions (MIME) [RFC2045].
Connections
Let us consider a Web page with two embedded images on the same server. The
URLs of the images are determined as the main page is fetched, so they are fetched
after the main page.
The page is fetched with a persistent connection. That is, the TCP connection is
opened at the beginning, then the same three requests are sent, one after the other
as before, and only then is the connection closed.
There is one persistent connection and the requests are pipelined. Specifically, the
second and third requests are sent in rapid succession as soon as enough of the
main page has been retrieved to identify that the images must be fetched.
This method cuts down the time that the server is idle, so it further improves
performance.
Methods
HTTP - Requests
An HTTP client sends an HTTP request to a server in the form of a request message which
includes following format:
A Request-line
Request-Line
The Request-Line begins with a method token, followed by the Request-URI and the
protocol version, and ending with CRLF. The elements are separated by space SP
characters.
Request Method
The request method indicates the method to be performed on the resource identified by
the given Request-URI. The method is case-sensitive and should always be mentioned
in uppercase. The following table lists all the supported methods in HTTP/1.1.
GET
The GET method is used to retrieve information from the given server using a given
URI. Requests using GET should only retrieve data and should have no other effect
on the data.
HEAD
Same as GET, but transfers the status line and header section only.
POST
A POST request is used to send data to the server, for example, customer
information, file upload, etc. using HTML forms.
PUT
Replaces all current representations of the target resource with the
uploaded content.
DELETE
Removes all current representations of the target resource given by a URI.
CONNECT
Establishes a tunnel to the server identified by a given URI.
OPTIONS
Describes the communication options for the target resource.
TRACE
Performs a message loop-back test along the path to the target resource.
1xx: Informational:It means the request has been received and the process is continuing.
2xx: Success:It means the action was successfully received, understood, and accepted.
3xx: Redirection:It means further action must be taken in order to complete the request.
4xx: Client Error:It means the request contains incorrect syntax or cannot be fulfilled.
5xx: Server Error:It means the server failed to fulfill an apparently valid request.
Message Types
HTTP messages consist of requests from client to server and responses from server to
client.
Request and Response messages use the generic message format of RFC 822 [9] for
transferring entities (the payload of the message).
Both types of message consist of a start-line, zero or more header fields (also known as
"headers"), an empty line (i.e., a line with nothing preceding the CRLF) indicating the end of
the header fields, and possibly a message body.
generic-message = start-line
*(message-header CRLF)
CRLF
[ message-body ]
start-line = Request-Line | Status-Line
Message Headers
HTTP header fields provide required information about the request or response, or about the
object sent in the message body. There are four types of HTTP message headers:
Caching
People often return to Web pages that they have viewed before, and related Web pages
often have the same embedded resources. It would be very wasteful to fetch all of these
resources for these pages each time they are displayed because the browser already has a
copy. Squirreling away pages that are fetched for subsequent use is called caching.
The first strategy is page validation (step 2).
The cache is consulted, and if it has a copy of a page for the requested URL that is
known to be fresh (i.e., still valid), there is no need to fetch it a new from the server.
It is to ask the server if the cached copy is still valid. This request is a conditional
GET, and it is shown in Fig( step 3).
If the server knows that the cached copy is still valid, it can send a short reply to say
so (step 4a).
Otherwise, it must send the full response (step 4b).
HTTP caching.
Cryptography
• Introduction
• Substitution ciphers
• Transposition ciphers
It will often be useful to have a notation for relating plaintext, ciphertext, and keys. We will
use C =EK(P) to mean that the encryption of the plaintext P using key K gives the ciphertext
C. Similarly, P=DK(C) represents the decryption of C to get the plaintext again. It then
follows that
DK(EK(P)) =P
This notation suggests that E and D are just mathematical functions, to distinguish it from
the message.
• Substitution Cipher
– Changes characters in the plaintext to produce the ciphertext.
– where letters of plaintext are replaced by other letters or by numbers or
symbols
– or if plaintext is viewed as a sequence of bits, then substitution involves
replacing plaintext bit patterns with ciphertext bit patterns
• Examples
– Caesar Cipher
– Vigenere Cipher
– One Time Pad
• Caesar Cipher
– Consider the plaintext to be the letters A,B,C,...,Z.
– Now shift the sequence, say, by 3 to get D,E,F,...Z,A,B,C.
– Then the cipher text becomes D for A, E for B, and so on.
– If each letter is represented by integers 0,1,...,25, we can describe this process
as C=(M + K) mod 26, where the key is K=3.
– earliest known substitution cipher
– by Julius Caesar
– first attested use in military affairs
– replaces each letter by 3rd letter on
example:
meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB
• can define transformation as:
abcdefghijklmnopqrstuvwxyz
DEFGHIJKLMNOPQRSTUVWXYZABC
• mathematically give each letter a number
abcdefghijklm
0 1 2 3 4 5 6 7 8 9 10 11 12
nopqrstuvwxyZ
13 14 15 16 17 18 19 20 21 22 23 24 25
• then have Caesar cipher as:
C = E(p) = (p + k) mod (26)
p = D(C) = (C – k) mod (26)
Monoalphabetic Cipher
• rather than just shifting the alphabet
• could shuffle (jumble) the letters arbitrarily
• each plaintext letter maps to a different random ciphertext letter
• hence key is 26 letters long
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Playfair Cipher
• not even the large number of keys in a monoalphabetic cipher provides security
• one approach to improving security was to encrypt multiple letters
• the Playfair Cipher is an example
• invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair
Vigenère Cipher
– The Vigenère cipher chooses a sequence of keys, represented by a string.
– Key letters are applied to successive plaintext.
– When the end of the key sequence is reached, the key starts over again.
– The length of the key is called the period of the cipher.
– simplest polyalphabetic substitution cipher is the Vigenère Cipher
– effectively multiple caesar ciphers
– key is multiple letters long K = k1 k2 ... kd
– ith letter specifies ith alphabet to use
– use each alphabet in turn
– repeat from start after d letters in message
– decryption simply works in reverse
Example
• write the plaintext out
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
– ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ
One-Time Pad
– A variant of the Vigenère cipher.
– The key is chosen at random.
– The length of the key is at least as long as that of the message, and so it does
not repeat.
– since for any plaintext & any ciphertext there exists a key mapping one to
other
Transposition Ciphers
• can recognise these since have the same frequency distribution as the original text
mematrhtgpr
yetefeteoaat
• giving ciphertext
MEMATRHTGPRYETEFETEOAAT
• then reorder the columns according to some key before reading off the rows
Plaintext: a t t a c k p
ostpone
duntiltw
oamxyz
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
RSA(Rivest,Shamir,adleman)
RSA Algorithm
It was developed by Rivest, Shamir and Adleman. This algorithm makes use of an
expression with exponentials.
Plaintext is encrypted in blocks, with each block having a binary value less than
some number n.
That is, the block size must be less than or equal to log2 (n); in practice, the block
size is k-bits, where 2k < n < 2k+1.
Encryption and decryption are of the following form, for some plaintext block M and
ciphertext block C:
C = Me mod n
M = Cd mod n = (Me mod n) mod n
= (Me) d mod n
= Med mod n
Both the sender and receiver know the value of n. the sender knows the value of e and only
the receiver knows the value of d. thus, this is a public key encryption algorithm with a
public key of KU = {e, n} and a private key of KR = {d, n}.
For this algorithm to be satisfactory for public key encryption, the following requirements
must be met:
It is possible to find values of e, d, n such that Med = M mod n for all M<n.
Med = M mod n
A corollary to Euler’s theorem fits the bill: Given two prime numbers p and q and two
integers, n and m, such that n=pq and 0<m<n, and arbitrary integer k, the following
relationship holds
where Ф(n) – Euler totient function, which is the number of positive integers less than n
and relatively prime to n.
That is, e and d are multiplicative inverses mod Ф(n). According to the rule of modular
arithmetic, this is true only if d (and therefore e) is relatively prime to Ф(n). Equivalently,
gcd(Ф(n), d) = 1.
The steps involved in RSA algorithm for generating the key are
Select two prime numbers, p = 17 and q = 11.
Select e such that e is relatively prime to Ф(n) = 160 and less than Ф(n); we choose e
= 7.
Determine d such that ed ≡ 1 mod Ф(n) and d<160. the correct value is d = 23,
because 23*7 = 161 = 1 mod 160.
Security of RSA
There are three approaches to attack the RSA:
brute force key search (infeasible given size of numbers)
mathematical attacks (based on difficulty of computing ø(N), by factoring modulus
N)
timing attacks (on running time of decryption)
Authentication
Authentication is any process by which a system verifies the identity of a User who wishes
to access it. Since Access Control is normally based on the identity of the User who requests
access to a resource, Authentication is essential to effective Security.
Authorization
Authentication Protocol-Kerberos
1. Client to the Authentication Server(AS): The following data in plain text form are
sent:
o Username.
o Ticket Granting Server(TGS) name.
o A nonce id 'n'.
2. Response from the Authentication Server(AS) to the Client: The following data in
encrypted form with the key shared between the AS and the Client is sent:
o The TGS session key.
o The Ticket Granting Ticket. This contains the following data encrypted
with the TGS password and can be decrypted by the TGS only.
Username.
The TGS name.
The Work Station address.
The TGS session key.
o The nonce id 'n'.
3. Client to the Ticket Granting Server: This contains the following data
o The Ticket Granting ticket.
o Authenticator.
o The Application Server.
o The nonce id 'n'
4. Ticket Granting Server to the Client: The following data encrypted by the
TGS session key is sent:
o The new session key.
o Nonce id 'n'
o Ticket for the application server- The ticket contains the following data
encrypted by the application servers' key:
Username
Server name
The Workstation address
The new session key.
After these exchanges the identity of the user is confirmed and the normal exchange of data
in encrypted form using the new session key can take place. The current version of
Kerberos being developed is Kerberos V5.
Time Stamps:
Authentication: This is the time when i first authenticated myself .
Start: This is the time when valid period starts.
End: This is the time when valid period ends.
Renewal time: This is the time when ticket is renewed.
Current time: This time is for additional security. This stops using old packets. Here
we need to synchronize all clocks.
Limitations of Kerberos
Password Guessing: Anyone can get all privileges by cracking password.
Denial-of-Service Attack: This may arise due to keep sending request to invalid
ticket.
Synchronization of Clock: This is the most significant limitation to the kerberos.
11MARKS
1.Explain the function of three major components used in the internet Electronic Mail (e-
mail) system.(April/May 2014) (Pg. No.12)(Qn. No.2)
2.Discuss the services provided by the Internet’s domain name system(DNS). (April/May
2014)(Pg.No.7)(Qn. No.1)
1. What is MIME in email? Describe in detail the use of different agents involved for
transmitting an email message from a source to a destination.(April 2015) (Pg.
No.11)(Qn. No.2)