Thursday, August 29, 2013

SIMPLE MAIL TRANSFER PROTOCOL(SMTP)

TCP/IP protocol suite specifies a standard for the exchange of mail between machines. It was derived from the (MTP ) 

Mail Transfer Protocol. it deals with how the underlying mail delivery system passes messages across a link from one.machine to another. The mail is enclosed in what is called an envelope . The envelope contains the To and From fields and these are followed by the mail . The mail consists of two parts namely the Header and the Data.
The Header has the To and From fields. If Headers are defined by us they should start with X. The standard headers do not start with X. 

In SMTP data portion can contain only printable ASCII characters The old method of sending a binary file was to send it in uuencoded form but there was no way to distinguish between the many types of binary files possible eg. .tar , .gz , .dvi etc.

MIME(Multipurpose Internet Mail Extension):

This allows the transmission of Non ASCII data through email, MIME allows arbitrary data to be encoded in ASCII and sent in a standard email message. Each MIME message includes information that tells the recipient the type of data and the type of encoding used.and this information along with the MIME version resides in the MIME header. Typical MIME header looks like -

      MIME-Version: 1.0
      Content-Description:
      Content-Id:
      Content-Type: image/gif
      Content-Transfer-Encoding: base 64
      
      Content Description : contains the file name of the file that is being sent. Content -Type : is an important field that specifies the data format ie. tells what kind of data is being sent. It contains two identifiers a content type and a sub type separated by a slash. for e.g. image/gif
There are 7 Content Types -
  1. text
  2. image
  3. video
  4. audio
  5. application
  6. multi-part
  7. message
Content type - Message
It supports 3 subtypes namely
  1. RFC822 - the old mail message format
  2. Partial- means that ordinary message is just a part and the receiver should wait for all the parts before putting it in the mailbox.
  3. external_body - destination MTA will fetch file from remote site.
Content Type - Multipart
Multiple messages which may have different content types can be sent together. It supports 4 subtypes namely
  1. mixed -Look at each part independently
  2. alternative - The same message is sent in multiple types and formats and the receiver may choose to read the message in any form he wishes.
  3. parallel -The different parts of the message have to be read in parallel. ie. audio , video and text need to be read in a synchronized fashion 
  4. digest -There are multiple RFC messages in mail. The addresses of the receivers are in the form of a mailing list. Although file header is long it prevents cluttering of mail box.

PROBLEMS WITH SMTP:

  1. There is no convenient  way to send non printable characters.
  2. There is no way to know if one has received mail or not or has read it or not.
  3. Someone else can send a mail on my behalf.
So a better protocol was proposed - ESMTP ,ESMTP stands for Extended Simple Mail Transfer Protocol. It is compatible with SMTP. Just as the first packet sent in SMTP is HELO similarly in ESMTP the first packet is called EHELO. If the receiver supports ESMTP then it will answer to this EHELO packet by sending what data type and what kind of encoding it supports. Even a SMTP based receiver can reply to it. Also if there is an error message or there is no answer then the sender uses SMTP.

DELIVERY PROTOCOLS:

The delivery protocols determine how the mail is transferred by  the mail transfer agent    to the user agent which provides an interface for reading mails.
   There are 3 kinds
  1. POP3 (Post Office Protocol) Here the mail person accesses the mail box  from say a PC and the mail gets accumulated on a server. So in POP3 the mail is downloaded to the PC at a time interval which can be specified by the
 user. POP3 is used when the mail is always  read from the same machine,so it helps to download the mail to it in advance.
  2.IMAP(Intermediate Mail Access Protocol) Here the user may access the mail box on the server from different  machines so there is no point in downloading the mail before hand. Instead when the mail has to be read one has to log
   on to the server. (IMAP thus provides authentication) The mailbox on the server can be looked upon as a relational database.
  3.DMSP(Distributive Mail System Protocol) There are multiple  mailboxes on different  servers. To read the mail I connect to them from time to time and whenever I  do so the mail will be downloaded. When a reply is sent then it will put the message in a queue. Thus DMSP is like a pseudo MTA.
 

Ensuring Network Security:

  1. How to ensure that nobody else reads your mail?
  2. How to be sure that the mail has not been seen by someone else in your name?
  3. Integrity ie. mail has not been tampered with
  4. Non-Reputability- means once I send a mail I cannot deny it, and this fact can be proved to a third person
  5. Authentication

Mechanisms (PGP & PEM):

PGP (Pretty Good Privacy) - It uses some cryptography algorithm to crypt the messages. 

Symmetric PGP- The key used for encryption and decryption is the same. 

Asymmetric PGP - The key used for encryption and decryption is different.Keys come in pairs - public (known to all) and private. which everybody has. Usually encryption is done using public key so that the private key is used for decryption by the receiver only for whom the message is meant.
Eg. of Symmetric PGP is DES, IDEA
Eg. of Asymmetric PGP is RSA
Symmetric is usually faster  In asymmetric PGP there is a problem of  key distribution. A hash function is applied on every message so that no two messages hash to  the same value. Now the hash function is encrypted . If the hash function of source and destination matches then No tampering. If the key for encryption is private  then not everybody can generate the message although anyone can read it . So this scheme lacks privacy tackles the other security issues.





No comments:

Post a Comment