<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CEEDQ3s9fyp7ImA9WhRRFEk.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111</id><updated>2011-11-28T06:41:12.567+05:30</updated><category term="linux" /><category term="apache" /><category term="harddisk" /><category term="re" /><category term="tcpdump" /><category term="proxy" /><category term="javascript" /><category term="logs" /><category term="file partition" /><category term="chkconfig" /><category term="sockets" /><category term="security" /><category term="syslog" /><category term="Ip address" /><category term="ssh" /><category term="Perl" /><category term="lynx" /><category term="curl" /><category term="networking" /><category term="Programming" /><category term="Web" /><category term="C Programming" /><category term="VPN" /><category term="kill command" /><category term="shell" /><category term="python" /><category term="pid" /><category term="unix" /><category term="stdin-stdout-stderr" /><category term="kernel" /><category term="internet" /><category term="Certificates" /><category term="windows" /><category term="gcc" /><category term="email" /><category term="iptables" /><category term="cron" /><category term="Regular Expression" /><category term="wget" /><title>Enjoy ur trip to Technology</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://vinojdavis.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>136</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/EnjoyUrTripToTechnology" /><feedburner:info uri="enjoyurtriptotechnology" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;Dk4GQX88cCp7ImA9WxFTGEw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-1599292835887317514</id><published>2010-04-09T17:38:00.000+05:30</published><updated>2010-04-09T17:38:40.178+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-09T17:38:40.178+05:30</app:edited><title>Packet FLow Diagrams</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_GciOeVn_TLE/S78YIOY042I/AAAAAAAADKg/guCGGfRZTKY/s1600/packet_flow9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://2.bp.blogspot.com/_GciOeVn_TLE/S78YIOY042I/AAAAAAAADKg/guCGGfRZTKY/s640/packet_flow9.png" width="322" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Diagram2:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_GciOeVn_TLE/S78YKmKmHAI/AAAAAAAADKo/mrz187tXNoQ/s1600/packetflow.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="http://2.bp.blogspot.com/_GciOeVn_TLE/S78YKmKmHAI/AAAAAAAADKo/mrz187tXNoQ/s640/packetflow.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-1599292835887317514?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/d8QcSsIPN6UD3rMguXGawvHCNB0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d8QcSsIPN6UD3rMguXGawvHCNB0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/d8QcSsIPN6UD3rMguXGawvHCNB0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d8QcSsIPN6UD3rMguXGawvHCNB0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/VAed5GRS8ns" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/1599292835887317514/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=1599292835887317514" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/1599292835887317514?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/1599292835887317514?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/VAed5GRS8ns/packet-flow-diagrams.html" title="Packet FLow Diagrams" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_GciOeVn_TLE/S78YIOY042I/AAAAAAAADKg/guCGGfRZTKY/s72-c/packet_flow9.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2010/04/packet-flow-diagrams.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4FQn44eyp7ImA9WxBaFEw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-4131309233807548892</id><published>2010-03-24T13:18:00.000+05:30</published><updated>2010-03-24T13:18:33.033+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-24T13:18:33.033+05:30</app:edited><title>Setup DNS Server</title><content type="html">&lt;h1 id="content"&gt;How to set up a home DNS server&lt;/h1&gt;&lt;h4 id="byline"&gt;by Shannon Hughes&lt;/h4&gt;&lt;br /&gt;
&lt;h2&gt;Domain Name System&lt;/h2&gt;The Domain Name System (DNS) is the crucial glue that keeps computer networks in harmony by converting human-friendly hostnames to the numerical IP addresses computers require to communicate with each other. DNS is one of the largest and most important distributed databases the world depends on by serving billions of DNS requests daily for public IP addresses. Most public DNS servers today are run by larger ISPs and commercial companies but private DNS servers can also be useful for private home networks. This article will explore some advantages of setting up various types of DNS servers in the home network.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.redhat.com/magazine/025nov06/features/dns/"&gt;Click here to read more&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.amazon.com/Valleys-Neptune-Jimi-Hendrix/dp/B00328G4V6?ie=UTF8&amp;amp;tag=enjoyurtrip-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;&amp;nbsp;Don't click here &lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=enjoyurtrip-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=B00328G4V6" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-4131309233807548892?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/brGUs5fFgCPK9IcS6XLIys_gEFk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/brGUs5fFgCPK9IcS6XLIys_gEFk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/brGUs5fFgCPK9IcS6XLIys_gEFk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/brGUs5fFgCPK9IcS6XLIys_gEFk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/0LXatVKfrr0" height="1" width="1"/&gt;</content><link rel="related" href="http://www.redhat.com/magazine/025nov06/features/dns/" title="Setup DNS Server" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/4131309233807548892/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=4131309233807548892" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/4131309233807548892?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/4131309233807548892?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/0LXatVKfrr0/setup-dns-server.html" title="Setup DNS Server" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2010/03/setup-dns-server.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4NRnY_eCp7ImA9WxBaFEw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-6658779345817717228</id><published>2010-03-24T13:15:00.001+05:30</published><updated>2010-03-24T13:19:57.840+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-24T13:19:57.840+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><title>Setup Home Web Server</title><content type="html">&lt;h1 id="content"&gt;How to set up a home web server&lt;/h1&gt;&lt;h4 id="byline"&gt;by Jeff "Crash" Goldin&lt;/h4&gt;It seems like everybody's blogging and sharing digital photos online. This booming hobby (and business) sends many people to paid hosting companies to share their thoughts and images. Though many companies are reliable and inexpensive, with a little work and some relatively cheap hardware you can host your own files, save some money, and have complete control over what services are available and how your content is displayed.&lt;br /&gt;
&lt;a href="http://www.redhat.com/magazine/022aug06/features/webserver/"&gt;Click here to read more....&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015T963C?ie=UTF8&amp;amp;tag=enjoyurtrip-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;&amp;nbsp;Dont Touch Me &lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=enjoyurtrip-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=B0015T963C" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-6658779345817717228?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Uq_vamRQrxA5ItRyM9Dj9s4I3w4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Uq_vamRQrxA5ItRyM9Dj9s4I3w4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Uq_vamRQrxA5ItRyM9Dj9s4I3w4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Uq_vamRQrxA5ItRyM9Dj9s4I3w4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/rdpF_t4HQmY" height="1" width="1"/&gt;</content><link rel="related" href="http://www.redhat.com/magazine/022aug06/features/webserver/" title="Setup Home Web Server" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/6658779345817717228/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=6658779345817717228" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6658779345817717228?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6658779345817717228?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/rdpF_t4HQmY/setup-home-web-server.html" title="Setup Home Web Server" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2010/03/setup-home-web-server.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMDR3YzcSp7ImA9WxBUEkQ.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-3952512950603771824</id><published>2010-02-27T23:44:00.001+05:30</published><updated>2010-02-27T23:44:36.889+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-27T23:44:36.889+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web" /><title>Joomla (Content Manager)</title><content type="html">&lt;h1 class="contentheading"&gt;What is Joomla?&lt;/h1&gt;Joomla is an award-winning content management  system (CMS), which enables you to build Web   sites and powerful online  applications. Many aspects, including its ease-of-use and    extensibility, have made Joomla the most popular Web site software  available. Best of all,   Joomla is an open source solution that is  freely available to everyone.&lt;br /&gt;
&lt;div class="vis-clear"&gt;&lt;/div&gt;&lt;h2&gt;What's  a content management system (CMS)?&lt;/h2&gt;A content management system  is software that keeps track of every piece of   content on your Web  site, much like your local public library keeps track of books and    stores them. Content can be simple text, photos, music, video,  documents, or just about   anything you can think of. A major advantage  of using a CMS is that it requires almost no   technical skill or  knowledge to manage. Since the CMS manages all your content, you don't    have to.&lt;br /&gt;
&lt;div class="vis-clear"&gt;&lt;/div&gt;&lt;h2&gt;What are some real  world examples of what Joomla! can do?&lt;/h2&gt;Joomla is used all over  the world to power Web sites of all shapes and sizes. For example:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Corporate Web sites or portals&lt;/li&gt;
&lt;li&gt;Corporate intranets and  extranets&lt;/li&gt;
&lt;li&gt;Online magazines, newspapers, and publications&lt;/li&gt;
&lt;li&gt;E-commerce and online reservations&lt;/li&gt;
&lt;li&gt;Government  applications&lt;/li&gt;
&lt;li&gt;Small business Web sites&lt;/li&gt;
&lt;li&gt;Non-profit and  organizational Web sites&lt;/li&gt;
&lt;li&gt;Community-based portals&lt;/li&gt;
&lt;li&gt;School  and church Web sites&lt;/li&gt;
&lt;li&gt;Personal or family homepages&lt;/li&gt;
&lt;/ul&gt;&lt;div class="vis-clear"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-3952512950603771824?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mgPXJROj26Sk-A115RnCvNNlT5g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mgPXJROj26Sk-A115RnCvNNlT5g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mgPXJROj26Sk-A115RnCvNNlT5g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mgPXJROj26Sk-A115RnCvNNlT5g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/Obscb7flnA8" height="1" width="1"/&gt;</content><link rel="related" href="http://www.joomla.org/" title="Joomla (Content Manager)" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/3952512950603771824/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=3952512950603771824" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/3952512950603771824?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/3952512950603771824?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/Obscb7flnA8/joomla-content-manager.html" title="Joomla (Content Manager)" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2010/02/joomla-content-manager.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQDQnsyeSp7ImA9WxBUEkQ.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-2990604369819433</id><published>2010-02-27T23:42:00.001+05:30</published><updated>2010-02-27T23:42:53.591+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-27T23:42:53.591+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><title>Django</title><content type="html">&lt;h2 class="deck"&gt;Django is a high-level Python Web framework that  encourages rapid development and clean, pragmatic design.&lt;/h2&gt;Developed four years ago by a fast-moving online-news operation,  Django was designed to handle two challenges: the intensive deadlines of  a newsroom and the stringent requirements of the experienced Web  developers who wrote it. It lets you build high-performing, elegant Web  applications quickly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-2990604369819433?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pmbk8Zlwr-x2JQXU55YmCP3to_c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pmbk8Zlwr-x2JQXU55YmCP3to_c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/pmbk8Zlwr-x2JQXU55YmCP3to_c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pmbk8Zlwr-x2JQXU55YmCP3to_c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/nr0pbhflCNU" height="1" width="1"/&gt;</content><link rel="related" href="http://www.djangoproject.com/" title="Django" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/2990604369819433/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=2990604369819433" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/2990604369819433?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/2990604369819433?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/nr0pbhflCNU/django.html" title="Django" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2010/02/django.html</feedburner:origLink><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="enclosure" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~5/_jSMYbJaUik/" length="0" /><feedburner:origEnclosureLink>http://www.djangoproject.com/</feedburner:origEnclosureLink></entry><entry gd:etag="W/&quot;DkYHSXo-fyp7ImA9WxNaEk4.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-3399116809903963003</id><published>2009-11-26T16:45:00.000+05:30</published><updated>2009-11-26T16:45:38.457+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-26T16:45:38.457+05:30</app:edited><title>Credit Card Validation</title><content type="html">&lt;pre&gt;"""
    Provides functions &amp;amp; Fields for validating credit card numbers
    Thanks to David Shaw for the Luhn Checksum code 
    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/172845)
"""

import re        
from django import newforms as forms

import datetime
        
def ValidateLuhnChecksum(number_as_string):
    """ checks to make sure that the card passes a luhn mod-10 checksum """

    sum = 0

    num_digits = len(number_as_string)
    oddeven = num_digits &amp;amp; 1

    for i in range(0, num_digits):
        digit = int(number_as_string[i])

        if not (( i &amp;amp; 1 ) ^ oddeven ):

            digit = digit * 2
        if digit &amp;gt; 9:

            digit = digit - 9

        sum = sum + digit

        
    return ( (sum % 10) == 0 )

# Regex for valid card numbers
CC_PATTERNS = {
    'mastercard':   '^5[12345]([0-9]{14})$',
    'visa':         '^4([0-9]{12,15})$',

}

def ValidateCharacters(number):
    """ Checks to make sure string only contains valid characters """
    return re.compile('^[0-9 ]*$').match(number) != None

        
def StripToNumbers(number):
    """ remove spaces from the number """
    if ValidateCharacters(number):

        result = ''
        rx = re.compile('^[0-9]$')

        for d in number:
            if rx.match(d):

                result += d
        return result
    else:
        raise Exception('Number has invalid digits')

def ValidateDigits(type, number):
    """ Checks to make sure that the Digits match the CC pattern """
    regex = CC_PATTERNS.get(type.lower(), False)

    if regex:
        return re.compile(regex).match(number) != None

    else:
        return False

def ValidateCreditCard(type, number):

    """ Check that a credit card number matches the type and validates the Luhn Checksum """
    type = type.strip().lower()
    if ValidateCharacters(number):

        number = StripToNumbers(number)
        if CC_PATTERNS.has_key(type):

            return ValidateDigits(type, number)
            return ValidateLuhnChecksum(number)

    return False

class CreditCardNumberField(forms.CharField):
    """ A newforms widget for a creditcard number """

    def clean(self, value):
        
        value = forms.CharField.clean(self, value)

        if not ValidateCharacters(value):
            raise forms.ValidationError('Can only contain numbers and spaces.')

        value = StripToNumbers(value)
        if not ValidateLuhnChecksum(value):

            raise forms.ValidationError('Not a valid credit card number.')
        
        return value


class CreditCardExpiryField(forms.CharField):
    """ A newforms widget for a creditcard expiry date """
    def clean(self, value):     
        value = forms.CharField.clean(self, value.strip())

        
        # Just check MM/YY Pattern
        r = re.compile('^([0-9][0-9])/([0-9][0-9])$')
        m = r.match(value)

        if m == None:
            raise forms.ValidationError('Must be in the format MM/YY. i.e. "11/10" for Nov 2010.')

        
        # Check that the month is 1-12
        month = int(m.groups()[0])

        if month &amp;lt; 1 or month &amp;gt; 12:
            raise forms.ValidationError('Month must be in the range 1 - 12.')

        
        # Check that the year is not too far into the future
        year = int(m.groups()[1])

        curr_year = datetime.datetime.now().year % 100

        max_year = curr_year + 10
        if year &amp;gt; max_year or year &amp;lt; curr_year:

            raise forms.ValidationError('Year must be in the range %s - %s.' % (str(curr_year).zfill(2), str(max_year).zfill(2),))

        return value   

# An example Form based on ModelForm.
class PaymentForm(forms.ModelForm):    
    cc_number = creditcards.CreditCardNumberField(required=False)

    cc_expiry = creditcards.CreditCardExpiryField()
   
    class Meta:
        model = Payment 
    
    """

        This function checks that the card number matches the card type.  
        If you don't want to do this, comment out this function.
    """
    def clean(self):

        if self.cleaned_data:
            if len(self.cleaned_data.items()) == len(self.fields):      
                if self.cleaned_data['method'] == 'cc':

                    the_type = self.cleaned_data.get('cc_type', '')

                    number = self.cleaned_data.get('cc_number', '')

                    if not ValidateDigits(the_type, number):
                        raise forms.ValidationError('Card Number is not a valid ' + the_type.upper() + ' card number.')

                    if not self.instance.is_payment_valid():
                        raise forms.ValidationError('Credit card payment could not be processed.  Reason is %s.  Check that card details are correct and try again.  If you still receive this error, check with your financial institution.' % (self.instance.gateway_resptxt))

        return self.cleaned_data
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-3399116809903963003?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RoIQpmER0UX2OPOeaYpUqVQmzYM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RoIQpmER0UX2OPOeaYpUqVQmzYM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RoIQpmER0UX2OPOeaYpUqVQmzYM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RoIQpmER0UX2OPOeaYpUqVQmzYM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/EvhgX1IeP1Y" height="1" width="1"/&gt;</content><link rel="related" href="http://www.djangosnippets.org/snippets/764/" title="Credit Card Validation" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/3399116809903963003/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=3399116809903963003" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/3399116809903963003?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/3399116809903963003?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/EvhgX1IeP1Y/credit-card-validation.html" title="Credit Card Validation" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/11/credit-card-validation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4HSH0_fSp7ImA9WxNUEkk.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-1904659782296968778</id><published>2009-11-03T17:18:00.001+05:30</published><updated>2009-11-03T17:18:59.345+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-03T17:18:59.345+05:30</app:edited><title>Snort</title><content type="html">Snort is a versatile, lightweight and very useful intrusion detection system. In this article we will look at Snort as a backup Intrusion Detection System for your enterprise network and see whether it can really scale up to the requirements of your enterprise networks.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Our failure establishes only this,&lt;br /&gt;
that our determination to succeed&lt;br /&gt;
wasn't strong enough.&lt;br /&gt;
--Bovee&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The main distribution site for Snort is  &lt;a href="http://www.snort.org/"&gt;http://www.snort.org&lt;/a&gt;.  Snort is distributed under the GNU GPL license by the author &lt;a href="mailto:roesch@clark.net"&gt;Martin Roesch&lt;/a&gt;. Snort is a lightweight network IDS, capable of performing real-time traffic analysis and packet logging on IP networks. It can perform protocol analysis, content searching/matching. It can be used to detect a variety of attacks and probes, such as buffer overflows, stealth port scans, CGI attacks, SMB probes, OS fingerprinting attempts, and more. Snort uses a flexible rules language to describe traffic that it should collect or pass, and includes a detection engine utilizing a modular plug-in architecture. Snort has real-time alerting capability as well, incorporating alerting mechanisms for Syslog, user- specified files, a UNIX socket, or WinPopup messages to Windows clients using Samba's smbclient. Snort has three primary uses. It can be used as a straight packet sniffer like tcpdump or as a packet logger that is useful for network traffic debugging. It can also be used as a full blown network intrusion detection system.&lt;br /&gt;
Snort logs packets in either tcpdump binary format or in Snort's decoded ASCII format to logging directories that are named based on the IP address of the foreign host.&lt;br /&gt;
Plug-ins allow the detection and reporting subsystems to be extended. Available plug-ins include database logging, small fragment detection, portscan detection, and HTTP URI normalization.&lt;br /&gt;
&lt;br /&gt;
The ground that we will be covering with respect to Snort will be&lt;br /&gt;
&lt;b&gt;-&lt;/b&gt; Snort as a straight packet sniffer like tcpdump.&lt;br /&gt;
&lt;b&gt;-&lt;/b&gt; Snort as a  packet  logger. Useful  for network traffic debugging etc.&lt;br /&gt;
&lt;b&gt;-&lt;/b&gt; Snort as a full blown network intrusion detection system.  &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Compiling and installing Snort&lt;/b&gt;&lt;br /&gt;
Having downloaded Snort, untar the archive with the following command.&lt;br /&gt;
bash#  tar -xvzf  snort-1.6.3.tar.gz&lt;br /&gt;
&lt;br /&gt;
This should do the trick and get it untarred into a directory snort-1.6.3. Having done this, next on the cards is a dependency check for various libraries and header files that Snort needs. You'll need to ensure that you have the sources for libcap. If not, you can download it from &lt;a href="ftp://ftp.ee.lbl.gov/libpcap.tar.Z"&gt;ftp://ftp.ee.lbl.gov/libpcap.tar.Z&lt;/a&gt;.  &lt;br /&gt;
Download the libcap headers and untar the archive using the tar command with the similar switches as mentioned above. Enter the directory and carry out the following steps.&lt;br /&gt;
bash# ./configure&lt;br /&gt;
bash# make&lt;br /&gt;
Though we do not need any of the binaries, this is just a precautionary measure. Now, we'll compile Snort. Change into the directory in which Snort lies and issue the following command.&lt;br /&gt;
bash#  ./configure --with-libpcap-includes=/path/to/your/libcap/headers&lt;br /&gt;
bash# make&lt;br /&gt;
bash# make install&lt;br /&gt;
&lt;b&gt;Using&lt;/b&gt;&lt;br /&gt;
Now Snort is installed on your system. Let's start using Snort on your system. We'll start with the basics of using Snort as a Packet Sniffer and a Packet Analyser. Apart from running in a promiscuous mode, we will also discover rules that will help us log alerts to our Snort logs or redirect them to syslog. &lt;br /&gt;
Using Snort as a packet sniffer and packet analyzer is a pretty simple process. The man pages are very helpful as far as information regarding using Snort is concerned. Let's basically start with a simple command that makes Snort display all the command switches and then exit.&lt;br /&gt;
bash# snort -?&lt;br /&gt;
&lt;br /&gt;
The output of the command is as follows.&lt;br /&gt;
-*&amp;gt; Snort! &amp;lt;*-&lt;br /&gt;
Version 1.6.3&lt;br /&gt;
By Martin Roesch (roesch@clark.net, www.snort.org)&lt;br /&gt;
USAGE: snort [-options] &lt;filter options=""&gt;&lt;br /&gt;
Options:&lt;br /&gt;
-A                        Set alert mode: fast, full, or none  (alert file alerts only)&lt;br /&gt;
'unsock' enables UNIX socket logging (experimental).&lt;br /&gt;
-a                         Display ARP packets&lt;br /&gt;
-b                         Log packets in tcpdump format (much faster!)&lt;br /&gt;
-c &lt;rules&gt;          Use Rules File &lt;rules&gt;&lt;br /&gt;
-C                        Print out payloads with character data only (no hex)&lt;br /&gt;
-d                         Dump the Application Layer&lt;br /&gt;
-D                        Run Snort in background (daemon) mode&lt;br /&gt;
-e                         Display the second layer header info&lt;br /&gt;
-F &lt;bpf&gt;              Read BPF filters from file &lt;bpf&gt;&lt;br /&gt;
-g &lt;gname&gt;        Run snort gid as 'gname' user or uid after initialization&lt;br /&gt;
-h &lt;hn&gt;               Home network = &lt;hn&gt;&lt;br /&gt;
-i &lt;if&gt;                 Listen on interface &lt;if&gt;&lt;br /&gt;
-l &lt;ld&gt;                Log to directory &lt;ld&gt;&lt;br /&gt;
-n &lt;cnt&gt;             Exit after receiving &lt;cnt&gt; packets&lt;br /&gt;
-N                       Turn off logging (alerts still work)&lt;br /&gt;
-o                       Change the rule testing order to Pass|Alert|Log&lt;br /&gt;
-O                      Obfuscate the logged IP addresses&lt;br /&gt;
-p                       Disable promiscuous mode sniffing&lt;br /&gt;
-P &lt;snap&gt;         set explicit snaplen of packet (default: 1514)&lt;br /&gt;
-q                      Quiet. Don't show banner and status report&lt;br /&gt;
-r &lt;tf&gt;               Read and process tcpdump file &lt;tf&gt;&lt;br /&gt;
-s                       Log alert messages to syslog&lt;br /&gt;
-S &lt;n=v&gt;          Set rules file variable n equal to value v&lt;br /&gt;
-t &lt;chrt&gt;          Chroots process to &lt;chrt&gt; after initialisaton&lt;br /&gt;
-u &lt;uname&gt;     Run snort uid as 'uname' user (or uid) after initialization&lt;br /&gt;
-v                      Be verbose&lt;br /&gt;
-V                     Show version number&lt;br /&gt;
-?                    Show this information&lt;br /&gt;
&lt;filter options=""&gt;   are standard BPF options, as seen in TCPDump&lt;/filter&gt;&lt;/uname&gt;&lt;/chrt&gt;&lt;/chrt&gt;&lt;/n=v&gt;&lt;/tf&gt;&lt;/tf&gt;&lt;/snap&gt;&lt;/cnt&gt;&lt;/cnt&gt;&lt;/ld&gt;&lt;/ld&gt;&lt;/if&gt;&lt;/if&gt;&lt;/hn&gt;&lt;/hn&gt;&lt;/gname&gt;&lt;/bpf&gt;&lt;/bpf&gt;&lt;/rules&gt;&lt;/rules&gt;&lt;/filter&gt;&lt;br /&gt;
Let's check out the next command wherein we set Snort to a verbose display of the packets sniffed and analyzed. The '-v' switch elicits a verbose response to Stdout. The '-d' switch elicits dumping the decoded application layer data and while '-e' shows the decoded ethernet headers. The '-i' switch specifies the interface to be monitored for packet analysis. The '-h' switch specifies which class of network packets has to be captured. e.g. - The command given below captures all the packets belonging to the class C internal IP's of the type 192.168.1.*. &lt;br /&gt;
freeos:~ # snort -v -d -e -i eth0 -h 192.168.1.0/24&lt;br /&gt;
&lt;br /&gt;
If we wanted to generate alerts, the  '-A' switch is of importance to us.&lt;br /&gt;
-A &lt;alert-mode&gt; - Alert using the specified alert-mode. Valid alert modes include 'fast', 'full', 'none', and 'unsock'. Fast, writes alerts to the default 'alert' file in a single-line, syslog style alert message. Full, writes the alert to the 'alert' file with the full decoded header as well as the alert message. The command will then change to the following.&lt;/alert-mode&gt;&lt;br /&gt;
freeos:~ # snort -v -d -e -i eth0 -h 192.168.1.0/24  -A fast &lt;br /&gt;
&lt;br /&gt;
Instead, if you wanted to send alert messages to the syslog daemon, you could use the '-s' switch instead.&lt;br /&gt;
-s - Send alert messages to Syslog. On Linux boxes, they will appear in /var/log/secure or /var/log/messages on many other platforms. &lt;br /&gt;
freeos:~ # snort -v -d -e -i eth0 -h 192.168.1.0/24  -s &lt;br /&gt;
Until now we haven't seen any actual logging taking place. All the packets sniffed and analyzed were just dumped to your screen. To have Snort dump the packets sniffed and analyzed to your logs, you will use the "-l" switch. That dumps all the data, regarding the packets analysed, to the directory log in the current path. You will have to create this directory. Do not expect Snort to create it at runtime. &lt;br /&gt;
freeos:~ # snort -v -d -e -i eth0 -h 192.168.1.0/24  -A full  -l ./log &lt;br /&gt;
But, there is an inherent drawback to this type of packet analysis and reporting. One of the foremost problems that may be encountered can be visualized as follows. Assuming that you are using Snort on your Gigabit ethernet. The speed at which data will be flowing across the network is too much for your NIC working in promiscous mode. Many packets will be dumped because it may not be possible to keep up the pace of analyzing the large amount of high speed data transfers across your network segment. Thus, instead if using the "-l" switch you should use the "-b" switch. This will log packets in tcpdump format and produce minimal alerts. For example:&lt;br /&gt;
freeos:~ # snort -b -i eth0 -A fast -h 192.168.1.0/24  -s  -l ./log &lt;br /&gt;
In this configuration, Snort has been able to log multiple simultaneous probes and attacks on a 100 Mbps LAN running at a saturation level of approximately 80 Mbps. In this configuration the logs are written in binary format to log in tcpdump format. To read this file back and break out the data in the familiar Snort format, just re-run Snort on the data file with the "-r" option and the other options you would normally use.&lt;br /&gt;
&lt;br /&gt;
freeos:~ # snort -i eth0 -l ./log  -h 192.168.1.0/24 -A fast -r ./log/snort-123@1016.log &lt;br /&gt;
This command deciphers the tcpdump-formatted log file ./log/snort-0123@1016.log and dumps the output in the normal Snort log format in the ./log directory. &lt;br /&gt;
&lt;br /&gt;
This kind of packet sniffing and analysis causes Snort to log all the packets on your network segment. But what if you wanted to log only certain type of packets. Yes, of course, there is a way out. Snort allows you to define your own rules for packet analysis. Use the '-c' command switch for this.&lt;br /&gt;
freeos:~ # snort -b -i eth0 -A fast -h 192.168.1.0/24  -s  -l ./log  -c ./rules.snort&lt;br /&gt;
For various rulesets that could be used along with Snort, take a look at &lt;a href="http://www.snort.org/snort_rules.html"&gt;http://www.snort.org/snort_rules.html&lt;/a&gt;.&lt;br /&gt;
Here ends our look at Snort. Following up will be another article that will help you ascertain the dangers that your system logs are prone to and the security measures you can put into place to prevent tampering of your precious system logs in case of a security breach.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Don't let life discourage you;&lt;br /&gt;
Everyone who got where he is&lt;br /&gt;
had to begin where he was.&lt;br /&gt;
-Richard L Evans&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-1904659782296968778?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nDFiR1tCGUlx9MzHng6-rfcbWWA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nDFiR1tCGUlx9MzHng6-rfcbWWA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nDFiR1tCGUlx9MzHng6-rfcbWWA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nDFiR1tCGUlx9MzHng6-rfcbWWA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/9VEDcENeQ-c" height="1" width="1"/&gt;</content><link rel="related" href="http://www.freeos.com/articles/3496/" title="Snort" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/1904659782296968778/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=1904659782296968778" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/1904659782296968778?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/1904659782296968778?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/9VEDcENeQ-c/snort.html" title="Snort" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/11/snort.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEGQHw5fip7ImA9WxNUEkk.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-1683324811881207104</id><published>2009-11-03T15:50:00.000+05:30</published><updated>2009-11-03T15:50:21.226+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-03T15:50:21.226+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><title>tmpwatch - removes files which haven't been accessed for a period of time</title><content type="html">&lt;b&gt;tmpwatch&lt;/b&gt; recursively removes files which haven't been accessed for a given number of hours. Normally, it's used to clean up directories which are used for temporary holding space such as /tmp. &lt;br /&gt;
When changing directories, &lt;b&gt;tmpwatch&lt;/b&gt; is very sensitive to possible race conditions and will exit with an error if one is detected. It does not follow symbolic links in the directories it's cleaning (even if a symbolic link is given as its argument), will not switch filesystems, &lt;br /&gt;
&amp;nbsp;and&amp;nbsp;only&amp;nbsp;removes&amp;nbsp;empty&amp;nbsp;directories&amp;nbsp;and&amp;nbsp;regular&amp;nbsp;files.&amp;nbsp; &lt;br /&gt;
By default, &lt;b&gt;tmpwatch&lt;/b&gt; dates files by their atime (access time), not their mtime (modification time). If files aren't being removed when &lt;b&gt;ls -l&lt;/b&gt; implies they should be, use &lt;b&gt;ls -u&lt;/b&gt; to examine their atime to see if that explains the problem. &lt;br /&gt;
If the --atime, --ctime or --mtime options are used in combination, the decision about deleting a file will be based on the maximum of this times. &lt;br /&gt;
The &lt;i&gt;hours&lt;/i&gt; parameter defines the threshold for removing files. If the file has not been accessed for &lt;i&gt;hours&lt;/i&gt; hours, the file is removed. Following this, one or more directories may be given for &lt;b&gt;tmpwatch&lt;/b&gt; to clean up. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="" name="lbAE"&gt;&amp;nbsp;&lt;/a&gt; &lt;br /&gt;
&lt;h2&gt;OPTIONS&lt;/h2&gt;&lt;dl compact="compact"&gt;&lt;dt&gt;&lt;b&gt;-u, --atime&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;Make the decision about deleting a file based on the file's atime (access time). This is the default.&lt;/dd&gt;&lt;dd&gt;&amp;nbsp;&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;-m, --mtime&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Make the decision about deleting a file based on the file's mtime (modification time) instead of the atime.  
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;-c, --ctime&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Make the decision about deleting a file based on the file's ctime (inode change time) instead of the atime; for directories, make the decision based on the mtime.  
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;-a, --all&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Remove all file types, not just regular files and directories.  
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;-d, --nodirs&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Do not attempt to remove directories, even if they are empty.  
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;-f, --force&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Remove files even if root doesn't have write access (akin to &lt;b&gt;rm -f&lt;/b&gt;).  
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;-t, --test&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Doesn't remove files, but goes through the motions of removing them. This implies &lt;b&gt;-v&lt;/b&gt;.  
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;-s, --fuser&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Attempt to use the "fuser" command to see if a file is already open before removing it.  Not enabled by default.   Does help in some circumstances, but not all.  Dependent on fuser being installed in /sbin.  
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;-v, --verbose&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Print a verbose display. Two levels of verboseness are available -- use this option twice to get the most verbose output.  
&lt;/dd&gt;&lt;/dl&gt;&lt;a href="" name="lbAF"&gt;&amp;nbsp;&lt;/a&gt; &lt;h2&gt;SEE ALSO&lt;/h2&gt;&lt;i&gt;&lt;a href="http://linux.about.com/od/commands/l/blcmdl8_cron.htm"&gt;cron&lt;/a&gt;&lt;/i&gt;(1),  &lt;i&gt;&lt;a href="http://linux.about.com/library/cmd/blcmdl1_ls.htm"&gt;ls&lt;/a&gt;&lt;/i&gt;(1),  &lt;i&gt;&lt;a href="http://linux.about.com/library/cmd/blcmdl1_rm.htm"&gt;rm&lt;/a&gt;&lt;/i&gt;(1),  &lt;i&gt;&lt;a href="http://linux.about.com/library/cmd/blcmdl1_fuser.htm"&gt;fuser&lt;/a&gt;&lt;/i&gt;(1)&lt;br /&gt;
&lt;dl compact="compact"&gt;&lt;dd&gt;&amp;nbsp;&lt;/dd&gt;&lt;dd&gt; 
&lt;/dd&gt;&lt;dd style="font-family: Arial,Helvetica,sans-serif;"&gt; &lt;span style="font-size: large;"&gt;
&lt;/span&gt;&lt;/dd&gt;&lt;dd style="font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: large;"&gt;Example:&lt;/span&gt;&lt;/dd&gt;&lt;dd style="text-align: left;"&gt;You may need to use a command called tmpwatch which removes files which haven’t been accessed for a period of time. Normally, it’s used to clean up directories which are used for temporary holding space such as /tmp.

Following code will remove all files/dirs from /tmp if they are not accessed in last 2 weeks (24  * 14 days = 336)
&lt;!-- BEGIN TEMPLATE: bbcode_code --&gt; &lt;div style="margin: 5px 20px 20px;"&gt;  &lt;div class="smallfont" style="margin-bottom: 2px;"&gt;Code:&lt;/div&gt;&lt;pre class="alt2" dir="ltr" style="border: 1px inset; height: 34px; margin: 0px; overflow: auto; padding: 6px; text-align: left; width: 640px;"&gt;tmpwatch --mtime --all 336 /tmp&lt;/pre&gt;&lt;/div&gt;&lt;/dd&gt;&lt;dd&gt;&amp;nbsp;&lt;/dd&gt;&lt;/dl&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-1683324811881207104?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/k5jvVCYNSjUffae50bC4JWV5af4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/k5jvVCYNSjUffae50bC4JWV5af4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/k5jvVCYNSjUffae50bC4JWV5af4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/k5jvVCYNSjUffae50bC4JWV5af4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/gbLDXTCUovk" height="1" width="1"/&gt;</content><link rel="related" href="http://linux.about.com/library/cmd/blcmdl8_tmpwatch.htm" title="tmpwatch - removes files which haven't been accessed for a period of time" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/1683324811881207104/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=1683324811881207104" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/1683324811881207104?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/1683324811881207104?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/gbLDXTCUovk/tmpwatch-removes-files-which-havent.html" title="tmpwatch - removes files which haven't been accessed for a period of time" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/11/tmpwatch-removes-files-which-havent.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8NQns9eyp7ImA9WxNVE0s.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-7341263031994207308</id><published>2009-10-24T11:43:00.001+05:30</published><updated>2009-10-24T11:44:53.563+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-24T11:44:53.563+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="email" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><title>Send an HTML email with embedded image and plain text alternate</title><content type="html">&lt;div id="content-header"&gt;&lt;h2&gt;Recipe 473810: Send an HTML email with embedded image and plain text alternate&lt;/h2&gt;&lt;/div&gt;&lt;br /&gt;
&lt;hr class="hide" /&gt;&lt;div id="content"&gt;&lt;br /&gt;
&lt;div id="description"&gt;HTML is the method of choice for those wishing to send emails with rich text, layout and graphics. Often it is desirable to embed the graphics within the message so recipients can display the message directly, without further downloads.&lt;br /&gt;
&lt;br /&gt;
Some mail agents don't support HTML or their users prefer to receive plain text messages. Senders of HTML messages should include a plain text message as an alternate for these users.&lt;br /&gt;
&lt;br /&gt;
This recipe sends a short HTML message with a single embedded image and an alternate plain text message.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div id="blocks"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="block"&gt;&lt;table class="codeblock-header"&gt;&lt;tbody&gt;
&lt;tr&gt;         &lt;td class="codeblock-title"&gt;&lt;/td&gt;         &lt;td class="codeblock-lang"&gt;Python&lt;br /&gt;
&lt;/td&gt;        &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class="codeblock"&gt;&lt;table class="highlighttable"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class="linenos"&gt;&lt;pre&gt;1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46&lt;/pre&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;div class="highlight"&gt;&lt;pre&gt;# Send an HTML email with an embedded image and a plain text message for
# email clients that don't want to display the HTML.

from email.MIMEMultipart import MIMEMultipart

from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage

# Define these once; use them twice!
strFrom = 'from@example.com'
strTo = 'to@example.com'

# Create the root message and fill in the from, to, and subject headers

msgRoot = MIMEMultipart('related')
msgRoot['Subject'] = 'test message'

msgRoot['From'] = strFrom
msgRoot['To'] = strTo

msgRoot.preamble = 'This is a multi-part message in MIME format.'

# Encapsulate the plain and HTML versions of the message body in an
# 'alternative' part, so message agents can decide which they want to display.
msgAlternative = MIMEMultipart('alternative')

msgRoot.attach(msgAlternative)

msgText = MIMEText('This is the alternative plain text message.')

msgAlternative.attach(msgText)

# We reference the image in the IMG SRC attribute by the ID we give it below
msgText = MIMEText('&amp;lt;b&amp;gt;Some &amp;lt;i&amp;gt;HTML&amp;lt;/i&amp;gt; text&amp;lt;/b&amp;gt; and an image.&amp;lt;br&amp;gt;&amp;lt;img src="cid:image1"&amp;gt;&amp;lt;br&amp;gt;Nifty!', 'html')

msgAlternative.attach(msgText)

# This example assumes the image is in the current directory
fp = open('test.jpg', 'rb')

msgImage = MIMEImage(fp.read())
fp.close()

# Define the image's ID as referenced above
msgImage.add_header('Content-ID', '&amp;lt;image1&amp;gt;')
msgRoot.attach(msgImage)

# Send the email (this example assumes SMTP authentication is required)
import smtplib
smtp = smtplib.SMTP()
smtp.connect('smtp.example.com')

smtp.login('exampleuser', 'examplepass')
smtp.sendmail(strFrom, strTo, msgRoot.as_string())

smtp.quit()
&lt;/pre&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="block"&gt;&lt;br /&gt;
&lt;h3&gt;Discussion&lt;/h3&gt;&lt;br /&gt;
&lt;div class="proseblock"&gt;&lt;br /&gt;
While the practice of embedding images within the message provides a better experience for many users than linking to web-hosted images does it is important to consider the impact this has on message size and consequently on message download time.&lt;br /&gt;
&lt;br /&gt;
An alternative implementation for sending HTML messages is provided in this recipe &lt;a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/67083" rel="nofollow"&gt;http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/67083&lt;/a&gt;, though it doesn't address embedding images and was written before the email package was incorporated  into Python. The email package and its MIME-handling capabilities significantly reduce the amount of code required.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-7341263031994207308?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_6yNKYEHQ2EWMyTWRwa6t6UZ-a4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_6yNKYEHQ2EWMyTWRwa6t6UZ-a4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_6yNKYEHQ2EWMyTWRwa6t6UZ-a4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_6yNKYEHQ2EWMyTWRwa6t6UZ-a4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/Y8pqO7Xt8jU" height="1" width="1"/&gt;</content><link rel="related" href="http://code.activestate.com/recipes/473810/" title="Send an HTML email with embedded image and plain text alternate" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/7341263031994207308/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=7341263031994207308" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/7341263031994207308?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/7341263031994207308?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/Y8pqO7Xt8jU/send-html-email-with-embedded-image-and.html" title="Send an HTML email with embedded image and plain text alternate" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/10/send-html-email-with-embedded-image-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MNQnY-eyp7ImA9WxNXGUU.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-3359228504506156016</id><published>2009-10-08T12:33:00.001+05:30</published><updated>2009-10-08T12:34:53.853+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-08T12:34:53.853+05:30</app:edited><title>CAPTCHA: "Completely Automated Public Turing test to Tell Computers and Humans Apart"</title><content type="html">&lt;h1&gt;CAPTCHA: Telling Humans and Computers Apart Automatically&lt;br /&gt;
&lt;/h1&gt;&lt;br /&gt;
&lt;h1&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-weight: normal;"&gt;A CAPTCHA is a program that protects websites against bots by generating and grading tests that humans can pass but current computer programs cannot. For example, humans can read distorted text as the one shown below, but current computer programs can't:&lt;/span&gt;&lt;/span&gt; &lt;/h1&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_GciOeVn_TLE/Ss2DUZ8bCcI/AAAAAAAADHU/0cbR_rW4-fg/s1600-h/Captchas.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_GciOeVn_TLE/Ss2DUZ8bCcI/AAAAAAAADHU/0cbR_rW4-fg/s320/Captchas.png" /&gt;&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The term CAPTCHA (for Completely Automated Public Turing Test To Tell Computers and Humans Apart) was  coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas Hopper and John Langford of Carnegie Mellon University.&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h1&gt;&lt;a href="http://recaptcha.net/whyrecaptcha.html" style="font-weight: bold; text-decoration: none;"&gt;Get a Free CAPTCHA For  Your Site&lt;/a&gt;&lt;/h1&gt;&lt;br /&gt;
A free, secure and accessible CAPTCHA implementation is available from the &lt;a href="http://recaptcha.net/whyrecaptcha.html"&gt;&lt;b&gt;reCAPTCHA project&lt;/b&gt;&lt;/a&gt;. Easy to install plugins and controls are  available for &lt;a href="http://recaptcha.net/plugins/wordpress/" title="WordPress CAPTCHA"&gt; WordPress&lt;/a&gt;, &lt;a href="http://recaptcha.net/plugins/mediawiki/" title="MediaWiki CAPTCHA"&gt; MediaWiki&lt;/a&gt;, &lt;a href="http://recaptcha.net/plugins/php/" title="PHP CAPTCHA"&gt;PHP&lt;/a&gt;,  &lt;a href="http://recaptcha.net/plugins/aspnet/" title="ASP CAPTCHA"&gt;ASP.NET&lt;/a&gt;, Perl, Python, Java, and many other environments. reCAPTCHA also comes with an audio test to ensure that blind users can freely navigate your site. reCAPTCHA is our officially recommended CAPTCHA implementation. &lt;br /&gt;
&lt;h1&gt;Test Drive a CAPTCHA&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://recaptcha.net/learnmore.html"&gt;&lt;b&gt;reCAPTCHA&lt;/b&gt;&lt;/a&gt;. Stop spam and help digitize books at the same time!  The words shown come directly from old books that are being digitized.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://server251.theory.cs.cmu.edu/cgi-bin/sq-pix"&gt;&lt;b&gt;SQUIGL-PIX&lt;/b&gt;&lt;/a&gt;. Our newest CAPTCHA! &lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://server251.theory.cs.cmu.edu/cgi-bin/esp-pix/esp-pix"&gt;&lt;b&gt;ESP-PIX&lt;/b&gt;&lt;/a&gt;. A CAPTCHA script that's close to our hearts. Instead of typing  letters, you authenticate yourself as a human by recognizing what object is common in a set of images. This was the first example of a CAPTCHA based on image recognition.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Below is an example for Embedding a sample Captcha in a CGi FIle.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: left;"&gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&lt;br /&gt;
######### don't change the following three lines: ###########&lt;br /&gt;
import cgi&lt;br /&gt;
import cgitb;cgitb.enable()&lt;br /&gt;
import time&lt;br /&gt;
from recaptcha.client import captcha&lt;br /&gt;
&lt;br /&gt;
publickey = "&amp;lt;publickey&amp;gt;"&lt;br /&gt;
privatekey = "&amp;lt;privatekey&amp;gt;"&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print "Content-Type: text/html\n\n"&lt;br /&gt;
print '''&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;NO BOTS&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;form action="&amp;lt;ur cgi validator&amp;gt;" method="post"&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Prove you are not a BOT&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;script type="text/javascript" src="http://api.recaptcha.net/challenge?k=''' + publickey + '''"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;noscript&amp;gt;&lt;br /&gt;
&amp;lt;iframe src="http://api.recaptcha.net/noscript?k=''' + publickey + '''" height="300" width="500" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;textarea name="recaptcha_challenge_field" rows="3" cols="40"&amp;gt;&lt;br /&gt;
&amp;lt;/textarea&amp;gt;&lt;br /&gt;
&amp;lt;input type="hidden" name="recaptcha_response_field" value="manual_challenge"&amp;gt;&lt;br /&gt;
&amp;lt;/noscript&amp;gt;&lt;br /&gt;
&amp;lt;input type = "submit" value = "Go"&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;b&gt;Below is an example for validating a Captcha in a CGi FIle.&lt;/b&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&lt;br /&gt;
######### don't change the following three lines: ###########&lt;br /&gt;
import cgi&lt;br /&gt;
import cgitb;cgitb.enable()&lt;br /&gt;
import time&lt;br /&gt;
from recaptcha.client import captcha&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
publickey = "&amp;lt;publickey&amp;gt;"&lt;br /&gt;
privatekey = "&amp;lt;privatekey&amp;gt;"&lt;br /&gt;
&lt;br /&gt;
print "Content-Type: text/html\n\n"&lt;br /&gt;
form = cgi.FieldStorage()&lt;br /&gt;
&lt;br /&gt;
response = captcha.submit(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; form.getvalue("recaptcha_challenge_field"),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; form.getvalue('recaptcha_response_field'),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; privatekey,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "192.168.20.68",&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;
&lt;br /&gt;
if not response.is_valid:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print '''&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;html&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;head&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;U BOTS&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;body&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;form action="&amp;lt;cgi captcha validator&amp;gt;" method="post"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h2&amp;gt;YOU ARE A BOT!!!!!!!!!!!!!!&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3&amp;gt;Else Try Again&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script type="text/javascript" src="http://api.recaptcha.net/challenge?k=''' + publickey + '''"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;noscript&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;iframe src="http://api.recaptcha.net/noscript?k=''' + publickey + '''" height="300" width="500" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;textarea name="recaptcha_challenge_field" rows="3" cols="40"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/textarea&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input type="hidden" name="recaptcha_response_field" value="manual_challenge"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/noscript&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input type = "submit" value = "Go"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '''&lt;br /&gt;
else:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print '''&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;html&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;head&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;Hurray ur not a BOT &amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;body&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;form action="&amp;lt;cgi captcha validator&amp;gt;" method="post"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h2&amp;gt;Hurray!!!!!!!!!!!!!!&amp;lt;br&amp;gt; :) you are A Human ;-)&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h3&amp;gt;You can Try Again Human&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script type="text/javascript" src="http://api.recaptcha.net/challenge?k=''' + publickey + '''"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;noscript&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;iframe src="http://api.recaptcha.net/noscript?k=''' + publickey + '''" height="300" width="500" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;textarea name="recaptcha_challenge_field" rows="3" cols="40"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/textarea&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input type="hidden" name="recaptcha_response_field" value="manual_challenge"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/noscript&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input type = "submit" value = "Go"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '''&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;h1&gt;&lt;/h1&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-3359228504506156016?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cXkl4qoYkUUZu0okBdbObP9mql0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cXkl4qoYkUUZu0okBdbObP9mql0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cXkl4qoYkUUZu0okBdbObP9mql0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cXkl4qoYkUUZu0okBdbObP9mql0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/lSaGMthdlrQ" height="1" width="1"/&gt;</content><link rel="related" href="http://www.captcha.net/" title="CAPTCHA: &quot;Completely Automated Public Turing test to Tell Computers and Humans Apart&quot;" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/3359228504506156016/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=3359228504506156016" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/3359228504506156016?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/3359228504506156016?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/lSaGMthdlrQ/captcha-completely-automated-public.html" title="CAPTCHA: &quot;Completely Automated Public Turing test to Tell Computers and Humans Apart&quot;" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_GciOeVn_TLE/Ss2DUZ8bCcI/AAAAAAAADHU/0cbR_rW4-fg/s72-c/Captchas.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/10/captcha-completely-automated-public.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQMQnY8fip7ImA9WxNTF0o.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-8995719514398093942</id><published>2009-08-20T16:26:00.011+05:30</published><updated>2009-08-20T18:16:23.876+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-20T18:16:23.876+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VPN" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="Certificates" /><title>Introduction to Public-Key Cryptography</title><content type="html">&lt;center&gt;&lt;h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;
&lt;a &gt;  Introduction to Public-Key Cryptography
&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;/center&gt; 
Public-key cryptography and related standards and techniques underlie security features of many Netscape products, including signed and encrypted email, form signing, object signing, single sign-on, and the Secure Sockets Layer (SSL) protocol. This document introduces the basic concepts of public-key cryptography
&lt;h4&gt; Internet Security Issues &lt;/h4&gt;
&lt;h4&gt;Encryption and Decryption&lt;/h4&gt;
&lt;h4&gt;Digital Signatures&lt;/h4&gt;
&lt;h4&gt;Certificates and Authentication&lt;/h4&gt;
&lt;h4&gt;Managing Certificates&lt;/h4&gt;

&lt;a&gt;   Internet Security Issues&lt;/a&gt;
&lt;span&gt;All communication over the Internet uses the Transmission Control Protocol/Internet Protocol (TCP/IP). TCP/IP allows information to be sent from one computer to another through a variety of intermediate computers and separate networks before it reaches its destination. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;The great flexibility of TCP/IP has led to its worldwide acceptance as the basic Internet and intranet communications protocol. At the same time, the fact that TCP/IP allows information to pass through intermediate computers makes it possible for a third party to interfere with communications in the following ways:&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; &lt;b&gt;Eavesdropping.&lt;/b&gt; Information remains intact, but its privacy is compromised. For example, someone could learn your credit card number, record a sensitive conversation, or intercept classified information. &lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;b&gt;Tampering.&lt;/b&gt; Information in transit is changed or replaced and then sent on to the recipient. For example, someone could alter an order for goods or change a person's resume.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;b&gt;Impersonation.&lt;/b&gt; Information passes to a person who poses as the intended recipient. Impersonation can take two forms: &lt;/li&gt; &lt;/span&gt;&lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; &lt;b&gt;Spoofing.&lt;/b&gt; A person can pretend to be someone else. For example, a person can pretend to have the email address &lt;/li&gt;&lt;/span&gt;&lt;code&gt;&lt;a&gt;jdoe@mozilla.com&lt;/a&gt;&lt;/code&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;, or a computer can identify itself as a site called &lt;/span&gt;&lt;code&gt;www.mozilla.com&lt;/code&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; when it is not. This type of impersonation is known as spoofing&lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;. &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; &lt;b&gt;Misrepresentation.&lt;/b&gt; A person or organization can misrepresent itself. For example, suppose the site &lt;/li&gt;&lt;/span&gt;&lt;code&gt;&lt;a&gt;www.mozilla.com&lt;/a&gt;&lt;/code&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; pretends to be a furniture store when it is really just a site that takes credit-card payments but never sends any goods&lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;. &lt;/span&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; Normally, users of the many cooperating computers that make up the Internet or other networks don't monitor or interfere with the network traffic that continuously passes through their machines. However, many sensitive personal and business communications over the Internet require precautions that address the threats listed above. Fortunately, a set of well-established techniques and standards known as &lt;b&gt;public-key cryptography &lt;/b&gt;make it relatively easy to take such precautions. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;h4&gt;Public-key cryptography facilitates the following tasks:&lt;/h4&gt;&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;b&gt;Encryption and decryption&lt;/b&gt; allow two communicating parties to disguise information they send to each other. The sender encrypts, or scrambles, information before sending it. The receiver decrypts, or unscrambles, the information after receiving it. While in transit, the encrypted information is unintelligible to an intruder.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;b&gt;Tamper detection&lt;/b&gt; allows the recipient of information to verify that it has not been modified in transit. Any attempt to modify data or substitute a false message for a legitimate one will be detected.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;b&gt;Authentication&lt;/b&gt; allows the recipient of information to determine its origin--that is, to confirm the sender's identity.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;b&gt;Nonrepudiation&lt;/b&gt; prevents the sender of information from claiming at a later date that the information was never sent. &lt;/li&gt; &lt;/span&gt;&lt;/ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;The sections that follow introduce the concepts of public-key cryptography that underlie these capabilities.&lt;/span&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;hr noshade="noshade"  style="font-size:78%;"&gt;&lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;
&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; Encryption and Decryption&lt;/span&gt;&lt;/h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;Encryption is the process of transforming information so it is unintelligible to anyone but the intended recipient. Decryption is the process of transforming encrypted information so that it is intelligible again. A &lt;b&gt;cryptographic algorithm,&lt;/b&gt; also called a &lt;b&gt;cipher,&lt;/b&gt; is a mathematical function used for encryption or decryption. In most cases, two related functions are employed, one for encryption and the other for decryption.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; With most modern cryptography, the ability to keep encrypted information secret is based not on the cryptographic algorithm, which is widely known, but on a number called a &lt;b&gt;key&lt;/b&gt; that must be used with the algorithm to produce an encrypted result or to decrypt previously encrypted information. Decryption with the correct key is simple. Decryption without the correct key is very difficult, and in some cases impossible for all practical purposes. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;The sections that follow introduce the use of keys for encryption and decryption.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Symmetric-Key Encryption
Public-Key Encryption
Key Length and Encryption Strength&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  Symmetric-Key Encryption &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;With &lt;b&gt;symmetric-key encryption,&lt;/b&gt; the encryption key can be calculated from the decryption key and vice versa. With most symmetric algorithms, the same key is used for both encryption and decryption, as shown in Figure 1.&lt;/span&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;Figure 1     Symmetric-key encryption&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GciOeVn_TLE/So0sVtjn4FI/AAAAAAAADFo/cSTwFeSJZ9g/s1600-h/05scrypt.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 89px;" src="http://1.bp.blogspot.com/_GciOeVn_TLE/So0sVtjn4FI/AAAAAAAADFo/cSTwFeSJZ9g/s320/05scrypt.gif" alt="" id="BLOGGER_PHOTO_ID_5371998682040754258" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt;Implementations of symmetric-key encryption can be highly efficient, so that users do not experience any significant time delay as a result of the encryption and decryption. Symmetric-key encryption also provides a degree of authentication, since information encrypted with one symmetric key cannot be decrypted with any other symmetric key. Thus, as long as the symmetric key is kept secret by the two parties using it to encrypt communications, each party can be sure that it is communicating with the other as long as the decrypted messages continue to make sense.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Symmetric-key encryption is effective only if the symmetric key is kept secret by the two parties involved. If anyone else discovers the key, it affects both confidentiality and authentication. A person with an unauthorized symmetric key not only can decrypt messages sent with that key, but can encrypt new messages and send them as if they came from one of the two parties who were originally using the key.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Symmetric-key encryption plays an important role in the SSL protocol, which is widely used for authentication, tamper detection, and encryption over TCP/IP networks. SSL also uses techniques of public-key encryption, which is described in the next section.&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;Public-Key Encryption &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;The most commonly used implementations of public-key encryption are based on algorithms patented by RSA Data Security. Therefore, this section describes the RSA approach to public-key encryption. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Public-key encryption&lt;/b&gt; (also called &lt;b&gt;asymmetric encryption&lt;/b&gt;) involves a pair of keys--a &lt;b&gt;public key&lt;/b&gt; and a &lt;b&gt;private key&lt;/b&gt;--associated with an entity that needs to authenticate its identity electronically or to sign or encrypt data. Each public key is published, and the corresponding private key is kept secret. (For more information about the way public keys are published, see Certificates and Authentication) Data encrypted with your public key can be decrypted only with your private key. Figure 2 shows a simplified view of the way public-key encryption works. &lt;/span&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Figure 2     Public-key encryption &lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GciOeVn_TLE/So0s6eZSYjI/AAAAAAAADFw/Y3oLghNxbOc/s1600-h/05scrypt.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 89px;" src="http://3.bp.blogspot.com/_GciOeVn_TLE/So0s6eZSYjI/AAAAAAAADFw/Y3oLghNxbOc/s320/05scrypt.gif" alt="" id="BLOGGER_PHOTO_ID_5371999313626030642" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt; The scheme shown in Figure 2 lets you freely distribute a public key, and only you will be able to read data encrypted using this key. In general, to send encrypted data to someone, you encrypt the data with that person's public key, and the person receiving the encrypted data decrypts it with the corresponding private key. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Compared with symmetric-key encryption, public-key encryption requires more computation and is therefore not always appropriate for large amounts of data. However, it's possible to use public-key encryption to send a symmetric key, which can then be used to encrypt additional data. This is the approach used by the SSL protocol.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;As it happens, the reverse of the scheme shown in Figure 2 also works: data encrypted with your private key can be decrypted only with your public key. This would not be a desirable way to encrypt sensitive data, however, because it means that anyone with your public key, which is by definition published, could decrypt the data. Nevertheless, private-key encryption is useful, because it means you can use your private key to sign data with your digital signature--an important requirement for electronic commerce and other commercial applications of cryptography. Client software such as Communicator can then use your public key to confirm that the message was signed with your private key and that it hasn't been tampered with since being signed. 
Digital Signatures and subsequent sections describe how this confirmation process works. &lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt; Key Length and Encryption Strength&lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;In general, the strength of encryption is related to the difficulty of discovering the key, which in turn depends on both the cipher used and the length of the key. For example, the difficulty of discovering the key for the RSA cipher most commonly used for public-key encryption depends on the difficulty of factoring large numbers, a well-known mathematical problem. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Encryption strength is often described in terms of the size of the keys used to perform the encryption: in general, longer keys provide stronger encryption. Key length is measured in bits. For example, 128-bit keys for use with the RC4 symmetric-key cipher supported by SSL provide significantly better cryptographic protection than 40-bit keys for use with the same cipher. Roughly speaking, 128-bit RC4 encryption is 3 x 10&lt;sup&gt;26&lt;/sup&gt; times stronger than 40-bit RC4 encryption. (For more information about RC4 and other ciphers used with SSL, see Introduction to SSL.)&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Different ciphers may require different key lengths to achieve the same level of encryption strength. The RSA cipher used for public-key encryption, for example, can use only a subset of all possible values for a key of a given length, due to the nature of the mathematical problem on which it is based. Other ciphers, such as those used for symmetric key encryption, can use all possible values for a key of a given length, rather than a subset of those values. Thus a 128-bit key for use with a symmetric-key encryption cipher would provide stronger encryption than a 128-bit key for use with the RSA public-key encryption cipher. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;This difference explains why the RSA public-key encryption cipher must use a 512-bit key (or longer) to be considered cryptographically strong, whereas symmetric key ciphers can achieve approximately the same level of strength with a 64-bit key. Even this level of strength may be vulnerable to attacks in the near future.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Because the ability to surreptitiously intercept and decrypt encrypted information has historically been a significant military asset, the U.S. Government restricts export of cryptographic software, including most software that permits use of symmetric encryption keys longer than 40 bits. For detailed information about these restrictions as they apply to Netscape products, see &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/exprt/index.html" target="_top"&gt;Export Restrictions on International Sales&lt;/a&gt;. &lt;/span&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#top"&gt;[Top]&lt;/a&gt;&lt;/span&gt;&lt;hr noshade="noshade"  style="font-size:78%;"&gt;&lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;
&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Digital Signatures"&gt;&lt;/a&gt; Digital Signatures&lt;/span&gt;&lt;/h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; Encryption and decryption address the problem of eavesdropping, one of the three Internet security issues mentioned at the beginning of this document. But encryption and decryption, by themselves, do not address the other two problems mentioned in &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1041271"&gt;Internet Security Issues&lt;/a&gt;: tampering and impersonation. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;This section describes how public-key cryptography addresses the problem of tampering. The sections that follow describe how it addresses the problem of impersonation&lt;/a&gt;.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Tamper detection and related authentication techniques rely on a mathematical function called a &lt;b&gt;one-way hash &lt;/b&gt;(also called a &lt;b&gt;message digest&lt;/b&gt;). A one-way hash is a number of fixed length with the following characteristics:&lt;/a&gt;&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The value of the hash is unique for the hashed data. Any change in the data, even deleting or altering a single character, results in a different value.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The content of the hashed data cannot, for all practical purposes, be deduced from the hash--which is why it is called "one-way."&lt;/li&gt; &lt;/span&gt;&lt;/ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; As mentioned in &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1016376"&gt;Public-Key Encryption&lt;/a&gt;, it's possible to use your private key for encryption and your public key for decryption. Although this is not desirable when you are encrypting sensitive information, it is a crucial part of digitally signing any data. Instead of encrypting the data itself, the signing software creates a one-way hash of the data, then uses your private key to encrypt the hash. The encrypted hash, along with other information, such as the hashing algorithm, is known as a &lt;b&gt;digital signature.&lt;/b&gt; &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1047373"&gt;Figure 3&lt;/a&gt; shows a simplified view of the way a digital signature can be used to validate the integrity of signed data.&lt;/span&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;Figure 3     Using a digital signature to validate data integrity&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_GciOeVn_TLE/So0uZ1bBxaI/AAAAAAAADF4/EGjUjXmLeBY/s1600-h/04digsgn.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 306px; height: 138px;" src="http://4.bp.blogspot.com/_GciOeVn_TLE/So0uZ1bBxaI/AAAAAAAADF4/EGjUjXmLeBY/s320/04digsgn.gif" alt="" id="BLOGGER_PHOTO_ID_5372000951894918562" border="0" /&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;   
Figure 3 shows two items transferred to the recipient of some signed data: the original data and the digital signature, which is basically a one-way hash (of the original data) that has been encrypted with the signer's private key. To validate the integrity of the data, the receiving software first uses the signer's public key to decrypt the hash. It then uses the same hashing algorithm that generated the original hash to generate a new one-way hash of the same data. (Information about the hashing algorithm used is sent with the digital signature, although this isn't shown in the figure.) Finally, the receiving software compares the new hash against the original hash. If the two hashes match, the data has not changed since it was signed. If they don't match, the data may have been tampered with since it was signed, or the signature may have been created with a private key that doesn't correspond to the public key presented by the signer.&lt;span style="font-family:Arial,Helvetica;"&gt;
 If the two hashes match, the recipient can be certain that the public key used to decrypt the digital signature corresponds to the private key used to create the digital signature. Confirming the identity of the signer, however, also requires some way of confirming that the public key really belongs to a particular person or other entity. For a discussion of the way this works, see Certificates and Authentication.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;The significance of a digital signature is comparable to the significance of a handwritten signature. Once you have signed some data, it is difficult to deny doing so later--assuming that the private key has not been compromised or out of the owner's control. This quality of digital signatures provides a high degree of nonrepudiation--that is, digital signatures make it difficult for the signer to deny having signed the data. In some situations, a digital signature may be as legally binding as a handwritten signature&lt;/a&gt;.&lt;/span&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#top"&gt;[Top]&lt;/a&gt;&lt;/span&gt;&lt;hr noshade="noshade"  style="font-size:78%;"&gt;&lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;
&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Certificates and Authentication"&gt;&lt;/a&gt;  Certificates and Authentication&lt;/a&gt; &lt;/span&gt;&lt;/h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044272"&gt;A Certificate Identifies Someone or Something&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1045678"&gt;Authentication Confirms an Identity&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1046108"&gt;How Certificates Are Used&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044330"&gt;Contents of a Certificate&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1052613"&gt;How CA Certificates Are Used to Establish Trust&lt;/a&gt;&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt;  A Certificate Identifies Someone or Something &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; A &lt;b&gt;certificate&lt;/b&gt; is an electronic document used to identify an individual, a server, a company, or some other entity and to associate that identity with a public key. Like a driver's license, a passport, or other commonly used personal IDs, a certificate provides generally recognized proof of a person's identity. Public-key cryptography uses certificates to address the problem of impersonation (see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1041271"&gt;Internet Security Issues&lt;/a&gt;).&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; To get a driver's license, you typically apply to a government agency, such as the Department of Motor Vehicles, which verifies your identity, your ability to drive, your address, and other information before issuing the license. To get a student ID, you apply to a school or college, which performs different checks (such as whether you have paid your tuition) before issuing the ID. To get a library card, you may need to provide only your name and a utility bill with your address on it.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Certificates work much the same way as any of these familiar forms of identification. &lt;b&gt;Certificate authorities (CAs)&lt;/b&gt; are entities that validate identities and issue certificates. They can be either independent third parties or organizations running their own certificate-issuing server software (such as Netscape Certificate Server). The methods used to validate an identity vary depending on the policies of a given CA--just as the methods to validate other forms of identification vary depending on who is issuing the ID and the purpose for which it will be used. In general, before issuing a certificate, the CA must use its published verification procedures for that type of certificate to ensure that an entity requesting a certificate is in fact who it claims to be. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; The certificate issued by the CA binds a particular public key to the name of the entity the certificate identifies (such as the name of an employee or a server). Certificates help prevent the use of fake public keys for impersonation. Only the public key certified by the certificate will work with the corresponding private key possessed by the entity identified by the certificate. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; In addition to a public key, a certificate always includes the name of the entity it identifies, an expiration date, the name of the CA that issued the certificate, a serial number, and other information. Most importantly, a certificate always includes the digital signature of the issuing CA. The CA's digital signature allows the certificate to function as a "letter of introduction" for users who know and trust the CA but don't know the entity identified by the certificate.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; For more information about the role of CAs, see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1052613"&gt;How CA Certificates Are Used to Establish Trust&lt;/a&gt;. &lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt;  Authentication Confirms an Identity &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;Authentication&lt;/b&gt; is the process of confirming an identity. In the context of network interactions, authentication involves the confident identification of one party by another party. Authentication over networks can take many forms. Certificates are one way of supporting authentication.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Network interactions typically take place between a client, such as browser software running on a personal computer, and a server&lt;b&gt;,&lt;/b&gt; such as the software and hardware used to host a Web site. &lt;b&gt;Client authentication&lt;/b&gt; refers to the confident identification of a client by a server (that is, identification of the person assumed to be using the client software). &lt;b&gt;Server authentication&lt;/b&gt; refers to the confident identification of a server by a client (that is, identification of the organization assumed to be responsible for the server at a particular network address). &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Client and server authentication are not the only forms of authentication that certificates support. For example, the digital signature on an email message, combined with the certificate that identifies the sender, provide strong evidence that the person identified by that certificate did indeed send that message. Similarly, a digital signature on an HTML form, combined with a certificate that identifies the signer, can provide evidence, after the fact, that the person identified by that certificate did agree to the contents of the form. In addition to authentication, the digital signature in both cases ensures a degree of nonrepudiation--that is, a digital signature makes it difficult for the signer to claim later not to have sent the email or the form&lt;/a&gt;.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Client authentication is an essential element of network security within most intranets or extranets. The sections that follow contrast two forms of client authentication:&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051881"&gt;Password-Based Authentication&lt;/a&gt;. Almost all server software permits client authentication by means of a name and password. For example, a server might require a user to type a name and password before granting access to the server. The server maintains a list of names and passwords; if a particular name is on the list, and if the user types the correct password, the server grants access.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051902"&gt;Certificate-Based Authentication&lt;/a&gt;. Client authentication based on certificates is part of the SSL protocol. The client digitally signs a randomly generated piece of data and sends both the certificate and the signed data across the network. The server uses techniques of public-key cryptography to validate the signature and confirm the validity of the certificate. &lt;/li&gt; &lt;/span&gt;&lt;/ul&gt; &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt;  Password-Based Authentication &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051893"&gt;Figure 4&lt;/a&gt; shows the basic steps involved in authenticating a client by means of a name and password. Figure 4 assumes the following:&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The user has already decided to trust the server, either without authentication or on the basis of server authentication via SSL.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;The user has requested a resource controlled by the server.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;The server requires client authentication before permitting access to the requested resource&lt;/a&gt;.&lt;/li&gt; &lt;/span&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;Figure 4     Using a password to authenticate a client to a server&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GciOeVn_TLE/So0vRhVIkCI/AAAAAAAADGA/GN3Ie-oH2M0/s1600-h/04digsgn.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 171px;" src="http://2.bp.blogspot.com/_GciOeVn_TLE/So0vRhVIkCI/AAAAAAAADGA/GN3Ie-oH2M0/s400/04digsgn.gif" alt="" id="BLOGGER_PHOTO_ID_5372001908574162978" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;  &lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt; These are the steps shown in Figure 4:&lt;/span&gt; &lt;ol&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; In response to an authentication request from the server, the client displays a dialog box requesting the user's name and password for that server. The user must supply a name and password separately for each new server the user wishes to use during a work session.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The client sends the name and password across the network, either in the clear or over an encrypted SSL connection.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The server looks up the name and password in its local password database and, if they match, accepts them as evidence authenticating the user's identity&lt;/a&gt;.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The server determines whether the identified user is permitted to access the requested resource, and if so allows the client to access it.&lt;/li&gt; &lt;/span&gt;&lt;/ol&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; With this arrangement, the user must supply a new password for each server, and the administrator must keep track of the name and password for each user, typically on separate servers.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; As shown in the next section, one of the advantages of certificate-based authentication is that it can be used to replace the first three steps in Figure 2 with a mechanism that allows the user to supply just one password (which is not sent across the network) and allows the administrator to control user authentication centrally.&lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt; Certificate-Based Authentication&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;
&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051918"&gt;Figure 5&lt;/a&gt; shows how client authentication works using certificates and the &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1053298"&gt;SSL Protocol&lt;/a&gt;. To authenticate a user to a server, a client digitally signs a randomly generated piece of data and sends both the certificate and the signed data across the network. For the purposes of this discussion, the digital signature associated with some data can be thought of as evidence provided by the client to the server. The server authenticates the user's identity on the strength of this evidence.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Like &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051893"&gt;Figure 4&lt;/a&gt;, &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051918"&gt;Figure 5&lt;/a&gt; assumes that the user has already decided to trust the server and has requested a resource, and that the server has requested client authentication in the process of evaluating whether to grant access to the requested resource. &lt;/span&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;Figure 5     Using a certificate to authenticate a client to a server&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GciOeVn_TLE/So0vx5zMHqI/AAAAAAAADGI/Hc8BmzKOEoI/s1600-h/04digsgn.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 211px;" src="http://3.bp.blogspot.com/_GciOeVn_TLE/So0vx5zMHqI/AAAAAAAADGI/Hc8BmzKOEoI/s400/04digsgn.gif" alt="" id="BLOGGER_PHOTO_ID_5372002464898490018" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt; Unlike the process shown in Figure 4, the process shown in Figure 5 requires the use of SSL. Figure 5 also assumes that the client has a valid certificate that can be used to identify the client to the server. Certificate-based authentication is generally considered preferable to password-based authentication because it is based on what the user has (the private key) as well as what the user knows (the password that protects the private key). However, it's important to note that these two assumptions are true only if unauthorized personnel have not gained access to the user's machine or password, the password for the client software's private key database has been set, and the software is set up to request the password at reasonably frequent intervals. &lt;/span&gt; &lt;blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;Important  &lt;/b&gt; Neither password-based authentication nor certificate-based authentication address  security issues related to physical access to individual machines or passwords. Public- key cryptography can only verify that a private key used to sign some data  corresponds to the public key in a certificate. It is the user's responsibility to protect a  machine's physical security and to keep the private-key password secret.  &lt;/span&gt;&lt;/blockquote&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;These are the steps shown in Figure 3:&lt;/a&gt;&lt;/span&gt; &lt;ol&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The client software, such as Communicator, maintains a database of the private keys that correspond to the public keys published in any certificates issued for that client. The client asks for the password to this database the first time the client needs to access it during a given session--for example, the first time the user attempts to access an SSL-enabled server that requires certificate-based client authentication. After entering this password once, the user doesn't need to enter it again for the rest of the session, even when accessing other SSL-enabled servers.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The client unlocks the private-key database, retrieves the private key for the user's certificate, and uses that private key to digitally sign some data that has been randomly generated for this purpose on the basis of input from both the client and the server. This data and the digital signature constitute "evidence" of the private key's validity. The digital signature can be created only with that private key and can be validated with the corresponding public key against the signed data, which is unique to the SSL session&lt;/a&gt;.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The client sends both the user's certificate and the evidence (the randomly generated piece of data that has been digitally signed) across the network. &lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;The server uses the certificate and the evidence to authenticate the user's identity. (For a detailed discussion of the way this works, see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/sslin/index.html" target="_top"&gt;Introduction to SSL&lt;/a&gt;.)&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;At this point the server may optionally perform other authentication tasks, such as checking that the certificate presented by the client is stored in the user's entry in an LDAP directory. The server then continues to evaluate whether the identified user is permitted to access the requested resource. This evaluation process can employ a variety of standard authorization mechanisms, potentially using additional information in an LDAP directory, company databases, and so on. If the result of the evaluation is positive, the server allows the client to access the requested resource. &lt;/li&gt; &lt;/span&gt;&lt;/ol&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1051940"&gt; As you can see by comparing &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051918"&gt;Figure 5&lt;/a&gt; to &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051893"&gt;Figure 4&lt;/a&gt;, certificates replace the authentication portion of the interaction between the client and the server. Instead of requiring a user to send passwords across the network throughout the day, single sign-on requires the user to enter the private-key database password just once, without sending it across the network. For the rest of the session, the client presents the user's certificate to authenticate the user to each new server it encounters. Existing authorization mechanisms based on the authenticated user identity are not affected. &lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt;  How Certificates Are Used&lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1046166"&gt;Types of Certificates&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1053298"&gt;SSL Protocol&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1053759"&gt;Signed and Encrypted Email&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1046164"&gt;Form Signing&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1047251"&gt;Single Sign-On&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1046821"&gt;Object Signing&lt;/a&gt;&lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt;  Types of Certificates&lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Five kinds of certificates are commonly used with Netscape products:&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; &lt;b&gt;Client SSL certificates.&lt;/b&gt; Used to identify clients to servers via SSL (client authentication). Typically, the identity of the client is assumed to be the same as the identity of a human being, such as an employee in an enterprise. See &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051902"&gt;Certificate-Based Authentication&lt;/a&gt; for a description of the way client SSL certificates are used for client authentication. Client SSL certificates can also be used for &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1046164"&gt;Form Signing&lt;/a&gt; and as part of a &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1047251"&gt;Single Sign-On&lt;/a&gt; solution.&lt;/li&gt; &lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;Examples:&lt;/b&gt; A bank gives a customer a client SSL certificate that allows the bank's  servers to identify that customer and authorize access to the customer's accounts.  A company might give a new employee a client SSL certificate that allows the  company's servers to identify that employee and authorize access to the  company's servers.  &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;b&gt;Server SSL certificates.&lt;/b&gt; Used to identify servers to clients via SSL (server authentication). Server authentication may be used with or without client authentication. Server authentication is a requirement for an encrypted SSL session. See &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1053298"&gt;SSL Protocol.&lt;/li&gt; &lt;/a&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Example:&lt;/b&gt; Internet sites that engage in electronic commerce (commonly known as  &lt;b&gt;e-commerce&lt;/b&gt;) usually support certificate-based server authentication, at a  minimum, to establish an encrypted SSL session and to assure customers that they  are dealing with a web site identified with a particular company. The encrypted  SSL session ensures that personal information sent over the network, such as  credit card numbers, cannot easily be intercepted. &lt;/a&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; &lt;b&gt;S/MIME certificates.&lt;/b&gt; Used for signed and encrypted email. As with client SSL certificates, the identity of the client is typically assumed to be the same as the identity of a human being, such as an employee in an enterprise. A single certificate may be used as both an S/MIME certificate and an SSL certificate. See &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1053759"&gt;Signed and Encrypted Email&lt;/a&gt;. S/MIME certificates can also be used for &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1046164"&gt;Form Signing&lt;/a&gt; and as part of a &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1047251"&gt;Single Sign-On&lt;/a&gt; solution.&lt;/li&gt; &lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Examples:&lt;/b&gt; A company deploys combined S/MIME and SSL certificates solely  for the purpose of authenticating employee identities, thus permitting signed  email and client SSL authentication but not encrypted email. Another company  issues S/MIME certificates solely for the purpose of both signing and encrypting  email that deals with sensitive financial or legal matters. &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;b&gt;Object-signing certificates.&lt;/b&gt; Used to identify signers of Java code, JavaScript scripts, or other signed files. See &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1046821"&gt;Object Signing&lt;/a&gt;.&lt;/li&gt; &lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;Example:&lt;/b&gt; A software company signs software distributed over the Internet to  provide users with some assurance that the software is a legitimate product of that  company. Using certificates and digital signatures in this manner can also make it  possible for users to identify and control the kind of access downloaded software  has to their computers. &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;a name="1039311"&gt; &lt;b&gt;CA certificates.&lt;/b&gt; Used to identify CAs. Client and server software use CA certificates to determine what other certificates can be trusted. See &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1052613"&gt;How CA Certificates Are Used to Establish Trust&lt;/a&gt;.&lt;/li&gt; &lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Example:&lt;/b&gt; The CA certificates stored in Communicator determine what other  certificates that copy of Communicator can authenticate. An administrator can  implement some aspects of corporate security policies by controlling the CA  certificates stored in each user's copy of Communicator. &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  &lt;/span&gt;&lt;/ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; The sections that follow describes how certificates are used by Netscape products.&lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt;  SSL Protocol &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; The Secure Sockets Layer (SSL) protocol, which was originally developed by Netscape, is a set of rules governing server authentication, client authentication, and encrypted communication between servers and clients. SSL is widely used on the Internet, especially for interactions that involve exchanging confidential information such as credit card numbers. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; SSL requires a server SSL certificate, at a minimum. As part of the initial "handshake" process, the server presents its certificate to the client to authenticate the server's identity. The authentication process uses &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1016376"&gt;Public-Key Encryption&lt;/a&gt; and &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1047358"&gt;Digital Signatures&lt;/a&gt; to confirm that the server is in fact the server it claims to be. Once the server has been authenticated, the client and server use techniques of &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1048740"&gt;Symmetric-Key Encryption&lt;/a&gt;, which is very fast, to encrypt all the information they exchange for the remainder of the session and to detect any tampering that may have occurred.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Servers may optionally be configured to require client authentication as well as server authentication. In this case, after server authentication is successfully completed, the client must also present its certificate to the server to authenticate the client's identity before the encrypted SSL session can be established.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1053763"&gt; For an overview of client authentication over SSL and how it differs from password-based authentication, see &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1045678"&gt;Authentication Confirms an Identity&lt;/a&gt;. For more detailed information about SSL, see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/sslin/index.html" target="_top"&gt;Introduction to SSL&lt;/a&gt;.&lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt; Signed and Encrypted Email&lt;/a&gt; &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Some email programs (including Messenger, which is part of Communicator) support digitally signed and encrypted email using a widely accepted protocol known as Secure Multipurpose Internet Mail Extension (S/MIME). Using S/MIME to sign or encrypt email messages requires the sender of the message to have an S/MIME certificate.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; An email message that includes a digital signature provides some assurance that it was in fact sent by the person whose name appears in the message header, thus providing authentication of the sender. If the digital signature cannot be validated by the email software on the receiving end, the user will be alerted.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; The digital signature is unique to the message it accompanies. If the message received differs in any way from the message that was sent--even by the addition or deletion of a comma--the digital signature cannot be validated. Therefore, signed email also provides some assurance that the email has not been tampered with. As discussed at the beginning of this document, this kind of assurance is known as nonrepudiation. In other words, signed email makes it very difficult for the sender to deny having sent the message. This is important for many forms of business communication. (For information about the way digital signatures work, see &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1047358"&gt;Digital Signatures&lt;/a&gt;.)&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; S/MIME also makes it possible to encrypt email messages. This is also important for some business users. However, using encryption for email requires careful planning. If the recipient of encrypted email messages loses his or her private key and does not have access to a backup copy of the key, for example, the encrypted messages can never be decrypted. &lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;   Single Sign-On&lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Network users are frequently required to remember multiple passwords for the various services they use. For example, a user might have to type a different password to log into the network, collect email, use directory services, use the corporate calendar program, and access various servers. Multiple passwords are an ongoing headache for both users and system administrators. Users have difficulty keeping track of different passwords, tend to choose poor ones, and tend to write them down in obvious places. Administrators must keep track of a separate password database on each server and deal with potential security problems related to the fact that passwords are sent over the network routinely and frequently.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Solving this problem requires some way for a user to log in once, using a single password, and get authenticated access to all network resources that user is authorized to use--without sending any passwords over the network. This capability is known as &lt;b&gt;single sign-on.&lt;/b&gt;&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Both client SSL certificates and S/MIME certificates can play a significant role in a comprehensive single sign-on solution. For example, one form of single sign-on supported by Netscape products relies on SSL client authentication (see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051902"&gt;Certificate-Based Authentication&lt;/a&gt;). A user can log in once, using a single password to the local client's private-key database, and get authenticated access to all SSL-enabled servers that user is authorized to use--without sending any passwords over the network. This approach simplifies access for users, because they don't need to enter passwords for each new server. It also simplifies network management, since administrators can control access by controlling lists of certificate authorities (CAs) rather than much longer lists of users and passwords.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; In addition to using certificates, a complete single-sign on solution must address the need to interoperate with enterprise systems, such as the underlying operating system, that rely on passwords or other forms of authentication.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; For information about the single sign-on support currently provided by Netscape products, see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/SSO/index.html" target="_top"&gt;Single Sign-On Deployment Guide&lt;/a&gt;. &lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt; &lt;a name="1046164"&gt;  Form Signing&lt;/a&gt; &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;Many kinds of e-commerce require the ability to provide persistent proof that someone has authorized a transaction. Although SSL provides transient client authentication for the duration of an SSL connection, it does not provide persistent authentication for transactions that may occur during that connection. S/MIME provides persistent authentication for email, but e-commerce often involves filling in a form on a web page rather than sending an email.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; The Netscape technology known as form signing addresses the need for persistent authentication of financial transactions. Form signing allows a user to associate a digital signature with web-based data generated as the result of a transaction, such as a purchase order or other financial document. The private key associated with either a client SSL certificate or an S/MIME certificate may be used for this purpose. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;When a user clicks the Submit button on a web-based form that supports form signing, a dialog box appears that displays the exact text to be signed. The form designer can either specify the certificate that should be used or allow the user to select a certificate from among the client SSL and S/MIME certificates that are installed in Communicator. When the user clicks OK, the text is signed, and both the text and the digital signature are submitted to the server. The server can then use a Netscape utility called the Signature Verification Tool to validate the digital signature.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; For more information about support for form signing in Netscape products, see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/tech/security/formsign/formsign.html" target="_top"&gt;Netscape Form Signing&lt;/a&gt;.&lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt;   Object Signing&lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Communicator and other Netscape products support a set of tools and technologies called object signing. Object signing uses standard techniques of public-key cryptography to let users get reliable information about code they download in much the same way they can get reliable information about shrink-wrapped software. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Most importantly, object signing helps users and network administrators implement decisions about software distributed over intranets or the Internet--for example, whether to allow Java applets signed by a given entity to use specific computer capabilities on specific users' machines.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; The "objects" signed with object signing technology can be applets or other Java code, JavaScript scripts, plug-ins, or any kind of file. The "signature" is a digital signature. Signed objects and their signatures are typically stored in a special file called a JAR file. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Software developers and others who wish to sign files using object-signing technology must first obtain an object-signing certificate.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; For more information about support for object signing in Netscape products, see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/signedobj/trust/index.html" target="_top"&gt;Netscape Object Signing: Establishing Trust for Downloaded Software&lt;/a&gt;.&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt;  Contents of a Certificate &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; The contents of certificates supported by Netscape and many other software companies are organized according to the X.509 v3 certificate specification, which has been recommended by the International Telecommunications Union (ITU), an international standards body, since 1988. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Users don't usually need to be concerned about the exact contents of a certificate. However, system administrators working with certificates may need some familiarity with the information provided here&lt;/a&gt;.&lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt; &lt;a name="1050493"&gt;  Distinguished Names&lt;/a&gt; &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1048086"&gt; An X.509 v3 certificate binds a &lt;b&gt;distinguished name (DN)&lt;/b&gt; to a public key. A DN is a series of name-value pairs, such as &lt;/a&gt;&lt;/span&gt;&lt;code&gt;&lt;a name="1048086"&gt;uid=doe&lt;/a&gt;&lt;/code&gt;&lt;a name="1048086"&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;, that uniquely identify an entity--that is, the certificate&lt;b&gt; subject.&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;For example, this might be a typical DN for an employee of Netscape Communications Corporation:&lt;/span&gt; &lt;pre&gt;&lt;a name="1048046"&gt;uid=doe,e=doe@netscape.com,cn=John Doe,o=Netscape Communications Corp.,c=US&lt;/a&gt;
&lt;/pre&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; The abbreviations before each equal sign in this example have these meanings:&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;/li&gt;&lt;/span&gt;&lt;code&gt;&lt;a name="1048048"&gt;uid&lt;/a&gt;&lt;/code&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;: user ID&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;a name="1048049"&gt; &lt;/a&gt;&lt;/li&gt;&lt;/span&gt;&lt;code&gt;&lt;a name="1048049"&gt;e&lt;/a&gt;&lt;/code&gt;&lt;a name="1048049"&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;: email address&lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;/li&gt;&lt;/span&gt;&lt;code&gt;&lt;a name="1048050"&gt;cn&lt;/a&gt;&lt;/code&gt;&lt;a name="1048050"&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;: the user's common name&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;a name="1048051"&gt; &lt;/a&gt;&lt;/li&gt;&lt;/span&gt;&lt;code&gt;&lt;a name="1048051"&gt;o&lt;/a&gt;&lt;/code&gt;&lt;a name="1048051"&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;: organization&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;a name="1048052"&gt; &lt;/a&gt;&lt;/li&gt;&lt;/span&gt;&lt;code&gt;&lt;a name="1048052"&gt;c&lt;/a&gt;&lt;/code&gt;&lt;a name="1048052"&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;: country&lt;/span&gt;&lt;/a&gt;&lt;/ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; DNs may include a variety of other name-value pairs. They are used to identify both certificate subjects and entries in directories that support the Lightweight Directory Access Protocol (LDAP). &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; The rules governing the construction of DNs can be quite complex and are beyond the scope of this document. For comprehensive information about DNs, see &lt;a href="http://web.archive.org/web/20040918042437/ftp://ds.internic.net/rfc/rfc1485.txt" target="_top"&gt;A String Representation of Distinguished Names&lt;/a&gt;.&lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt;  A Typical Certificate &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Every X.509 certificate consists of two sections:&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The data section includes the following information:&lt;/li&gt; &lt;/span&gt;&lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;The version number of the X.509 standard supported by the certificate.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The certificate's serial number. Every certificate issued by a CA has a serial number that is unique among the certificates issued by that CA.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; Information &lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; Information about the user's public key, including the algorithm used and a representation of the key itself.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The DN of the CA that issued the certificate.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The period during which the certificate is valid (for example, between 1:00 p.m. on November 15, 1996 and 1:00 p.m. November 15, 1997)&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The DN of the certificate subject (for example, in a client SSL certificate this would be the user's DN), also called the subject name&lt;/a&gt;. &lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;a name="1052590"&gt; Optional &lt;b&gt;certificate extensions,&lt;/b&gt; which may provide additional data used by the client or server. For example, the certificate type extension indicates the type of certificate--that is, whether it is a client SSL certificate, a server SSL certificate, a certificate for signing email, and so on. Certificate extensions can also be used for a variety of other purposes&lt;/a&gt;.&lt;/li&gt; &lt;/span&gt;&lt;/ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;The signature section includes the following information:&lt;/li&gt; &lt;/span&gt;&lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;The cryptographic algorithm, or cipher, used by the issuing CA to create its own digital signature. For more information about ciphers, see&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/sslin/index.html" target="_top"&gt;Introduction to SSL&lt;/a&gt;.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;&lt;a name="1047990"&gt; The CA's digital signature, obtained by hashing all of the data in the certificate together and encrypting it with the CA's private key&lt;/a&gt;.&lt;/li&gt; &lt;/span&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;Here are the data and signature sections of a certificate in human-readable format:&lt;/span&gt; &lt;pre&gt;&lt;code&gt;Certificate:
Data:
Version: v3 (0x2)
Serial Number: 3 (0x3)
Signature Algorithm: PKCS #1 MD5 With RSA Encryption
Issuer: OU=Ace Certificate Authority, O=Ace Industry, C=US
Validity:
 Not Before: Fri Oct 17 18:36:25 1997
 Not  After: Sun Oct 17 18:36:25 1999
Subject: CN=Jane Doe, OU=Finance, O=Ace Industry, C=US
Subject Public Key Info:
 Algorithm: PKCS #1 RSA Encryption
 Public Key:
     Modulus:
         00:ca:fa:79:98:8f:19:f8:d7:de:e4:49:80:48:e6:2a:2a:86:
         ed:27:40:4d:86:b3:05:c0:01:bb:50:15:c9:de:dc:85:19:22:
         43:7d:45:6d:71:4e:17:3d:f0:36:4b:5b:7f:a8:51:a3:a1:00:
         98:ce:7f:47:50:2c:93:36:7c:01:6e:cb:89:06:41:72:b5:e9:
         73:49:38:76:ef:b6:8f:ac:49:bb:63:0f:9b:ff:16:2a:e3:0e:
         9d:3b:af:ce:9a:3e:48:65:de:96:61:d5:0a:11:2a:a2:80:b0:
         7d:d8:99:cb:0c:99:34:c9:ab:25:06:a8:31:ad:8c:4b:aa:54:
         91:f4:15
     Public Exponent: 65537 (0x10001)
Extensions:
 Identifier: Certificate Type
     Critical: no
     Certified Usage:
         SSL Client
 Identifier: Authority Key Identifier
     Critical: no
     Key Identifier:
         f2:f2:06:59:90:18:47:51:f5:89:33:5a:31:7a:e6:5c:fb:36:
         26:c9
Signature:
Algorithm: PKCS #1 MD5 With RSA Encryption
Signature:
 6d:23:af:f3:d3:b6:7a:df:90:df:cd:7e:18:6c:01:69:8e:54:65:fc:06:
 30:43:34:d1:63:1f:06:7d:c3:40:a8:2a:82:c1:a4:83:2a:fb:2e:8f:fb:
 f0:6d:ff:75:a3:78:f7:52:47:46:62:97:1d:d9:c6:11:0a:02:a2:e0:cc:
 2a:75:6c:8b:b6:9b:87:00:7d:7c:84:76:79:ba:f8:b4:d2:62:58:c3:c5:
 b6:c1:43:ac:63:44:42:fd:af:c8:0f:2f:38:85:6d:d6:59:e8:41:42:a5:
 4a:e5:26:38:ff:32:78:a1:38:f1:ed:dc:0d:31:d1:b0:6d:67:e9:46:a8:
  dd:c4&lt;/code&gt;&lt;/a&gt;
&lt;/pre&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  Here is the same certificate displayed in the 64-byte-encoded form interpreted by software: &lt;/span&gt;&lt;pre&gt;&lt;a name="1052611"&gt;&lt;code&gt;-----BEGIN CERTIFICATE-----
MIICKzCCAZSgAwIBAgIBAzANBgkqhkiG9w0BAQQFADA3MQswCQYDVQQGEwJVUzER
MA8GA1UEChMITmV0c2NhcGUxFTATBgNVBAsTDFN1cHJpeWEncyBDQTAeFw05NzEw
MTgwMTM2MjVaFw05OTEwMTgwMTM2MjVaMEgxCzAJBgNVBAYTAlVTMREwDwYDVQQK
EwhOZXRzY2FwZTENMAsGA1UECxMEUHViczEXMBUGA1UEAxMOU3Vwcml5YSBTaGV0
dHkwgZ8wDQYJKoZIhvcNAQEFBQADgY0AMIGJAoGBAMr6eZiPGfjX3uRJgEjmKiqG
7SdATYazBcABu1AVyd7chRkiQ31FbXFOGD3wNktbf6hRo6EAmM5/R1AskzZ8AW7L
iQZBcrXpc0k4du+2Q6xJu2MPm/8WKuMOnTuvzpo+SGXelmHVChEqooCwfdiZywyZ
NMmrJgaoMa2MS6pUkfQVAgMBAAGjNjA0MBEGCWCGSAGG+EIBAQQEAwIAgDAfBgNV
HSMEGDAWgBTy8gZZkBhHUfWJM1oxeuZc+zYmyTANBgkqhkiG9w0BAQQFAAOBgQBt
I6/z07Z635DfzX4XbAFpjlRl/AYwQzTSYx8GfcNAqCqCwaSDKvsuj/vwbf91o3j3
UkdGYpcd2cYRCgKi4MwqdWyLtpuHAH18hHZ5uvi00mJYw8W2wUOsY0RC/a/IDy84
hW3WWehBUqVK5SY4/zJ4oTjx7dwNMdGwbWfpRqjd1A==
-----END CERTIFICATE----- &lt;/code&gt;&lt;/a&gt;
&lt;/pre&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  &lt;/span&gt;&lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt; &lt;a name="1052613"&gt;  How CA Certificates Are Used to Establish Trust&lt;/a&gt;  &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Certificate authorities (CAs) are entities that validate identities and issue certificates. They can be either independent third parties or organizations running their own certificate-issuing server software (such as the Netscape Certificate Server). A list of third-party certificate authorities is available at &lt;a href="http://web.archive.org/web/20040918042437/https://certs.netscape.com/client.html" target="_top"&gt;Certificate Authority Services&lt;/a&gt;.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Any client or server software that supports certificates maintains a collection of&lt;b&gt; trusted CA certificates.&lt;/b&gt; These CA certificates determine which other certificates the software can validate--in other words, which issuers of certificates the software can trust. In the simplest case, the software can validate only certificates issued by one of the CAs for which it has a certificate. It's also possible for a trusted CA certificate to be part of a chain of CA certificates, each issued by the CA above it in a certificate hierarchy. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; The sections that follow explains how certificate hierarchies and certificate chains determine what certificates software can trust.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1050569"&gt; &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1050537"&gt;CA Hierarchies&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044927"&gt;Certificate Chains&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1049036"&gt;Verifying a Certificate Chain&lt;/a&gt;&lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt; &lt;a name="1050537"&gt;  CA Hierarchies&lt;/a&gt; &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; In large organizations, it may be appropriate to delegate the responsibility for issuing certificates to several different certificate authorities. For example, the number of certificates required may be too large for a single CA to maintain; different organizational units may have different policy requirements; or it may be important for a CA to be physically located in the same geographic area as the people to whom it is issuing certificates.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; It's possible to delegate certificate-issuing responsibilities to subordinate CAs. The X.509 standard includes a model for setting up a hierarchy of CAs like that shown in &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044907"&gt;Figure 6&lt;/a&gt;. &lt;/span&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Figure 6     Example of a hierarchy of certificate authorities &lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1044907"&gt;&lt;/a&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GciOeVn_TLE/So0wwSNt0rI/AAAAAAAADGQ/zhcS2ON2hbs/s1600-h/14hier.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 383px; height: 316px;" src="http://2.bp.blogspot.com/_GciOeVn_TLE/So0wwSNt0rI/AAAAAAAADGQ/zhcS2ON2hbs/s400/14hier.gif" alt="" id="BLOGGER_PHOTO_ID_5372003536604091058" border="0" /&gt;&lt;/a&gt;&lt;a name="1044907"&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1044907"&gt;&lt;b&gt; &lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt; In this model, the root CA is at the top of the hierarchy. The root CA's certificate is a &lt;b&gt;self-signed certificate:&lt;/b&gt; that is, the certificate is digitally signed by the same entity--the root CA--that the certificate identifies. The CAs that are directly subordinate to the root CA have CA certificates signed by the root CA. CAs under the subordinate CAs in the hierarchy have their CA certificates signed by the higher-level subordinate CAs.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Organizations have a great deal of flexibility in terms of the way they set up their CA hierarchies. &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044907"&gt;Figure 6&lt;/a&gt; shows just one example; many other arrangements are possible. &lt;/span&gt;  &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt; &lt;a name="1044927"&gt;  Certificate Chains&lt;/a&gt; &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; CA hierarchies are reflected in certificate chains. A &lt;b&gt;certificate chain&lt;/b&gt; is series of certificates issued by successive CAs. &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044938"&gt;Figure 7&lt;/a&gt; shows a certificate chain leading from a certificate that identifies some entity through two subordinate CA certificates to the CA certificate for the root CA (based on the CA hierarchy shown in &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044907"&gt;Figure 6&lt;/a&gt;).&lt;/span&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1044938"&gt; &lt;b&gt;Figure 7     Example of a certificate chain &lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GciOeVn_TLE/So0xJDGTpgI/AAAAAAAADGY/GPOWAfNR7PI/s1600-h/14hier.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 393px; height: 400px;" src="http://3.bp.blogspot.com/_GciOeVn_TLE/So0xJDGTpgI/AAAAAAAADGY/GPOWAfNR7PI/s400/14hier.gif" alt="" id="BLOGGER_PHOTO_ID_5372003962043213314" border="0" /&gt;&lt;/a&gt;&lt;a name="1044938"&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt; A certificate chain traces a path of certificates from a branch in the hierarchy to the root of the hierarchy. In a certificate chain, the following occur:&lt;/span&gt; &lt;ul&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; Each certificate is followed by the certificate of its issuer.&lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; Each certificate contains the name (DN) of that certificate's issuer, which is the same as the subject name of the next certificate in the chain.&lt;/li&gt; &lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; In &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044938"&gt;Figure 7&lt;/a&gt;, the Engineering CA certificate contains the DN of the CA (that is,  USA CA), that issued that certificate. USA CA's DN is also the subject name of  the next certificate in the chain.  &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; Each certificate is signed with the private key of its issuer. The signature can be verified with the public key in the issuer's certificate, which is the next certificate in the chain.&lt;/li&gt; &lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; In &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044938"&gt;Figure 7&lt;/a&gt;, the public key in the certificate for the USA CA can be used to verify  the USA CA's digital signature on the certificate for the Engineering CA. &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;  &lt;/span&gt;&lt;/ul&gt; &lt;h4&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head3;"&gt;&lt;/a&gt; &lt;a name="1049036"&gt;  Verifying a Certificate Chain&lt;/a&gt; &lt;/span&gt;&lt;/h4&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Certificate chain verification is the process of making sure a given certificate chain is well-formed, valid, properly signed, and trustworthy. Netscape software uses the following procedure for forming and verifying a certificate chain, starting with the certificate being presented for authentication: &lt;/span&gt; &lt;ol&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The certificate validity period is checked against the current time provided by the verifier's system clock. &lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The issuer's certificate is located. The source can be either the verifier's local certificate database (on that client or server) or the certificate chain provided by the subject (for example, over an SSL connection). &lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt; The certificate signature is verified using the public key in the issuer's certificate. &lt;/li&gt; &lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;li&gt;If the issuer's certificate is trusted by the verifier in the verifier's certificate database, verification stops successfully here. Otherwise, the issuer's certificate is checked to make sure it contains the appropriate subordinate CA indication in the Netscape certificate type extension, and chain verification returns to step 1 to start again, but with this new certificate. &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044966"&gt;Figure 8&lt;/a&gt; presents an example of this process.&lt;/li&gt; &lt;/span&gt;&lt;/ol&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Figure 8     Verifying a certificate chain all the way to the root CA&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GciOeVn_TLE/So0xZGtjRBI/AAAAAAAADGg/h3fftlwFLgc/s1600-h/16chver.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 356px;" src="http://3.bp.blogspot.com/_GciOeVn_TLE/So0xZGtjRBI/AAAAAAAADGg/h3fftlwFLgc/s400/16chver.gif" alt="" id="BLOGGER_PHOTO_ID_5372004237891027986" border="0" /&gt;&lt;/a&gt;&lt;a name="1044966"&gt;&lt;/a&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1044967"&gt; Figure 8 shows what happens when only Root CA is included in the verifier's local database. If a certificate for one of the intermediate CAs shown in Figure 8, such as Engineering CA, is found in the verifier's local database, verification stops with that certificate, as shown in &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044975"&gt;Figure 9&lt;/a&gt;.&lt;/span&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Figure 9     Verifying a certificate chain to an intermediate CA&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GciOeVn_TLE/So0y_HcqNEI/AAAAAAAADGo/bXjsjI7Zg0E/s1600-h/19chver.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 201px;" src="http://2.bp.blogspot.com/_GciOeVn_TLE/So0y_HcqNEI/AAAAAAAADGo/bXjsjI7Zg0E/s400/19chver.gif" alt="" id="BLOGGER_PHOTO_ID_5372005990435271746" border="0" /&gt;&lt;/a&gt;&lt;a name="1044975"&gt;&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt; Expired validity dates, an invalid signature, or the absence of a certificate for the issuing CA at any point in the certificate chain causes authentication to fail. For example, &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1044984"&gt;Figure 10&lt;/a&gt; shows how verification fails if neither the Root CA certificate nor any of the intermediate CA certificates are included in the verifier's local database.&lt;/span&gt; &lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1044984"&gt; &lt;b&gt;Figure 10     A certificate chain that can't be verified&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1044984"&gt;&lt;/a&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_GciOeVn_TLE/So0zLAMQHsI/AAAAAAAADGw/0xszyJ9oGQo/s1600-h/20chver.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 352px;" src="http://4.bp.blogspot.com/_GciOeVn_TLE/So0zLAMQHsI/AAAAAAAADGw/0xszyJ9oGQo/s400/20chver.gif" alt="" id="BLOGGER_PHOTO_ID_5372006194645835458" border="0" /&gt;&lt;/a&gt;&lt;a name="1044984"&gt;
&lt;/a&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1044984"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1049084"&gt; For general information about the way digital signatures work, see &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1047358"&gt;Digital Signatures&lt;/a&gt;. For a more detailed description of the signature verification process in the context of SSL client and server authentication, see &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/sslin/index.html" target="_top"&gt;Introduction to SSL&lt;/a&gt;.&lt;/span&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#top"&gt;[Top]&lt;/a&gt;&lt;/span&gt;&lt;hr noshade="noshade"  style="font-size:78%;"&gt;&lt;p&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;
&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Managing Certificates"&gt;&lt;/a&gt; &lt;a name="1048637"&gt;  Managing Certificates&lt;/a&gt; &lt;/span&gt;&lt;/h2&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;The set of standards and services that facilitate the use of public-key cryptography and X.509 v3 certificates in a networked environment is called the &lt;b&gt;public key infrastructure (PKI).&lt;/b&gt; PKI management is complex topic beyond the scope of this document. The sections that follow introduce some of the specific certificate management issues addressed by Netscape products.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1050737"&gt;Issuing Certificates&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1052257"&gt;Certificates and the LDAP Directory&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1050920"&gt;Key Management&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1048935"&gt;Renewing and Revoking Certificates&lt;/a&gt;
&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1048936"&gt;Registration Authorities&lt;/a&gt;&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt; &lt;a name="1050737"&gt;  Issuing Certificates&lt;/a&gt; &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; The process for issuing a certificate depends on the certificate authority that issues it and the purpose for which it will be used. The process for issuing nondigital forms of identification varies in similar ways. For example, if you want to get a generic ID card (not a driver's license) from the Department of Motor Vehicles in California, the requirements are straightforward: you need to present some evidence of your identity, such as a utility bill with your address on it and a student identity card. If you want to get a regular driving license, you also need to take a test--a driving test when you first get the license, and a written test when you renew it. If you want to get a commercial license for an eighteen-wheeler, the requirements are much more stringent. If you live in some other state or country, the requirements for various kinds of licenses will differ.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Similarly, different CAs have different procedures for issuing different kinds of certificates. In some cases the only requirement may be your email address. In other cases, your Unix or NT login and password may be sufficient. At the other end of the scale, for certificates that identify people who can authorize large expenditures or make other sensitive decisions, the issuing process may require notarized documents, a background check, and a personal interview.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Depending on an organization's policies, the process of issuing certificates can range from being completely transparent for the user to requiring significant user participation and complex procedures. In general, processes for issuing certificates should be highly flexible, so organizations can tailor them to their changing needs&lt;/a&gt;.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="1052190"&gt; The &lt;/a&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://home.netscape.com/certificate/v1.0/index.html" target="_top"&gt;Netscape Certificate Server&lt;/a&gt;, part of the &lt;a href="http://web.archive.org/web/20040918042437/http://home.netscape.com/missioncontrol/index.html" target="_top"&gt;Mission Control&lt;/a&gt; family of products, allows an organization to set up its own certificate authority and issue certificates. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Issuing certificates is one of several managements tasks that can be handled by separate &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1048936"&gt;Registration Authorities&lt;/a&gt;.&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt; &lt;a name="1052257"&gt;  Certificates and the LDAP Directory&lt;/a&gt; &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; The Lightweight Directory Access Protocol (LDAP) for accessing directory services supports great flexibility in the management of certificates within an organization. System administrators can store much of the information required to manage certificates in an LDAP-compliant directory. For example, a CA can use information in a directory to prepopulate a certificate with a new employee's legal name and other information. The CA can leverage directory information in other ways to issue certificates one at a time or in bulk, using a range of different identification techniques depending on the security policies of a given organization. Other routine management tasks, such as &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1050920"&gt;Key Management&lt;/a&gt; and &lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1048935"&gt;Renewing and Revoking Certificates&lt;/a&gt;, can be partially or fully automated with the aid of the directory.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Information stored in the directory can also be used with certificates to control access to various network resources by different users or groups. Issuing certificates and other certificate management tasks can thus be an integral part of user and group management.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; In general, high-performance directory services are an essential ingredient of any certificate management strategy. The &lt;a href="http://web.archive.org/web/20040918042437/http://home.netscape.com/directory/v3.0/index.html" target="_top"&gt;Netscape Directory Server&lt;/a&gt;, part of the &lt;a href="http://web.archive.org/web/20040918042437/http://home.netscape.com/missioncontrol/index.html" target="_top"&gt;Mission Control&lt;/a&gt; family of products, is fully integrated with the &lt;a href="http://web.archive.org/web/20040918042437/http://home.netscape.com/certificate/v1.0/index.html" target="_top"&gt;Netscape Certificate Server&lt;/a&gt; to provide a comprehensive certificate management solution.&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt; &lt;a name="1050920"&gt;  Key Management&lt;/a&gt; &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Before a certificate can be issued, the public key it contains and the corresponding private key must be generated. Sometimes it may be useful to issue a single person one certificate and key pair for signing operations, and another certificate and key pair for encryption operations. Separate signing and encryption certificates make it possible to keep the private signing key on the local machine only, thus providing maximum nonrepudiation, and to back up the private encryption key in some central location where it can be retrieved in case the user loses the original key or leaves the company. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Keys can be generated by client software or generated centrally by the CA and distributed to users via an LDAP directory. There are trade-offs involved in choosing between local and centralized key generation. For example, local key generation provides maximum nonrepudiation, but may involve more participation by the user in the issuing process. Flexible key management capabilities are essential for most organizations.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; &lt;b&gt;Key recovery,&lt;/b&gt; or the ability to retrieve backups of encryption keys under carefully defined conditions, can be a crucial part of certificate management (depending on how an organization uses certificates). Key recovery schemes usually involve an &lt;b&gt;m of n&lt;/b&gt; mechanism: for example, &lt;i&gt;m&lt;/i&gt; of &lt;i&gt;n&lt;/i&gt; managers within an organization might have to agree, and each contribute a special code or key of their own, before a particular person's encryption key can be recovered. This kind of mechanism ensures that several authorized personnel must agree before an encryption key can be recovered&lt;/a&gt;.&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt; &lt;a name="1048935"&gt;  Renewing and Revoking Certificates&lt;/a&gt; &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Like a driver's license, a certificate specifies a period of time during which it is valid. Attempts to use a certificate for authentication before or after its validity period will fail. Therefore, mechanisms for managing certificate renewal are essential for any certificate management strategy. For example, an administrator may wish to be notified automatically when a certificate is about to expire, so that an appropriate renewal process can be completed in plenty of time without causing the certificate's subject any inconvenience. The renewal process may involve reusing the same public-private key pair or issuing a new one.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; A driver's license can be suspended even if it has not expired--for example, as punishment for a serious driving offense. Similarly, it's sometimes necessary to revoke a certificate before it has expired--for example, if an employee leaves a company or moves to a new job within the company. &lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt; Certificate revocation can be handled in several different ways. For some organizations, it may be sufficient to set up servers so that the authentication process includes checking the directory for the presence of the certificate being presented. When an administrator revokes a certificate, the certificate can be automatically removed from the directory, and subsequent authentication attempts with that certificate will fail even though the certificate remains valid in every other respect. Another approach involves publishing a &lt;b&gt;certificate revocation list (CRL)&lt;/b&gt;--that is, a list of revoked certificates--to the directory at regular intervals and checking the list as part of the authentication process. For some organizations, it may be preferable to check directly with the issuing CA each time a certificate is presented for authentication. This procedure is sometimes called &lt;b&gt;real-time status checking.&lt;/b&gt;&lt;/span&gt;  &lt;h3&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a name="Head2;"&gt;&lt;/a&gt; &lt;a name="1048936"&gt;  Registration Authorities&lt;/a&gt; &lt;/span&gt;&lt;/h3&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt; Interactions between entities identified by certificates (sometimes called &lt;b&gt;end entities&lt;/b&gt;) and CAs are an essential part of certificate management. These interactions include operations such as registration for certification, certificate retrieval, certificate renewal, certificate revocation, and key backup and recovery. In general, a CA must be able to authenticate the identities of end entities before responding to the requests. In addition, some requests need to be approved by authorized administrators or managers before being services&lt;/a&gt;.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;As previously discussed, the means used by different CAs to verify an identity before issuing a certificate can vary widely, depending on the organization and the purpose for which the certificate will be used. To provide maximum operational flexibility, interactions with end entities can be separated from the other functions of a CA and handled by a separate service called a &lt;b&gt;Registration Authority (RA).&lt;/b&gt;&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;An RA acts as a front end to a CA by receiving end entity requests, authenticating them, and forwarding them to the CA. After receiving a response from the CA, the RA notifies the end entity of the results. RAs can be helpful in scaling an PKI across different departments, geographical areas, or other operational units with varying policies and authentication requirements.&lt;/span&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;Future versions of the &lt;a href="http://web.archive.org/web/20040918042437/http://home.netscape.com/certificate/v1.0/index.html" target="_top"&gt;Netscape Certificate Server&lt;/a&gt; will support the creation of customizable registration authorities.&lt;/span&gt;  &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;a href="http://web.archive.org/web/20040918042437/http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#top"&gt;[Top]&lt;/a&gt; &lt;/span&gt;&lt;hr noshade="noshade"  style="font-size:78%;"&gt;  &lt;p align="right"&gt; &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;i&gt;Last Updated:  10/09/98  10:35:45&lt;/i&gt; &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-8995719514398093942?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5fKmqDxXybZ9Dyr8uFoMef-9vfc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5fKmqDxXybZ9Dyr8uFoMef-9vfc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5fKmqDxXybZ9Dyr8uFoMef-9vfc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5fKmqDxXybZ9Dyr8uFoMef-9vfc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/C7A2s9yuRqk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/8995719514398093942/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=8995719514398093942" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/8995719514398093942?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/8995719514398093942?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/C7A2s9yuRqk/introduction-to-public-key-cryptography.html" title="Introduction to Public-Key Cryptography" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_GciOeVn_TLE/So0sVtjn4FI/AAAAAAAADFo/cSTwFeSJZ9g/s72-c/05scrypt.gif" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/08/introduction-to-public-key-cryptography.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEBSHY-eip7ImA9WxNTEUo.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-6127670989396817401</id><published>2009-08-13T19:28:00.003+05:30</published><updated>2009-08-13T19:57:39.852+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-13T19:57:39.852+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="gcc" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="windows" /><title>CYWGIN</title><content type="html">Cygwin is a Linux-like environment for Windows. It consists of two parts:
&lt;table width="85%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="left"&gt;&lt;li&gt;A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality. &lt;/li&gt;&lt;li&gt;A collection of tools which provide Linux look and feel.&lt;/li&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The Cygwin DLL currently works with all recent, commercially released x86 32 bit and 64 bit versions of Windows, with the exception of Windows CE.&lt;/p&gt;  &lt;p&gt;Note that the official support for Windows 95, Windows 98, and Windows Me will be discontinued with the &lt;a href="http://cygwin.com/#beta-test"&gt;&lt;b&gt;next major version (1.7.0)&lt;/b&gt;&lt;/a&gt; of Cygwin, which is in &lt;a href="http://cygwin.com/#beta-test"&gt;&lt;b&gt;beta testing&lt;/b&gt;&lt;/a&gt; right now.&lt;/p&gt;  &lt;h3&gt;&lt;center&gt;What Isn't Cygwin?&lt;/center&gt;&lt;/h3&gt; &lt;table width="85%"&gt;&lt;tbody&gt;&lt;tr&gt;
&lt;td align="left"&gt;&lt;li&gt;Cygwin is &lt;b&gt;not&lt;/b&gt; a way to run native linux apps on Windows.  You have to rebuild your application &lt;em&gt;from source&lt;/em&gt; if you want it to run on Windows. &lt;/li&gt;&lt;li&gt;Cygwin is &lt;b&gt;not&lt;/b&gt; a way to magically make native Windows apps aware of UNIX ® functionality, like signals, ptys, etc.  Again, you need to build your apps &lt;em&gt;from source&lt;/em&gt; if you want to take advantage of Cygwin functionality.  &lt;/li&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;span style="font-weight: bold;"&gt;FAQ:&lt;/span&gt;
&lt;table summary="Q and A Set" border="0"&gt;&lt;tbody&gt;&lt;tr class="question"&gt;&lt;td valign="top" align="left"&gt;&lt;p&gt;&lt;b&gt;1.1.&lt;/b&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="top" align="left"&gt;&lt;p&gt;What is it?&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="answer"&gt;&lt;td valign="top" align="left"&gt;
&lt;/td&gt;&lt;td valign="top" align="left"&gt;&lt;p&gt;The Cygwin tools are ports of the popular GNU development tools for Microsoft Windows.  They run thanks to the Cygwin library which provides the UNIX system calls and environment these programs expect. &lt;/p&gt;&lt;p&gt;With these tools installed, it is possible to write Win32 console or GUI applications that make use of the standard Microsoft Win32 API and/or the Cygwin API.  As a result, it is possible to easily port many significant Unix programs without the need for extensive changes to the source code.  This includes configuring and building most of the available GNU software (including the packages included with the Cygwin development tools themselves).  Even if the development tools are of little to no use to you, you may have interest in the many standard Unix utilities provided with the package. They can be used both from the bash shell (provided) or from the standard Windows command shell. &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="question"&gt;&lt;td valign="top" align="left"&gt;&lt;a name="faq.what.supported"&gt;&lt;/a&gt;&lt;p&gt;&lt;b&gt;1.2.&lt;/b&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="top" align="left"&gt;&lt;p&gt;What versions of Windows are supported?&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="answer"&gt;&lt;td valign="top" align="left"&gt;
&lt;/td&gt;&lt;td valign="top" align="left"&gt;&lt;p&gt;Cygwin can be expected to run on all modern 32 bit versions of Windows, except Windows CE.  This includes Windows 95/98/ME/NT/2000/XP/2003 and the WOW64 32 bit environment on released 64 bit versions of Windows. As far as we know no one is working on a native 64 bit version of Cygwin. Since Cygwin is a community-supported free software project, patches to provide support for other versions would be thoughtfully considered. Paid support contracts or enhancements are available through Red Hat.  For  information about getting a Red Hat support contract, see  &lt;a class="ulink" href="http://cygwin.com/license.html" target="_top"&gt;http://cygwin.com/license.html&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Keep in mind that Cygwin can only do as much as the underlying OS supports.  Because of this, Cygwin will behave differently, and exhibit different limitations, on the various versions of Windows. &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-6127670989396817401?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MFf1zAKEY-vnK0bNk0vtH4wv4hQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MFf1zAKEY-vnK0bNk0vtH4wv4hQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/MFf1zAKEY-vnK0bNk0vtH4wv4hQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MFf1zAKEY-vnK0bNk0vtH4wv4hQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/X_CLjk4ZSq8" height="1" width="1"/&gt;</content><link rel="related" href="http://cygwin.com/" title="CYWGIN" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/6127670989396817401/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=6127670989396817401" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6127670989396817401?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6127670989396817401?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/X_CLjk4ZSq8/cywgin.html" title="CYWGIN" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/08/cywgin.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcHR304fip7ImA9WxJUEUk.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-4018033876741226217</id><published>2009-07-09T19:05:00.002+05:30</published><updated>2009-07-09T19:13:56.336+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-09T19:13:56.336+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web" /><category scheme="http://www.blogger.com/atom/ns#" term="email" /><title>Email Address Validation Anyone??</title><content type="html">Hi All,
There is a goood Article which i have found related to Email Address Validation which says not to validate Email Address Strictly and i too agree with it.

Go through the below mentioned Links to check this out.

&lt;ul&gt;&lt;li&gt;&lt;a href="http://haacked.com/archive/0001/01/01/i-knew-how-to-validate-an-email-address-until-i.aspx"&gt;http://haacked.com/archive/0001/01/01/i-knew-how-to-validate-an-email-address-until-i.aspx&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.rfc-editor.org/errata_search.php?rfc=3696"&gt;http://www.rfc-editor.org/errata_search.php?rfc=3696&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
Enjoy ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-4018033876741226217?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HQmRbfoN9HIPrLmHV0JqTIRseaQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HQmRbfoN9HIPrLmHV0JqTIRseaQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HQmRbfoN9HIPrLmHV0JqTIRseaQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HQmRbfoN9HIPrLmHV0JqTIRseaQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/k8JswjVYTSM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/4018033876741226217/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=4018033876741226217" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/4018033876741226217?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/4018033876741226217?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/k8JswjVYTSM/email-address-validation-anyone.html" title="Email Address Validation Anyone??" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/07/email-address-validation-anyone.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8DSHk6fCp7ImA9WxJVFkQ.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-6004604963866891205</id><published>2009-07-04T12:45:00.003+05:30</published><updated>2009-07-04T13:04:39.714+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-04T13:04:39.714+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><title>Extending JavaScript Objects and Classes</title><content type="html">&lt;h1&gt;Extending JavaScript Objects and Classes&lt;/h1&gt;
&lt;div id="pagecontent"&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;You can dynamically create properties and methods of existing objects through simple assignment.&lt;/li&gt;
&lt;li&gt;Using the &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; property of intrinsic JS Objects, you can extend the functionality of the very objects you know and love in ways that can make your coding far easier.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id="toc"&gt;Table of Contents&lt;/h2&gt;

&lt;ul class="toc"&gt;
&lt;li&gt;&lt;a href="http://vinojdavis.blogspot.com/2009/07/extending-javascript-objects-and.html#background"&gt;Background — Objects in JS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vinojdavis.blogspot.com/2009/07/extending-javascript-objects-and.html#prototype"&gt;The &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; Property&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vinojdavis.blogspot.com/2009/07/extending-javascript-objects-and.html#example1"&gt;Example 1 — Adding &lt;code class="js"&gt;slice&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; to Arrays&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://vinojdavis.blogspot.com/2009/07/extending-javascript-objects-and.html#example2"&gt;Example 2 — Date Formatting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vinojdavis.blogspot.com/2009/07/extending-javascript-objects-and.html#example3"&gt;Example 3 — Number Formatting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vinojdavis.blogspot.com/2009/07/extending-javascript-objects-and.html#example4"&gt;Example 4 — Boolean XOR&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vinojdavis.blogspot.com/2009/07/extending-javascript-objects-and.html#example5"&gt;Example 5 — Extending Arrays to Support Set Mathematics&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id="background"&gt;Background — Objects in JS&lt;/h2&gt;
&lt;p&gt;In JavaScript, objects can have properties dynamically added to them. [This comes as no surprise to JS programmers who have written something like &lt;code class="js"&gt;myObject.backgroundColor=&lt;span class="string"&gt;'black'&lt;/span&gt;&lt;/code&gt; or &lt;code class="js"&gt;myObject.style.backgroundcolor=&lt;span class="string"&gt;'black'&lt;/span&gt;&lt;/code&gt; instead of the correct &lt;code class="js"&gt;myObject.style.backgroundColor=&lt;span class="string"&gt;'black'&lt;/span&gt;&lt;/code&gt; and consequently pulled out their hair for hours trying to figure out why the background color wasn't changing. The answer to &lt;i&gt;"Why isn't this working?!"&lt;/i&gt; (i.e. &lt;i&gt;"Because you coded it wrong"&lt;/i&gt;) isn't nearly so enlightening as the information that it &lt;b&gt;looked&lt;/b&gt; like it was working because the JavaScript engine was happily creating a new (meaningless) property of the object and setting it to the string value 'black'.]&lt;/p&gt;

&lt;div style="margin-left: 2em; margin-bottom: 1em;"&gt;
&lt;p class="contentfollows"&gt;For the curious, this feature of JS is possible because the language is evaluated at run-time, and because all Objects are implemented as hash tables. This also explains why it's possible to refer to the same property either directly or as a string:&lt;/p&gt;
&lt;pre class="contentfollows"&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; spacing = myTable.cellSpacing;
&lt;span class="keyword"&gt;var&lt;/span&gt; spacing = myTable&lt;span class="paren"&gt;[&lt;/span&gt;&lt;span class="string"&gt;'cellSpacing'&lt;/span&gt;&lt;span class="paren"&gt;]&lt;/span&gt;; &lt;span class="comment"&gt;//equally as valid&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p class="contentfollows contentbefore"&gt;and why you can create property names that no reasonable compiler would ever accept, such as:&lt;/p&gt;
&lt;pre&gt;&lt;code class="js"&gt;myTable&lt;span class="paren"&gt;[&lt;/span&gt;&lt;span class="string"&gt;'% What stupid name!'&lt;/span&gt;&lt;span class="paren"&gt;]&lt;/span&gt;=someValue;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p class="contentfollows"&gt;That JS auto-creates and references previously-undefined properties can be dangerous, as mentioned above—the JS interpretter never yells at you if you attempt to read the value of, or go ahead and set the value of a property that just doesn't exist. On the other hand, this can be a real boon over compiled programming. For example, assume you are a web developer and you want to keep track of how many times the user changes the value of a certain text input (say, the quantity of items ordered). With a traditional compiled OOP language you'd need to subclass the input object and create a custom flavor that allows a &lt;code class="js"&gt;timesChanged&lt;/code&gt; property. With JavaScript, you simply write:&lt;/p&gt;

&lt;pre class="contentfollows"&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;myInput.timesChanged==null&lt;span class="paren"&gt;)&lt;/span&gt; myInput.timesChanged=&lt;span class="number"&gt;1&lt;/span&gt;;
&lt;span class="keyword"&gt;else&lt;/span&gt; myInput.timesChanged+=&lt;span class="number"&gt;1&lt;/span&gt;;&lt;/code&gt;&lt;/pre&gt;
&lt;p class="contentbefore"&gt;and the JS Interpretter creates that property for that object instance on the fly.&lt;/p&gt;

&lt;p class="contentfollows"&gt;Compared to those who know that you can create custom properties for any object on the fly, fewer know that you can create custom methods for objects just as easily and in virtually the same way. For example, the following is legal JavaScript code:&lt;/p&gt;
&lt;pre&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;function&lt;/span&gt; Poke&lt;span class="paren"&gt;(){&lt;/span&gt;
  alert&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'Owch! Stop that!'&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
&lt;span class="paren"&gt;}&lt;/span&gt;
myTable.poke = Poke; &lt;span class="comment"&gt;// When passing a &lt;span class="keyword"&gt;function&lt;/span&gt; as a pointer, do not use the &lt;span class="paren"&gt;()&lt;/span&gt; after the name&lt;/span&gt;

myTable.poke&lt;span class="paren"&gt;()&lt;/span&gt;;      &lt;span class="comment"&gt;// Using the parentheses invokes the method.&lt;/span&gt;

myTable.yellAttributes=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(){&lt;/span&gt; &lt;span class="comment"&gt;//This is known as creating an anonymous &lt;span class="keyword"&gt;function&lt;/span&gt; on the fly&lt;/span&gt;
  &lt;span class="keyword"&gt;var&lt;/span&gt; atts = &lt;span class="string"&gt;"border:"&lt;/span&gt;+this.border
             +&lt;span class="string"&gt;"; cellpadding:"&lt;/span&gt;+this.cellPadding
             +&lt;span class="string"&gt;"; cellspacing:"&lt;/span&gt;+this.cellSpacing;
  alert&lt;span class="paren"&gt;(&lt;/span&gt;atts&lt;span class="paren"&gt;)&lt;/span&gt;;

&lt;span class="paren"&gt;}&lt;/span&gt;
myTable.yellAttributes&lt;span class="paren"&gt;()&lt;/span&gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Extending an object by adding a custom method can be quite convenient, but it only applies to that particular object's instance. What if you wanted to modify the entire existing class to add new functionality? For this, we use the &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; property.&lt;/p&gt;



&lt;h2 id="prototype"&gt;The &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; Property&lt;/h2&gt;

&lt;p&gt;To add a property or method to an entire class of objects, the &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; property of the object class must be modified. The intrinsic object classes in JavaScript which have a &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; property are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Object&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;&lt;/b&gt; — Modifies both objects declared through the explicit &lt;code class="js"&gt;&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;Object&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;)&lt;/span&gt;&lt;/code&gt; contructor and the implicit object &lt;code class="js"&gt;&lt;span class="paren"&gt;{&lt;/span&gt;...&lt;span class="paren"&gt;}&lt;/span&gt;&lt;/code&gt; syntax. Additionally, all other intrinsic and user-defined objects inherit from &lt;code class="js"&gt;&lt;span class="keyword"&gt;Object&lt;/span&gt;&lt;/code&gt;, so properties/methods added/modified in &lt;code class="js"&gt;&lt;span class="keyword"&gt;Object&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; will affect all other intrinsic and user-defined objects.&lt;/li&gt;

&lt;li&gt;&lt;b&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;&lt;/b&gt; — modifies arrays created using either the explicit &lt;code class="js"&gt;&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;Array&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;)&lt;/span&gt;&lt;/code&gt; constructor or the implicit &lt;code class="js"&gt;&lt;span class="paren"&gt;[&lt;/span&gt;...&lt;span class="paren"&gt;]&lt;/span&gt;&lt;/code&gt; array syntax.&lt;/li&gt;

&lt;li&gt;&lt;b&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;String&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;&lt;/b&gt; — modifies strings created using either the explicit &lt;code class="js"&gt;&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;String&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;)&lt;/span&gt;&lt;/code&gt; constructor or the implicit &lt;code class="js"&gt;&lt;span class="string"&gt;"..."&lt;/span&gt;&lt;/code&gt; string literal syntax.&lt;/li&gt;

&lt;li&gt;&lt;b&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Number&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;&lt;/b&gt; — modifies numbers created using either the explicit &lt;code class="js"&gt;&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;Number&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;)&lt;/span&gt;&lt;/code&gt; constructor or with inline digits.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Date&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;&lt;/b&gt; — modifies date objects created with either the &lt;code class="js"&gt;&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;Date&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;)&lt;/span&gt;&lt;/code&gt; contructor.&lt;/li&gt;

&lt;li&gt;&lt;b&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Function&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;&lt;/b&gt; — modifies functions created using either the explicit &lt;code class="js"&gt;&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;Function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;)&lt;/span&gt;&lt;/code&gt; constructor or defined inline with &lt;code class="js"&gt;&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;){&lt;/span&gt;...&lt;span class="paren"&gt;}&lt;/span&gt;&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;&lt;b&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;RegExp&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;&lt;/b&gt; — modifies regular expression objects created using either the explicit &lt;code class="js"&gt;&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;RegExp&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;)&lt;/span&gt;&lt;/code&gt; constructor or the inline &lt;code class="js"&gt;/.../&lt;/code&gt; syntax.&lt;/li&gt;

&lt;li&gt;&lt;b&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Boolean&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;&lt;/b&gt; — applies to boolean objects created using the explicit &lt;code class="js"&gt;&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;Boolean&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;...&lt;span class="paren"&gt;)&lt;/span&gt;&lt;/code&gt; constructor or those created using inline &lt;code class="js"&gt;&lt;span class="keyword"&gt;true&lt;/span&gt;|&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;/code&gt; keywords or assigned as the results of a logical operator.&lt;/li&gt;

&lt;/ul&gt;
&lt;p&gt;Adding properties or methods to the &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; property of an object class makes those items immediately available to all objects of that class, even if those objects were created before the prototype property was modified.&lt;/p&gt;

&lt;p style="font-style: italic;"&gt;It is with great sadness that I must point out that Internet Explorer does not inherit its DHTML objects from &lt;code class="js"&gt;&lt;span class="keyword"&gt;Object&lt;/span&gt;&lt;/code&gt;, and I can find no way to modify the prototype for the class of any of its web-based objects. (For example, &lt;code class="js"&gt;window.&lt;span class="keyword"&gt;constructor&lt;/span&gt;&lt;/code&gt; is an empty property on IEWin6, whereas Mozilla 1.2 reports that &lt;code class="js"&gt;&lt;span class="keyword"&gt;Object&lt;/span&gt;&lt;/code&gt; is the constructor of the window object.) This is why above the terms "instrinsic" and "user-defined" are used to qualify the object types. If you want to make a custom method for all textareas on a page for IEWin, you need to extend the object using Microsoft's proprietary behaviors. For example, you would specify the following CSS rule &lt;code&gt;textarea { behavior:url(extendArea.htc) }&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note that adding a public property to a class of objects creates a single value which all instance objects share. However, modifying this value through &lt;code class="js"&gt;this.globalPropertyName&lt;/code&gt; will result in a local public property of the object being created and set. Modifications to the class-wide property must be made through the &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; property of the class. This is demonstrated in the following code snippet:&lt;/p&gt;
&lt;pre&gt;&lt;code class="js"&gt;
Person.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.populationCount=&lt;span class="number"&gt;0&lt;/span&gt;;
&lt;span class="keyword"&gt;function&lt;/span&gt; Person&lt;span class="paren"&gt;(&lt;/span&gt;name,sex&lt;span class="paren"&gt;){&lt;/span&gt;

  Person.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.populationCount++;
  this.getName=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(){&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; name &lt;span class="paren"&gt;}&lt;/span&gt;
  this.getSex=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(){&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; sex &lt;span class="paren"&gt;}&lt;/span&gt;

  this.setSex=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;newSex&lt;span class="paren"&gt;){&lt;/span&gt; &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;confirm&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'Really change the sex of "'&lt;/span&gt;+name+&lt;span class="string"&gt;'" to '&lt;/span&gt;+newSex+&lt;span class="string"&gt;'?'&lt;/span&gt;&lt;span class="paren"&gt;))&lt;/span&gt; sex=newSex; &lt;span class="paren"&gt;}&lt;/span&gt;

  this.kill=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(){&lt;/span&gt; Person.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.populationCount-- &lt;span class="paren"&gt;}&lt;/span&gt;
&lt;span class="paren"&gt;}&lt;/span&gt;
&lt;span class="keyword"&gt;var&lt;/span&gt; gk = &lt;span class="keyword"&gt;new&lt;/span&gt; Person&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'Gavin'&lt;/span&gt;,&lt;span class="string"&gt;'male'&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;

&lt;span class="keyword"&gt;var&lt;/span&gt; lrk = &lt;span class="keyword"&gt;new&lt;/span&gt; Person&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'Lisa'&lt;/span&gt;,&lt;span class="string"&gt;'female'&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;

&lt;span class="comment"&gt;//Following yields &lt;span class="string"&gt;"There are &lt;span class="number"&gt;2&lt;/span&gt; people in my world."&lt;/span&gt;&lt;/span&gt;

alert&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"There are "&lt;/span&gt;+gk.populationCount+&lt;span class="string"&gt;" people in my world."&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;

&lt;span class="comment"&gt;//Following creates a &lt;span class="keyword"&gt;new&lt;/span&gt; public property of &lt;span class="string"&gt;'gk'&lt;/span&gt; and sets it to &lt;span class="number"&gt;102&lt;/span&gt;&lt;/span&gt;
gk.populationCount+=&lt;span class="number"&gt;100&lt;/span&gt;;


&lt;span class="keyword"&gt;var&lt;/span&gt; geo = &lt;span class="keyword"&gt;new&lt;/span&gt; Person&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'George'&lt;/span&gt;,&lt;span class="string"&gt;'male'&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
alert&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'GK thinks there are '&lt;/span&gt;+gk.populationCount+&lt;span class="string"&gt;' people, but everyone &lt;span class="keyword"&gt;else&lt;/span&gt; knows there are '&lt;/span&gt;+lrk.populationCount+&lt;span class="string"&gt;' people.'&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;

&lt;span class="comment"&gt;//Above yields &lt;span class="string"&gt;"GK thinks there are &lt;span class="number"&gt;102&lt;/span&gt; people, but everyone &lt;span class="keyword"&gt;else&lt;/span&gt; knows there are &lt;span class="number"&gt;3&lt;/span&gt; people."&lt;/span&gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you use private properties (e.g. '&lt;code class="js"&gt;sex&lt;/code&gt;' above) in your object, you need private methods to access them (e.g. &lt;code class="js"&gt;getName&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; above). &lt;span class="warning"&gt;Note that these private methods eat up a lot of memory with each instantiation of the object, and so it's often better to be 'sloppy' by allowing your properties to be publically accessible, so that the accessor methods can be shared throughout the class's &lt;code class="js"&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt;, saving memory.&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;Following are a bunch of examples of useful ways to extend various intrinsic objects using the &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; property.&lt;/p&gt;

&lt;h2 id="example1"&gt;Example 1 — Adding &lt;code class="js"&gt;slice&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; to Arrays&lt;/h2&gt;
&lt;p&gt;The &lt;code class="js"&gt;slice&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; method of an array object returns a subsection of the array. While quite useful, this method was not part of the original ECMAScript specification, and not supported by all JavaScript interpretters. When writing code which may be run on older browsers where you'd like to slice some arrays, you can either write code which doesn't use this convenient method (an annoying approach) or you can roll your own implementation of &lt;code class="js"&gt;slice&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To do this propertly, we need to know exactly what the &lt;code class="js"&gt;slice&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; method does. From MSDN:

&lt;/p&gt;&lt;div style="margin-left: 2em;" class="docs"&gt;
&lt;code style="font-style: normal;"&gt;&lt;i&gt;arrayObj&lt;/i&gt;.slice(&lt;i&gt;start&lt;/i&gt;,[&lt;i&gt;end&lt;/i&gt;]);&lt;/code&gt;

  "The slice method copies up to, but not including, the element indicated by &lt;code class="js"&gt;end&lt;/code&gt;. If &lt;code class="js"&gt;start&lt;/code&gt; is negative, it is treated as &lt;code class="js"&gt;length&lt;/code&gt; + &lt;code class="js"&gt;start&lt;/code&gt; where &lt;code class="js"&gt;length&lt;/code&gt; is the length of the array. If &lt;code class="js"&gt;end&lt;/code&gt; is negative, it is treated as &lt;code class="js"&gt;length&lt;/code&gt; + &lt;code class="js"&gt;end&lt;/code&gt;. If &lt;code class="js"&gt;end&lt;/code&gt; is omitted, extraction continues to the end of &lt;code class="js"&gt;arrayObj&lt;/code&gt;. If &lt;code class="js"&gt;end&lt;/code&gt; occurs before &lt;code class="js"&gt;start&lt;/code&gt;, no elements are copied to the new array."

&lt;/div&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thus armed, following is a custom implementation of the &lt;code class="js"&gt;slice&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; method. By using &lt;code class="js"&gt;&lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; this method is made available to all array objects. Note that even if the following isn't the most efficient code possible, it will only be used on those few browsers where the &lt;code class="js"&gt;slice&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; method isn't available. (As it turns out, the implementation below is almost identical in speed to the built-in method.)&lt;/p&gt;
&lt;pre&gt;&lt;code class="js"&gt;&lt;span class="comment"&gt;//Only add this implementation &lt;span class="keyword"&gt;if&lt;/span&gt; one does not already exist.&lt;/span&gt;

&lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.slice==null&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.slice=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;start,end&lt;span class="paren"&gt;){&lt;/span&gt;

  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;start&amp;lt;&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; start=this.length+start; &lt;span class="comment"&gt;//&lt;span class="string"&gt;'this'&lt;/span&gt; refers to the object to which the &lt;span class="keyword"&gt;prototype&lt;/span&gt; is applied&lt;/span&gt;

  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;end==null&lt;span class="paren"&gt;)&lt;/span&gt; end=this.length;
  &lt;span class="keyword"&gt;else&lt;/span&gt; &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;end&amp;lt;&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; end=this.length+end;
  &lt;span class="keyword"&gt;var&lt;/span&gt; newArray=&lt;span class="paren"&gt;[]&lt;/span&gt;;
  &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; ct=&lt;span class="number"&gt;0&lt;/span&gt;,i=start;i&amp;lt;end;i++&lt;span class="paren"&gt;)&lt;/span&gt; newArray&lt;span class="paren"&gt;[&lt;/span&gt;ct++&lt;span class="paren"&gt;]&lt;/span&gt;=this&lt;span class="paren"&gt;[&lt;/span&gt;i&lt;span class="paren"&gt;]&lt;/span&gt;;
  &lt;span class="keyword"&gt;return&lt;/span&gt; newArray;

&lt;span class="paren"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see, the first three lines change the parameters passed in to values useful for the for loop, and then this method simply creates a new array, copies the desired items over one at a time, and then returns that new array as the result of the method. (Like most methods in JScript, the original object is not modified.)&lt;/p&gt;

&lt;p&gt;Examples of other useful methods which may not be present in older JS implementations that you may want to add to the Array object are &lt;code class="js"&gt;pop&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt;, &lt;code class="js"&gt;push&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt;, and &lt;code class="js"&gt;concat&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id="example2"&gt;Example 2 — Date Formatting&lt;/h2&gt;
&lt;p&gt;Outputting a lot of dates to the browser, and want to format them nicely? The following code adds a &lt;code class="js"&gt;customFormat&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; method to the &lt;code class="js"&gt;&lt;span class="keyword"&gt;Date&lt;/span&gt;&lt;/code&gt; class which allows you to have a &lt;code class="js"&gt;&lt;span class="keyword"&gt;Date&lt;/span&gt;&lt;/code&gt; object turn into a string formatted just the way you like. Simply include this small block of code (in a separate client-side library file, directly in your JS ASP page...whatever) and all date objects will suddenly be able to cleanly format themselves.&lt;/p&gt;
&lt;pre&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Date&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.customFormat=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;formatString&lt;span class="paren"&gt;){&lt;/span&gt;

  &lt;span class="keyword"&gt;var&lt;/span&gt; YYYY,YY,MMMM,MMM,MM,M,DDDD,DDD,DD,D,hhh,hh,h,mm,m,ss,s,ampm,dMod,th;
  YY = &lt;span class="paren"&gt;((&lt;/span&gt;YYYY=this.getFullYear&lt;span class="paren"&gt;())&lt;/span&gt;+&lt;span class="string"&gt;""&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;.substr&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;2&lt;/span&gt;,&lt;span class="number"&gt;2&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
  MM = &lt;span class="paren"&gt;(&lt;/span&gt;M=this.getMonth&lt;span class="paren"&gt;()&lt;/span&gt;+&lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;&amp;lt;&lt;span class="number"&gt;10&lt;/span&gt;?&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'&lt;span class="number"&gt;0&lt;/span&gt;'&lt;/span&gt;+M&lt;span class="paren"&gt;)&lt;/span&gt;:M;
  MMM = &lt;span class="paren"&gt;(&lt;/span&gt;MMMM=&lt;span class="paren"&gt;[&lt;/span&gt;&lt;span class="string"&gt;"January"&lt;/span&gt;,&lt;span class="string"&gt;"February"&lt;/span&gt;,&lt;span class="string"&gt;"March"&lt;/span&gt;,&lt;span class="string"&gt;"April"&lt;/span&gt;,&lt;span class="string"&gt;"May"&lt;/span&gt;,&lt;span class="string"&gt;"June"&lt;/span&gt;,&lt;span class="string"&gt;"July"&lt;/span&gt;,&lt;span class="string"&gt;"August"&lt;/span&gt;,&lt;span class="string"&gt;"September"&lt;/span&gt;,&lt;span class="string"&gt;"October"&lt;/span&gt;,&lt;span class="string"&gt;"November"&lt;/span&gt;,&lt;span class="string"&gt;"December"&lt;/span&gt;&lt;span class="paren"&gt;][&lt;/span&gt;M&lt;span class="number"&gt;-1&lt;/span&gt;&lt;span class="paren"&gt;])&lt;/span&gt;.substr&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;,&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
  DD = &lt;span class="paren"&gt;(&lt;/span&gt;D=this.getDate&lt;span class="paren"&gt;())&lt;/span&gt;&amp;lt;&lt;span class="number"&gt;10&lt;/span&gt;?&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'&lt;span class="number"&gt;0&lt;/span&gt;'&lt;/span&gt;+D&lt;span class="paren"&gt;)&lt;/span&gt;:D;
  DDD = &lt;span class="paren"&gt;(&lt;/span&gt;DDDD=&lt;span class="paren"&gt;[&lt;/span&gt;&lt;span class="string"&gt;"Sunday"&lt;/span&gt;,&lt;span class="string"&gt;"Monday"&lt;/span&gt;,&lt;span class="string"&gt;"Tuesday"&lt;/span&gt;,&lt;span class="string"&gt;"Wednesday"&lt;/span&gt;,&lt;span class="string"&gt;"Thursday"&lt;/span&gt;,&lt;span class="string"&gt;"Friday"&lt;/span&gt;,&lt;span class="string"&gt;"Saturday"&lt;/span&gt;&lt;span class="paren"&gt;][&lt;/span&gt;this.getDay&lt;span class="paren"&gt;()])&lt;/span&gt;.substr&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;,&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
  th=&lt;span class="paren"&gt;(&lt;/span&gt;D&amp;gt;=&lt;span class="number"&gt;10&lt;/span&gt;&amp;amp;&amp;amp;D&amp;lt;=&lt;span class="number"&gt;20&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;?&lt;span class="string"&gt;'th'&lt;/span&gt;:&lt;span class="paren"&gt;((&lt;/span&gt;dMod=D%&lt;span class="number"&gt;10&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;==&lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;?&lt;span class="string"&gt;'st'&lt;/span&gt;:&lt;span class="paren"&gt;(&lt;/span&gt;dMod==&lt;span class="number"&gt;2&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;?&lt;span class="string"&gt;'nd'&lt;/span&gt;:&lt;span class="paren"&gt;(&lt;/span&gt;dMod==&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;?&lt;span class="string"&gt;'rd'&lt;/span&gt;:&lt;span class="string"&gt;'th'&lt;/span&gt;;
  formatString = formatString.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#YYYY#"&lt;/span&gt;,YYYY&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#YY#"&lt;/span&gt;,YY&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#MMMM#"&lt;/span&gt;,MMMM&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#MMM#"&lt;/span&gt;,MMM&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#MM#"&lt;/span&gt;,MM&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#M#"&lt;/span&gt;,M&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#DDDD#"&lt;/span&gt;,DDDD&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#DDD#"&lt;/span&gt;,DDD&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#DD#"&lt;/span&gt;,DD&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#D#"&lt;/span&gt;,D&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#th#"&lt;/span&gt;,th&lt;span class="paren"&gt;)&lt;/span&gt;;

  h=&lt;span class="paren"&gt;(&lt;/span&gt;hhh=this.getHours&lt;span class="paren"&gt;())&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;h==&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; h=&lt;span class="number"&gt;24&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;h&amp;gt;&lt;span class="number"&gt;12&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; h-=&lt;span class="number"&gt;12&lt;/span&gt;;
  hh = h&amp;lt;&lt;span class="number"&gt;10&lt;/span&gt;?&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'&lt;span class="number"&gt;0&lt;/span&gt;'&lt;/span&gt;+h&lt;span class="paren"&gt;)&lt;/span&gt;:h;
  ampm=hhh&amp;lt;&lt;span class="number"&gt;12&lt;/span&gt;?&lt;span class="string"&gt;'am'&lt;/span&gt;:&lt;span class="string"&gt;'pm'&lt;/span&gt;;
  mm=&lt;span class="paren"&gt;(&lt;/span&gt;m=this.getMinutes&lt;span class="paren"&gt;())&lt;/span&gt;&amp;lt;&lt;span class="number"&gt;10&lt;/span&gt;?&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'&lt;span class="number"&gt;0&lt;/span&gt;'&lt;/span&gt;+m&lt;span class="paren"&gt;)&lt;/span&gt;:m;
  ss=&lt;span class="paren"&gt;(&lt;/span&gt;s=this.getSeconds&lt;span class="paren"&gt;())&lt;/span&gt;&amp;lt;&lt;span class="number"&gt;10&lt;/span&gt;?&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'&lt;span class="number"&gt;0&lt;/span&gt;'&lt;/span&gt;+s&lt;span class="paren"&gt;)&lt;/span&gt;:s;
  &lt;span class="keyword"&gt;return&lt;/span&gt; formatString.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#hhh#"&lt;/span&gt;,hhh&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#hh#"&lt;/span&gt;,hh&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#h#"&lt;/span&gt;,h&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#mm#"&lt;/span&gt;,mm&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#m#"&lt;/span&gt;,m&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#ss#"&lt;/span&gt;,ss&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#s#"&lt;/span&gt;,s&lt;span class="paren"&gt;)&lt;/span&gt;.replace&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"#ampm#"&lt;/span&gt;,ampm&lt;span class="paren"&gt;)&lt;/span&gt;;

&lt;span class="paren"&gt;}&lt;/span&gt;
&lt;span class="keyword"&gt;var&lt;/span&gt; now=&lt;span class="keyword"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;Date&lt;/span&gt;&lt;span class="paren"&gt;()&lt;/span&gt;;
alert&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"Today is "&lt;/span&gt;+now.customFormat&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'#DDDD#, #MMMM# #D##th#'&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;+&lt;span class="string"&gt;"\nThe time is "&lt;/span&gt;+now.customFormat&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="string"&gt;'#h#:#mm##ampm#'&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;+&lt;span class="string"&gt;"."&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;

&lt;/code&gt;&lt;/pre&gt;


&lt;h2 id="example3"&gt;Example 3 — Number Formatting&lt;/h2&gt;
&lt;p&gt;This example extends the &lt;code class="js"&gt;&lt;span class="keyword"&gt;Number&lt;/span&gt;&lt;/code&gt; class to support a few methods for attractive formatting. Notice how it extends the String class with a new method for inserting a substring.&lt;/p&gt;
&lt;pre&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Number&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.toCurrency=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;noFractions,currencySymbol,decimalSeparator,thousandsSeparator&lt;span class="paren"&gt;){&lt;/span&gt;

  &lt;span class="keyword"&gt;var&lt;/span&gt; n,startAt,intLen;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;currencySymbol==null&lt;span class="paren"&gt;)&lt;/span&gt; currencySymbol=&lt;span class="string"&gt;"$"&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;decimalSeparator==null&lt;span class="paren"&gt;)&lt;/span&gt; decimalSeparator=&lt;span class="string"&gt;"."&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;thousandsSeparator==null&lt;span class="paren"&gt;)&lt;/span&gt; thousandsSeparator=&lt;span class="string"&gt;","&lt;/span&gt;;
  n = this.round&lt;span class="paren"&gt;(&lt;/span&gt;noFractions?&lt;span class="number"&gt;0&lt;/span&gt;:&lt;span class="number"&gt;2&lt;/span&gt;,&lt;span class="keyword"&gt;true&lt;/span&gt;,decimalSeparator&lt;span class="paren"&gt;)&lt;/span&gt;;
  intLen=n.length-&lt;span class="paren"&gt;(&lt;/span&gt;noFractions?&lt;span class="number"&gt;0&lt;/span&gt;:&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;((&lt;/span&gt;startAt=intLen%&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;==&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; startAt=&lt;span class="number"&gt;3&lt;/span&gt;;
  &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; i=&lt;span class="number"&gt;0&lt;/span&gt;,len=&lt;span class="keyword"&gt;Math&lt;/span&gt;.ceil&lt;span class="paren"&gt;(&lt;/span&gt;intLen/&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;-&lt;span class="number"&gt;1&lt;/span&gt;;i&amp;lt;len;i++&lt;span class="paren"&gt;)&lt;/span&gt;n=n.insertAt&lt;span class="paren"&gt;(&lt;/span&gt;i*&lt;span class="number"&gt;4&lt;/span&gt;+startAt,thousandsSeparator&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="keyword"&gt;return&lt;/span&gt; currencySymbol+n;

&lt;span class="paren"&gt;}&lt;/span&gt;
&lt;span class="keyword"&gt;Number&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.toInteger=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;thousandsSeparator&lt;span class="paren"&gt;){&lt;/span&gt;
  &lt;span class="keyword"&gt;var&lt;/span&gt; n,startAt,intLen;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;thousandsSeparator==null&lt;span class="paren"&gt;)&lt;/span&gt; thousandsSeparator=&lt;span class="string"&gt;","&lt;/span&gt;;
  n = this.round&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;,&lt;span class="keyword"&gt;true&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
  intLen=n.length;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;((&lt;/span&gt;startAt=intLen%&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;==&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; startAt=&lt;span class="number"&gt;3&lt;/span&gt;;
  &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; i=&lt;span class="number"&gt;0&lt;/span&gt;,len=&lt;span class="keyword"&gt;Math&lt;/span&gt;.ceil&lt;span class="paren"&gt;(&lt;/span&gt;intLen/&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;-&lt;span class="number"&gt;1&lt;/span&gt;;i&amp;lt;len;i++&lt;span class="paren"&gt;)&lt;/span&gt;n=n.insertAt&lt;span class="paren"&gt;(&lt;/span&gt;i*&lt;span class="number"&gt;4&lt;/span&gt;+startAt,thousandsSeparator&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="keyword"&gt;return&lt;/span&gt; n;

&lt;span class="paren"&gt;}&lt;/span&gt;
&lt;span class="keyword"&gt;Number&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.round=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;decimals,returnAsString,decimalSeparator&lt;span class="paren"&gt;){&lt;/span&gt;
  &lt;span class="comment"&gt;//Supports &lt;span class="string"&gt;'negative'&lt;/span&gt; decimals, e.g. myNumber.round&lt;span class="paren"&gt;(&lt;/span&gt;-&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; rounds to the nearest thousand&lt;/span&gt;

  &lt;span class="keyword"&gt;var&lt;/span&gt; n,factor,breakPoint,whole,frac;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;!decimals&lt;span class="paren"&gt;)&lt;/span&gt; decimals=&lt;span class="number"&gt;0&lt;/span&gt;;
  factor=&lt;span class="keyword"&gt;Math&lt;/span&gt;.pow&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;10&lt;/span&gt;,decimals&lt;span class="paren"&gt;)&lt;/span&gt;;
  n=&lt;span class="paren"&gt;(&lt;/span&gt;this.valueOf&lt;span class="paren"&gt;()&lt;/span&gt;+&lt;span class="string"&gt;""&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;         &lt;span class="comment"&gt;//To get the internal value of an &lt;span class="keyword"&gt;Object&lt;/span&gt;, use the valueOf&lt;span class="paren"&gt;()&lt;/span&gt; method&lt;/span&gt;

  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;!returnAsString&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="keyword"&gt;Math&lt;/span&gt;.round&lt;span class="paren"&gt;(&lt;/span&gt;n*factor&lt;span class="paren"&gt;)&lt;/span&gt;/factor;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;!decimalSeparator&lt;span class="paren"&gt;)&lt;/span&gt; decimalSeparator=&lt;span class="string"&gt;"."&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;n==&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="string"&gt;"&lt;span class="number"&gt;0&lt;/span&gt;."&lt;/span&gt;+&lt;span class="paren"&gt;((&lt;/span&gt;factor+&lt;span class="string"&gt;""&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;.substr&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="paren"&gt;))&lt;/span&gt;;
  breakPoint=&lt;span class="paren"&gt;(&lt;/span&gt;n=&lt;span class="keyword"&gt;Math&lt;/span&gt;.round&lt;span class="paren"&gt;(&lt;/span&gt;n*factor&lt;span class="paren"&gt;)&lt;/span&gt;+&lt;span class="string"&gt;""&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;.length-decimals;
  whole = n.substr&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;,breakPoint&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;decimals&amp;gt;&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;){&lt;/span&gt;

     frac = n.substr&lt;span class="paren"&gt;(&lt;/span&gt;breakPoint&lt;span class="paren"&gt;)&lt;/span&gt;;
     &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;frac.length&amp;lt;decimals&lt;span class="paren"&gt;)&lt;/span&gt; frac=&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;Math&lt;/span&gt;.pow&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;10&lt;/span&gt;,decimals-frac.length&lt;span class="paren"&gt;)&lt;/span&gt;+&lt;span class="string"&gt;""&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;.substr&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;+frac;
     &lt;span class="keyword"&gt;return&lt;/span&gt; whole+decimalSeparator+frac;
  &lt;span class="paren"&gt;}&lt;/span&gt;&lt;span class="keyword"&gt;else&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; whole+&lt;span class="paren"&gt;((&lt;/span&gt;&lt;span class="keyword"&gt;Math&lt;/span&gt;.pow&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;10&lt;/span&gt;,-decimals&lt;span class="paren"&gt;)&lt;/span&gt;+&lt;span class="string"&gt;""&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;.substr&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="paren"&gt;))&lt;/span&gt;;

&lt;span class="paren"&gt;}&lt;/span&gt;

&lt;span class="keyword"&gt;String&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.insertAt=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;loc,strChunk&lt;span class="paren"&gt;){&lt;/span&gt;
  &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;this.valueOf&lt;span class="paren"&gt;()&lt;/span&gt;.substr&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;,loc&lt;span class="paren"&gt;))&lt;/span&gt;+strChunk+&lt;span class="paren"&gt;(&lt;/span&gt;this.valueOf&lt;span class="paren"&gt;()&lt;/span&gt;.substr&lt;span class="paren"&gt;(&lt;/span&gt;loc&lt;span class="paren"&gt;))&lt;/span&gt;

&lt;span class="paren"&gt;}&lt;/span&gt;

&lt;span class="keyword"&gt;var&lt;/span&gt; quantity=&lt;span class="number"&gt;1056&lt;/span&gt;;
&lt;span class="keyword"&gt;var&lt;/span&gt; costPer=&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="number"&gt;.9&lt;/span&gt;;
&lt;span class="keyword"&gt;var&lt;/span&gt; totalCost=quantity*costPer;
alert&lt;span class="paren"&gt;(&lt;/span&gt;quantity.toInteger&lt;span class="paren"&gt;()&lt;/span&gt;+&lt;span class="string"&gt;" items at "&lt;/span&gt;+costPer.toCurrency&lt;span class="paren"&gt;()&lt;/span&gt;+&lt;span class="string"&gt;" per item amounts to a total of "&lt;/span&gt;+totalCost.toCurrency&lt;span class="paren"&gt;())&lt;/span&gt;;

&lt;span class="comment"&gt;//Yields &lt;span class="string"&gt;"&lt;span class="number"&gt;1&lt;/span&gt;,&lt;span class="number"&gt;056&lt;/span&gt; items at $&lt;span class="number"&gt;3&lt;/span&gt;&lt;span class="number"&gt;.90&lt;/span&gt; per item amounts to a total of $&lt;span class="number"&gt;4&lt;/span&gt;,&lt;span class="number"&gt;118&lt;/span&gt;&lt;span class="number"&gt;.40&lt;/span&gt;"&lt;/span&gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;p class="ancillary"&gt;For a far terser, faster, and general purpose number formatter, see &lt;a href="http://web.archive.org/web/20080122210909/http://phrogz.net/JS/Number.prototype.format.js"&gt;Number.prototype.format.js&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id="example4"&gt;Example 4 — Boolean XOR&lt;/h2&gt;
&lt;p&gt;JavaScript provides a boolean AND operator (&lt;code class="js"&gt;&amp;amp;&amp;amp;&lt;/code&gt;), a boolean OR operator (&lt;code class="js"&gt;||&lt;/code&gt;), and a boolean NOT operator (&lt;code class="js"&gt;!&lt;/code&gt;). But it is missing a boolean XOR operation. (In English, XOR can be stated as "If A is true or B is true, but not if both are true.") The following simple code adds an &lt;code class="js"&gt;XOR&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; method to the Boolean object.&lt;/p&gt;

&lt;pre&gt;&lt;code class="js"&gt;&lt;span class="keyword"&gt;Boolean&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.XOR=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;bool2&lt;span class="paren"&gt;){&lt;/span&gt;
  &lt;span class="keyword"&gt;var&lt;/span&gt; bool1=this.valueOf&lt;span class="paren"&gt;()&lt;/span&gt;;
  &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;bool1==&lt;span class="keyword"&gt;true&lt;/span&gt; &amp;amp;&amp;amp; bool2==&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; || &lt;span class="paren"&gt;(&lt;/span&gt;bool2==&lt;span class="keyword"&gt;true&lt;/span&gt; &amp;amp;&amp;amp; bool1==&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="comment"&gt;//&lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;bool1 &amp;amp;&amp;amp; !bool2&lt;span class="paren"&gt;)&lt;/span&gt; || &lt;span class="paren"&gt;(&lt;/span&gt;bool2 &amp;amp;&amp;amp; !bool1&lt;span class="paren"&gt;)&lt;/span&gt;;&lt;/span&gt;

&lt;span class="paren"&gt;}&lt;/span&gt;
&lt;span class="keyword"&gt;true&lt;/span&gt;.XOR&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;; &lt;span class="comment"&gt;//returns a value of &lt;span class="keyword"&gt;true&lt;/span&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(The above method requires the passed value to be an actual boolean value to succeed. The second option, commented out, will attempt to cast &lt;code class="js"&gt;bool2&lt;/code&gt; to a boolean value for the comparison. If that line were used instead, values of &lt;code class="js"&gt;&lt;span class="number"&gt;0&lt;/span&gt;&lt;/code&gt;, &lt;code class="js"&gt;null&lt;/code&gt;, &lt;code class="js"&gt;&lt;span class="string"&gt;''&lt;/span&gt;&lt;/code&gt; and &lt;code class="js"&gt;undefined&lt;/code&gt; would be interpretted as &lt;code class="js"&gt;&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;/code&gt;, and other non-empty values such as &lt;code class="js"&gt;&lt;span class="number"&gt;1&lt;/span&gt;&lt;/code&gt; or &lt;code class="js"&gt;&lt;span class="string"&gt;"foo"&lt;/span&gt;&lt;/code&gt; will be interpretted as a value of &lt;code class="js"&gt;&lt;span class="keyword"&gt;true&lt;/span&gt;&lt;/code&gt;.)&lt;/p&gt;

&lt;h2 id="example5"&gt;Example 5 — Extending Arrays to Support Set Mathematics&lt;/h2&gt;
&lt;p&gt;The following code is presented as an example of a non-trivial expansion to the Array object which allows it to support Set Mathematics. It also shows a case where &lt;code class="js"&gt;&lt;span class="keyword"&gt;prototype&lt;/span&gt;&lt;/code&gt; can be used to overwrite existing implementations. (In this case, some browsers have an incorrect version of &lt;code class="js"&gt;&lt;span class="keyword"&gt;Array&lt;/span&gt;.splice&lt;span class="paren"&gt;()&lt;/span&gt;&lt;/code&gt; that doesn't return single-item arrays, but instead returns the item itself.)&lt;/p&gt;
&lt;pre&gt;&lt;code class="js"&gt;&lt;span class="comment"&gt;//This JavaScript library is copyright &lt;span class="number"&gt;2002&lt;/span&gt; by Gavin Kistner and Refinery, Inc.&lt;/span&gt;

&lt;span class="comment"&gt;//Reuse or modification permitted provided the previous line is included.&lt;/span&gt;
&lt;span class="comment"&gt;//mailto:gavin@refinery.com&lt;/span&gt;
&lt;span class="comment"&gt;//http://www.refinery.com/&lt;/span&gt;

&lt;span class="comment"&gt;/***************************************************************************************************
* JavaScript &lt;span class="keyword"&gt;Array&lt;/span&gt; Set Mathematics Library
* version &lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="number"&gt;.2&lt;/span&gt;&lt;span class="number"&gt;.1&lt;/span&gt;, April 26th, &lt;span class="number"&gt;2002&lt;/span&gt;  &lt;span class="paren"&gt;[&lt;/span&gt;IEMac5&lt;span class="number"&gt;.1&lt;/span&gt;-/IEWin5&lt;span class="number"&gt;.0&lt;/span&gt;-/OldNS .splice&lt;span class="paren"&gt;()&lt;/span&gt; replacement works properly&lt;span class="paren"&gt;]&lt;/span&gt;

*
* Methods: array1.union&lt;span class="paren"&gt;(&lt;/span&gt; array2 &lt;span class="paren"&gt;[&lt;/span&gt;,compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;
*          array1.subtract&lt;span class="paren"&gt;(&lt;/span&gt; array2 &lt;span class="paren"&gt;[&lt;/span&gt;,compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;

*          array1.intersect&lt;span class="paren"&gt;(&lt;/span&gt; array2 &lt;span class="paren"&gt;[&lt;/span&gt;,compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;
*          array1.exclusion&lt;span class="paren"&gt;(&lt;/span&gt; array2 &lt;span class="paren"&gt;[&lt;/span&gt;,compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;

*          array1.removeDuplicates&lt;span class="paren"&gt;(&lt;/span&gt; &lt;span class="paren"&gt;[&lt;/span&gt;compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;
*
*          array1.unsortedUnion&lt;span class="paren"&gt;(&lt;/span&gt; array2 &lt;span class="paren"&gt;[&lt;/span&gt;,compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;

*          array1.unsortedSubtract&lt;span class="paren"&gt;(&lt;/span&gt; array2 &lt;span class="paren"&gt;[&lt;/span&gt;,compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;
*          array1.unsortedIntersect&lt;span class="paren"&gt;(&lt;/span&gt; array2 &lt;span class="paren"&gt;[&lt;/span&gt;,compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;

*          array1.unsortedExclusion&lt;span class="paren"&gt;(&lt;/span&gt; array2 &lt;span class="paren"&gt;[&lt;/span&gt;,compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;
*          array1.unsortedRemoveDuplicates&lt;span class="paren"&gt;(&lt;/span&gt; &lt;span class="paren"&gt;[&lt;/span&gt;compareFunction&lt;span class="paren"&gt;]&lt;/span&gt; &lt;span class="paren"&gt;)&lt;/span&gt;

*
*
* Notes:   All methods &lt;span class="keyword"&gt;return&lt;/span&gt; a &lt;span class="string"&gt;'set'&lt;/span&gt; &lt;span class="keyword"&gt;Array&lt;/span&gt; where duplicates have been removed.
*
*          The union&lt;span class="paren"&gt;()&lt;/span&gt;, subtract&lt;span class="paren"&gt;()&lt;/span&gt;, intersect&lt;span class="paren"&gt;()&lt;/span&gt;, and removeDuplicates&lt;span class="paren"&gt;()&lt;/span&gt; methods
*          are faster than their &lt;span class="string"&gt;'unsorted'&lt;/span&gt; counterparts, but &lt;span class="keyword"&gt;return&lt;/span&gt; a sorted set:
*          &lt;span class="keyword"&gt;var&lt;/span&gt; a = &lt;span class="paren"&gt;[&lt;/span&gt;&lt;span class="string"&gt;'a'&lt;/span&gt;,&lt;span class="string"&gt;'e'&lt;/span&gt;,&lt;span class="string"&gt;'c'&lt;/span&gt;&lt;span class="paren"&gt;]&lt;/span&gt;;
*          &lt;span class="keyword"&gt;var&lt;/span&gt; b = &lt;span class="paren"&gt;[&lt;/span&gt;&lt;span class="string"&gt;'b'&lt;/span&gt;,&lt;span class="string"&gt;'c'&lt;/span&gt;,&lt;span class="string"&gt;'d'&lt;/span&gt;&lt;span class="paren"&gt;]&lt;/span&gt;;
*          a.unsortedUnion&lt;span class="paren"&gt;(&lt;/span&gt;b&lt;span class="paren"&gt;)&lt;/span&gt;  --&amp;gt;  &lt;span class="string"&gt;'a'&lt;/span&gt;,&lt;span class="string"&gt;'e'&lt;/span&gt;,&lt;span class="string"&gt;'c'&lt;/span&gt;,&lt;span class="string"&gt;'b'&lt;/span&gt;,&lt;span class="string"&gt;'d'&lt;/span&gt;

*          a.union&lt;span class="paren"&gt;(&lt;/span&gt;b&lt;span class="paren"&gt;)&lt;/span&gt;          --&amp;gt;  &lt;span class="string"&gt;'a'&lt;/span&gt;,&lt;span class="string"&gt;'b'&lt;/span&gt;,&lt;span class="string"&gt;'c'&lt;/span&gt;,&lt;span class="string"&gt;'d'&lt;/span&gt;,&lt;span class="string"&gt;'e'&lt;/span&gt;

*
*          Calling any of the methods on an array whose element pairs cannot all be
*          reliably ordered &lt;span class="paren"&gt;(&lt;/span&gt;objects &lt;span class="keyword"&gt;for&lt;/span&gt; which a &amp;lt; b, a &amp;gt; b, and a==b ALL &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="keyword"&gt;false&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;
*          will produce inaccurate results UNLESS the &lt;span class="paren"&gt;(&lt;/span&gt;usually&lt;span class="paren"&gt;)&lt;/span&gt; optional
*          &lt;span class="string"&gt;'compareFunction'&lt;/span&gt; parameter is passed. This should specify a custom
*          comparison &lt;span class="keyword"&gt;function&lt;/span&gt;, as required by the standard &lt;span class="keyword"&gt;Array&lt;/span&gt;.sort&lt;span class="paren"&gt;(&lt;/span&gt;myFunc&lt;span class="paren"&gt;)&lt;/span&gt; method
*          For example:
*          &lt;span class="keyword"&gt;var&lt;/span&gt; siblings = &lt;span class="paren"&gt;[&lt;/span&gt; &lt;span class="paren"&gt;{&lt;/span&gt;name:&lt;span class="string"&gt;'Dain'&lt;/span&gt;&lt;span class="paren"&gt;}&lt;/span&gt; , &lt;span class="paren"&gt;{&lt;/span&gt;name:&lt;span class="string"&gt;'Chandra'&lt;/span&gt;&lt;span class="paren"&gt;}&lt;/span&gt; , &lt;span class="paren"&gt;{&lt;/span&gt;name:&lt;span class="string"&gt;'Baird'&lt;/span&gt;&lt;span class="paren"&gt;}&lt;/span&gt; , &lt;span class="paren"&gt;{&lt;/span&gt;name:&lt;span class="string"&gt;'Linden'&lt;/span&gt;&lt;span class="paren"&gt;}&lt;/span&gt; &lt;span class="paren"&gt;]&lt;/span&gt;;
*          &lt;span class="keyword"&gt;var&lt;/span&gt; brothers = &lt;span class="paren"&gt;[&lt;/span&gt; &lt;span class="paren"&gt;{&lt;/span&gt;name:&lt;span class="string"&gt;'Dain'&lt;/span&gt;&lt;span class="paren"&gt;}&lt;/span&gt; , &lt;span class="paren"&gt;{&lt;/span&gt;name:&lt;span class="string"&gt;'Baird'&lt;/span&gt;&lt;span class="paren"&gt;}&lt;/span&gt; &lt;span class="paren"&gt;]&lt;/span&gt;;
*          &lt;span class="keyword"&gt;function&lt;/span&gt; compareNames&lt;span class="paren"&gt;(&lt;/span&gt;a,b&lt;span class="paren"&gt;){&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;a.name &amp;lt; b.name&lt;span class="paren"&gt;)&lt;/span&gt;?-&lt;span class="number"&gt;1&lt;/span&gt;:&lt;span class="paren"&gt;(&lt;/span&gt;a.name &amp;gt; b.name&lt;span class="paren"&gt;)&lt;/span&gt;?&lt;span class="number"&gt;1&lt;/span&gt;:&lt;span class="number"&gt;0&lt;/span&gt; &lt;span class="paren"&gt;}&lt;/span&gt;

*          &lt;span class="keyword"&gt;var&lt;/span&gt; sisters=siblings.unsortedSubtract&lt;span class="paren"&gt;(&lt;/span&gt;brothers, compareNames&lt;span class="paren"&gt;)&lt;/span&gt;;
*
***************************************************************************************************/&lt;/span&gt;


&lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.splice &amp;amp;&amp;amp; typeof&lt;span class="paren"&gt;([&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;]&lt;/span&gt;.splice&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;))&lt;/span&gt;==&lt;span class="string"&gt;"number"&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.splice = null;

&lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;!&lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.splice&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.splice = &lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;ind,cnt&lt;span class="paren"&gt;){&lt;/span&gt;

  &lt;span class="keyword"&gt;var&lt;/span&gt; len = this.length;
  &lt;span class="keyword"&gt;var&lt;/span&gt; arglen = arguments.length;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;arglen==&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; ind;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;typeof&lt;span class="paren"&gt;(&lt;/span&gt;ind&lt;span class="paren"&gt;)&lt;/span&gt;!= &lt;span class="string"&gt;"number"&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; ind = &lt;span class="number"&gt;0&lt;/span&gt;;
  &lt;span class="keyword"&gt;else&lt;/span&gt; &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;ind&amp;lt;&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; ind = &lt;span class="keyword"&gt;Math&lt;/span&gt;.max&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;,len+ind&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;ind&amp;gt;len&lt;span class="paren"&gt;){&lt;/span&gt;

     &lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;arglen&amp;gt;&lt;span class="number"&gt;2&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; ind=len;
     &lt;span class="keyword"&gt;else&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="paren"&gt;[]&lt;/span&gt;;
  &lt;span class="paren"&gt;}&lt;/span&gt;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;arglen&amp;lt;&lt;span class="number"&gt;2&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; cnt = len-ind;
  cnt = &lt;span class="paren"&gt;(&lt;/span&gt;typeof&lt;span class="paren"&gt;(&lt;/span&gt;cnt&lt;span class="paren"&gt;)&lt;/span&gt;==&lt;span class="string"&gt;"number"&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; ? &lt;span class="keyword"&gt;Math&lt;/span&gt;.max&lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="number"&gt;0&lt;/span&gt;,cnt&lt;span class="paren"&gt;)&lt;/span&gt; : &lt;span class="number"&gt;0&lt;/span&gt;;
  &lt;span class="keyword"&gt;var&lt;/span&gt; removeArray = this.slice&lt;span class="paren"&gt;(&lt;/span&gt;ind,ind+cnt&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="keyword"&gt;var&lt;/span&gt; endArray = this.slice&lt;span class="paren"&gt;(&lt;/span&gt;ind+cnt&lt;span class="paren"&gt;)&lt;/span&gt;;
  len = this.length = ind;
  &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; i=&lt;span class="number"&gt;2&lt;/span&gt;;i&amp;lt;arglen;i++&lt;span class="paren"&gt;)&lt;/span&gt; this&lt;span class="paren"&gt;[&lt;/span&gt;len++&lt;span class="paren"&gt;]&lt;/span&gt; = arguments&lt;span class="paren"&gt;[&lt;/span&gt;i&lt;span class="paren"&gt;]&lt;/span&gt;;
  &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; i=&lt;span class="number"&gt;0&lt;/span&gt;,endlen=endArray.length;i&amp;lt;endlen;i++&lt;span class="paren"&gt;)&lt;/span&gt; this&lt;span class="paren"&gt;[&lt;/span&gt;len++&lt;span class="paren"&gt;]&lt;/span&gt; = endArray&lt;span class="paren"&gt;[&lt;/span&gt;i&lt;span class="paren"&gt;]&lt;/span&gt;;
  &lt;span class="keyword"&gt;return&lt;/span&gt; removeArray;

&lt;span class="paren"&gt;}&lt;/span&gt;

&lt;span class="comment"&gt;//*** SORTED IMPLEMENTATIONS ***************************************************&lt;/span&gt;
&lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.union=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;a2,compareFunction&lt;span class="paren"&gt;){&lt;/span&gt;
  &lt;span class="keyword"&gt;return&lt;/span&gt; this.concat&lt;span class="paren"&gt;(&lt;/span&gt;a2?a2:null&lt;span class="paren"&gt;)&lt;/span&gt;.removeDuplicates&lt;span class="paren"&gt;(&lt;/span&gt;compareFunction&lt;span class="paren"&gt;)&lt;/span&gt;;

&lt;span class="paren"&gt;}&lt;/span&gt;
&lt;span class="keyword"&gt;Array&lt;/span&gt;.&lt;span class="keyword"&gt;prototype&lt;/span&gt;.subtract=&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span class="paren"&gt;(&lt;/span&gt;a2,compareFunction&lt;span class="paren"&gt;){&lt;/span&gt;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;!compareFunction&lt;span class="paren"&gt;)&lt;/span&gt; compareFunction=null;
  &lt;span class="keyword"&gt;var&lt;/span&gt; a1=this.removeDuplicates&lt;span class="paren"&gt;(&lt;/span&gt;compareFunction&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;!a2&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;return&lt;/span&gt; a1;
  &lt;span class="keyword"&gt;var&lt;/span&gt; a2=a2.removeDuplicates&lt;span class="paren"&gt;(&lt;/span&gt;compareFunction&lt;span class="paren"&gt;)&lt;/span&gt;;
  &lt;span class="keyword"&gt;var&lt;/span&gt; len2=a2.length;
  &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;compareFunction&lt;span class="paren"&gt;){&lt;/span&gt;

     &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; i=&lt;span class="number"&gt;0&lt;/span&gt;;i&amp;lt;a1.length;i++&lt;span class="paren"&gt;){&lt;/span&gt;
        &lt;span class="keyword"&gt;var&lt;/span&gt; src=a1&lt;span class="paren"&gt;[&lt;/span&gt;i&lt;span class="paren"&gt;]&lt;/span&gt;,found=&lt;span class="keyword"&gt;false&lt;/span&gt;,src;
        &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; j=&lt;span class="number"&gt;0&lt;/span&gt;;j&amp;lt;len2&amp;amp;&amp;amp;compareFunction&lt;span class="paren"&gt;(&lt;/span&gt;src2=a2&lt;span class="paren"&gt;[&lt;/span&gt;j&lt;span class="paren"&gt;]&lt;/span&gt;,src&lt;span class="paren"&gt;)&lt;/span&gt;!=&lt;span class="number"&gt;1&lt;/span&gt;;j++&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;compareFunction&lt;span class="paren"&gt;(&lt;/span&gt;src,src2&lt;span class="paren"&gt;)&lt;/span&gt;==&lt;span class="number"&gt;0&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="paren"&gt;{&lt;/span&gt; found=&lt;span class="keyword"&gt;true&lt;/span&gt;; break; &lt;span class="paren"&gt;}&lt;/span&gt;

        &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;found&lt;span class="paren"&gt;)&lt;/span&gt; a1.splice&lt;span class="paren"&gt;(&lt;/span&gt;i--,&lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
     &lt;span class="paren"&gt;}&lt;/span&gt;
  &lt;span class="paren"&gt;}&lt;/span&gt;&lt;span class="keyword"&gt;else&lt;/span&gt;&lt;span class="paren"&gt;{&lt;/span&gt;

     &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; i=&lt;span class="number"&gt;0&lt;/span&gt;;i&amp;lt;a1.length;i++&lt;span class="paren"&gt;){&lt;/span&gt;
        &lt;span class="keyword"&gt;var&lt;/span&gt; src=a1&lt;span class="paren"&gt;[&lt;/span&gt;i&lt;span class="paren"&gt;]&lt;/span&gt;,found=&lt;span class="keyword"&gt;false&lt;/span&gt;,src;
        &lt;span class="keyword"&gt;for&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;&lt;span class="keyword"&gt;var&lt;/span&gt; j=&lt;span class="number"&gt;0&lt;/span&gt;;&lt;span class="paren"&gt;(&lt;/span&gt;j&amp;lt;len2&lt;span class="paren"&gt;)&lt;/span&gt;&amp;amp;&amp;amp;&lt;span class="paren"&gt;(&lt;/span&gt;src&amp;gt;=&lt;span class="paren"&gt;(&lt;/span&gt;src2=a2&lt;span class="paren"&gt;[&lt;/span&gt;j&lt;span class="paren"&gt;]))&lt;/span&gt;;j++&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;src2==src&lt;span class="paren"&gt;)&lt;/span&gt; &lt;span class="paren"&gt;{&lt;/span&gt; found=&lt;span class="keyword"&gt;true&lt;/span&gt;; break; &lt;span class="paren"&gt;}&lt;/span&gt;

        &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="paren"&gt;(&lt;/span&gt;found&lt;span class="paren"&gt;)&lt;/span&gt; a1.splice&lt;span class="paren"&gt;(&lt;/span&gt;i--,&lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="paren"&gt;)&lt;/span&gt;;
     &lt;span class="paren"&gt;}&lt;/span&gt;
  &lt;span class="paren"&gt;}&lt;/span&gt;

  ret&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-6004604963866891205?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/itiDd07YZOitbsGpShRclBDY068/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/itiDd07YZOitbsGpShRclBDY068/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/itiDd07YZOitbsGpShRclBDY068/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/itiDd07YZOitbsGpShRclBDY068/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/TLcOADkl11Q" height="1" width="1"/&gt;</content><link rel="related" href="http://web.archive.org/web/20080122210909/http://phrogz.net/JS/Classes/ExtendingJavaScriptObjectsAndClasses.html#example2" title="Extending JavaScript Objects and Classes" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/6004604963866891205/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=6004604963866891205" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6004604963866891205?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6004604963866891205?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/TLcOADkl11Q/extending-javascript-objects-and.html" title="Extending JavaScript Objects and Classes" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/07/extending-javascript-objects-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YEQ3g8eyp7ImA9WxJWGE4.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-4269554015635097684</id><published>2009-06-24T14:41:00.004+05:30</published><updated>2009-06-24T14:48:22.673+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-24T14:48:22.673+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="iptables" /><title>To Forward all Traffic from one machine to another IPTABLES</title><content type="html">Following Rules are Required to Forward all Traffic From __YOURMACHINE__ to __NEWGATEWAY__&lt;br/&gt;
&lt;span style="font-weight: bold;"&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/sbin/iptables -t filter -I FORWARD -s __YOURMACHINE__ -i eth0 -p tcp -j ACCEPT&lt;/span&gt;&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-weight: bold;"&gt;/sbin/iptables -t nat -I PREROUTING -s __YOURMACHINE__ -i eth0 -p tcp -j ACCEPT&lt;/span&gt;&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-weight: bold;"&gt;/sbin/iptables -t mangle -I PREROUTING -s __YOURMACHINE__ -i eth0 -j ROUTE --oif eth0 --gw __NEWGATEWAY__&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-4269554015635097684?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iu06jLB27RzZmYr-SyR0mGX9s-E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iu06jLB27RzZmYr-SyR0mGX9s-E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/iu06jLB27RzZmYr-SyR0mGX9s-E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iu06jLB27RzZmYr-SyR0mGX9s-E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/U_s6HXpfOSg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/4269554015635097684/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=4269554015635097684" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/4269554015635097684?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/4269554015635097684?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/U_s6HXpfOSg/to-forward-all-traffic-from-one-machine.html" title="To Forward all Traffic from one machine to another IPTABLES" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/06/to-forward-all-traffic-from-one-machine.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YDQX86fip7ImA9WxJWEkk.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-8120339589590328936</id><published>2009-06-17T17:27:00.002+05:30</published><updated>2009-06-17T17:49:30.116+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-17T17:49:30.116+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><title>JavaScript Object Notation (JSON)</title><content type="html">&lt;pre&gt;Abstract

JavaScript Object Notation (JSON) is a lightweight, text-based,
language-independent data interchange format.  It was derived from
the ECMAScript Programming Language Standard.  JSON defines a small
set of formatting rules for the portable representation of structured
data.

&lt;span class="h2"&gt;&lt;h2&gt;&lt;a name="section-1"&gt;1&lt;/a&gt;.  Introduction&lt;/h2&gt;&lt;/span&gt;

JavaScript Object Notation (JSON) is a text format for the
serialization of structured data.  It is derived from the object
literals of JavaScript, as defined in the ECMAScript Programming
Language Standard, Third Edition [&lt;a href="http://tools.ietf.org/html/rfc4627#ref-ECMA" title="&amp;quot;ECMAScript Language Specification 3rd Edition&amp;quot;"&gt;ECMA&lt;/a&gt;].

JSON can represent four primitive types (strings, numbers, booleans,
and null) and two structured types (objects and arrays).

A string is a sequence of zero or more Unicode characters [&lt;a href="http://tools.ietf.org/html/rfc4627#ref-UNICODE" title="&amp;quot;The Unicode Standard Version 4.0&amp;quot;"&gt;UNICODE&lt;/a&gt;].

An object is an unordered collection of zero or more name/value
pairs, where a name is a string and a value is a string, number,
boolean, null, object, or array.

An array is an ordered sequence of zero or more values.

The terms "object" and "array" come from the conventions of
JavaScript.

JSON's design goals were for it to be minimal, portable, textual, and
a subset of JavaScript.


&lt;/pre&gt;&lt;h2&gt;Why JSON?&lt;/h2&gt;   &lt;p&gt;The benefit of JSON is that it is recognized natively by JavaScript. No need      for parsing an XML document to extract the data and get it throught the net.&lt;/p&gt;   &lt;p&gt;&lt;a name="JSON-XML"&gt;&lt;/a&gt;&lt;/p&gt;   &lt;h2&gt;JSON and XML&lt;/h2&gt;   &lt;p&gt;Benefits of JSON:
  - The easiness of reading.
  - The easiness of using.

  Benefits of XML:
  - XML is extensible.
  - It is widely used and recognized by almost all programming languages.

  Unfortunally, both XML and JSON are enable to integrate a large amount of      data in binary form. &lt;/p&gt;   &lt;p&gt;&lt;a name="Syntax"&gt;&lt;/a&gt;&lt;/p&gt;   &lt;h2&gt;The syntax of JSON&lt;/h2&gt;   &lt;p&gt;The components of JSON:
  - An object: contains objets or attributes.
  - A scalar variable: Number, String, Boolean.
  - An array.
  - Literal values: &lt;i&gt;null&lt;/i&gt;, &lt;i&gt;true&lt;/i&gt;, &lt;i&gt;false&lt;/i&gt;, "&lt;i&gt;string      of characters&lt;/i&gt;", and numerical values.&lt;/p&gt;   &lt;h3&gt;Object&lt;/h3&gt;   &lt;p&gt;It contains a member or a list of members, and each member has the form:&lt;/p&gt;   "name" : "value"   &lt;p&gt;The syntax of the object is:&lt;/p&gt;   { member, member, .... }   &lt;h3&gt;Array&lt;/h3&gt;   A collection of values, separated by commas.    [ value, value, ....]    &lt;h3&gt;Values&lt;/h3&gt;   &lt;p&gt;A value may be: an object, an array, a litteral (string, number, true, false,      null).&lt;/p&gt;   &lt;p&gt;Nothing more is required to create a JSON file!&lt;/p&gt;   &lt;p&gt;&lt;a name="Example"&gt;&lt;/a&gt;&lt;/p&gt;   &lt;h2&gt;Example of JSON file&lt;/h2&gt;   &lt;p&gt;A simple example, designing a menu:
  It is an object made of members that are an attribute and an array that holds      other objects, the rows of the menu.&lt;/p&gt;   &lt;pre&gt;

&lt;/pre&gt;
&lt;pre&gt;{
"menu": "File",
"commands": [
    {
        "title": "New",
        "action":"CreateDoc"
    },
    {
        "title": "Open",
        "action": "OpenDoc"
    },
    {
        "title": "Close",
        "action": "CloseDoc"
    }
 ]
}&lt;/pre&gt;
The XML equivalent:
&lt;pre&gt;&amp;lt;?xml version="1.0" ?&amp;gt;
&amp;lt;root&amp;gt;
&amp;lt;menu&amp;gt;File&amp;lt;/menu&amp;gt;

&amp;lt;commands&amp;gt;
   &amp;lt;item&amp;gt;
       &amp;lt;title&amp;gt;New&amp;lt;/value&amp;gt;
       &amp;lt;action&amp;gt;CreateDoc&amp;lt;/action&amp;gt;
   &amp;lt;/item&amp;gt;

   &amp;lt;item&amp;gt;
       &amp;lt;title&amp;gt;Open&amp;lt;/value&amp;gt;
       &amp;lt;action&amp;gt;OpenDoc&amp;lt;/action&amp;gt;
   &amp;lt;/item&amp;gt;
   &amp;lt;item&amp;gt;

       &amp;lt;title&amp;gt;Close&amp;lt;/value&amp;gt;
       &amp;lt;action&amp;gt;CloseDoc&amp;lt;/action&amp;gt;
   &amp;lt;/item&amp;gt;
&amp;lt;/commands&amp;gt;
&amp;lt;/root&amp;gt;&lt;/pre&gt;
&lt;h2&gt;How to use the format&lt;/h2&gt;   &lt;p&gt;The JSON file allows to load data from the server or to send data to it,      in this format. For example, storing the content of a form, just filled by      an user. This involves three steps: the browser processing, the server processing,      and the data exchange between them.&lt;/p&gt;   &lt;h3&gt;&lt;a name="Browser"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;h3&gt;Client side (browser)&lt;/h3&gt;   &lt;p&gt;This is rather easy, as JSON is a part of the JavaScript definition. The      content of a file, or the definition of the data is assigned to a variable,      and this variable becomes an object of the program.&lt;/p&gt;   &lt;h3&gt;&lt;a name="Server"&gt;&lt;/a&gt;Server side&lt;/h3&gt;   &lt;p&gt; JSON file are used by various programming languages, including PHP and Java      thanks to parsers that allow to get the content and that may even convert      it into classes and attributes of the language.
   The json.org includes a C parser and a list of parsers in other languages.&lt;/p&gt;   &lt;h3&gt;&lt;a name="Exchange"&gt;&lt;/a&gt;Data exchange&lt;/h3&gt;   &lt;p&gt;Loading a file may be accomplished from JavaScript in several ways:
   - direct including of the file into the HTML page, as a JavaScript .js external      file.
   - loading by a JavaScript command.
   - using XMLHttpRequest.
   The JSON file is parsed by the eval() JavaScript function.
 
   Sending the file to the server may be accomplished by &lt;a href="http://www.xul.fr/Objet-XMLHttpRequest.html" target="_parent"&gt;XMLHttpRequest&lt;/a&gt;.      The file is sent as a text file and processed by the parser of the programming      language that uses it.&lt;/p&gt;   &lt;h3&gt;&lt;a name="Example-using"&gt;&lt;/a&gt;Example&lt;/h3&gt;   &lt;p&gt;The XMLHttpRequest code:&lt;/p&gt;   &lt;pre&gt;var req = new XMLHttpRequest();
req.open("GET", "file.json", true);
req.onreadystatechange = myCode;   // the handler
req.send(null); &lt;/pre&gt;   &lt;p&gt;The JavaScript handler: &lt;/p&gt;   &lt;pre&gt;function myCode()
{
 if (req.readyState == 4)
 {
      var doc = eval('(' + req.responseText + ')');
 }
}
&lt;/pre&gt;   Using the data:    &lt;pre&gt;var menuName = document.getElementById('jsmenu');   // finding a field
menuName.value = doc.menu.value;           // assigning a value to the field
&lt;/pre&gt;   How to access data:    &lt;pre&gt;doc.commands[0].title      // read value of the "title" field in the array
doc.commands[0].action     // read value of the "action" field in the array&lt;/pre&gt;   &lt;p&gt;&lt;a name="Demo"&gt;&lt;/a&gt;&lt;/p&gt; 

&lt;a href="http://www.xul.fr/ajax-json-menu.html"&gt;For a Demo click here:&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-8120339589590328936?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Nd7SPkc0u8k5SUIDfYIVd-QnAHc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Nd7SPkc0u8k5SUIDfYIVd-QnAHc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Nd7SPkc0u8k5SUIDfYIVd-QnAHc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Nd7SPkc0u8k5SUIDfYIVd-QnAHc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/gQSdRzc05TE" height="1" width="1"/&gt;</content><link rel="related" href="http://en.wikipedia.org/wiki/JSON" title="JavaScript Object Notation (JSON)" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/8120339589590328936/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=8120339589590328936" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/8120339589590328936?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/8120339589590328936?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/gQSdRzc05TE/javascript-object-notation-json.html" title="JavaScript Object Notation (JSON)" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/06/javascript-object-notation-json.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8ASHg7cSp7ImA9WxJWEUk.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-4548627656259163999</id><published>2009-06-16T15:47:00.002+05:30</published><updated>2009-06-16T15:54:09.609+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-16T15:54:09.609+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="file partition" /><title>To add a partition which stores data in RAM of Linux</title><content type="html">__REQUIREDPATH__ means the path of the temporary partition which you want

&lt;ol&gt;&lt;li&gt;echo "tmpfs   __REQUIREDPATH__        tmpfs   rw,size=10M" &gt;&gt; /etc/fstab&lt;/li&gt;&lt;li&gt;mkdir     __REQUIREDPATH__&lt;/li&gt;&lt;li&gt;Change ownership appropiately
&lt;/li&gt;&lt;li&gt;mount -t tmpfs -o size=10m tmpfs  __REQUIREDPATH__&lt;/li&gt;&lt;/ol&gt;

Note: You will have to do the above steps again whenever your machine is rebooted. or add the above steps in /etc/rc.local


For Eg:
    __REQUIRESPATH__ = "/var/tempdata/"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-4548627656259163999?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nIaMxvubuNAuBBXlm-mU_JvU4OE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nIaMxvubuNAuBBXlm-mU_JvU4OE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nIaMxvubuNAuBBXlm-mU_JvU4OE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nIaMxvubuNAuBBXlm-mU_JvU4OE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/lqObp43arOk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/4548627656259163999/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=4548627656259163999" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/4548627656259163999?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/4548627656259163999?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/lqObp43arOk/to-add-partition-which-stores-data-in.html" title="To add a partition which stores data in RAM of Linux" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/06/to-add-partition-which-stores-data-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QDSXs7eip7ImA9WxJXFkw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-459143328896036592</id><published>2009-06-10T12:48:00.003+05:30</published><updated>2009-06-10T13:06:18.502+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-10T13:06:18.502+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><title>Superuser password Lost ?? &amp; Single user not working ??</title><content type="html">If "single user" mode doesn't let you in, then
&lt;ul&gt;&lt;li&gt;Boot a "live distro" CD, like Ubuntu&lt;/li&gt;&lt;li&gt;Obtain a commandline (run xterm or terminal or something)&lt;/li&gt;&lt;li&gt;Get root; with "live boot" distros, this is usually dead simple, as the root password is usually provided as part of the documentation&lt;/li&gt;&lt;li&gt;Mount your real root directory onto an unused directory of the live boot environment (i.e. onto /mnt). Make certain you mount it rw&lt;/li&gt;&lt;li&gt;cd to your newly-mounted root directory&lt;/li&gt;&lt;li&gt;Enter the following command: "chroot . /bin/bash" to obtain a command prompt that uses your newly-mounted root directory and /it's/ files (including it's etc/passwd and etc/shadow)&lt;/li&gt;&lt;li&gt;Enter the passwd command to change roots password. When you are done&lt;/li&gt;&lt;li&gt;Enter "exit" to quit the chroot shell&lt;/li&gt;&lt;li&gt;cd to the real /&lt;/li&gt;&lt;li&gt;Umount your installation's root directory&lt;/li&gt;&lt;li&gt;Shutdown and Reboot&lt;/li&gt;&lt;/ul&gt;
What this does is permit the password program from /your/ installation to
work on the password files from /your/ installation, by running everything
in an environment that starts with your installation as the root
filesystem. Up to the point where you chroot, you are just establishing a
running environment, but when you chroot, you have effectively
re-established /your/ installation, with access as root.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-459143328896036592?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3G0B-BsXZxcA1iyqBKHlCVfp99M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3G0B-BsXZxcA1iyqBKHlCVfp99M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3G0B-BsXZxcA1iyqBKHlCVfp99M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3G0B-BsXZxcA1iyqBKHlCVfp99M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/U2P2r_bOxag" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/459143328896036592/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=459143328896036592" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/459143328896036592?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/459143328896036592?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/U2P2r_bOxag/superuser-password-lost-single-user-not.html" title="Superuser password Lost ?? &amp; Single user not working ??" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/06/superuser-password-lost-single-user-not.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYFR308eSp7ImA9WxJXFU4.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-5655509982304987766</id><published>2009-06-09T13:02:00.002+05:30</published><updated>2009-06-09T13:08:36.371+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-09T13:08:36.371+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="networking" /><title>VLAN: Virtual Local Area Network and IEEE 802.1Q</title><content type="html">Definition of: &lt;span class="term_title"&gt;virtual LAN&lt;/span&gt; &lt;span id="intellitxt"&gt;

Also called a "VLAN," it is a logical subgroup within a local area network that is created via software rather than manually moving cables in the wiring closet. It combines user stations and network devices into a single unit regardless of the physical LAN segment they are attached to and allows traffic to flow more efficiently within populations of mutual interest.

VLANs are implemented in port switching hubs and LAN switches and generally offer proprietary solutions. VLANs reduce the time it takes to implement moves, adds and changes.

VLANs function at layer 2. Since their purpose is to isolate traffic within the VLAN, in order to bridge from one VLAN to another, a router is required. The router works at the higher layer 3 network protocol, which requires that network layer segments are identified and coordinated with the VLANs. This is a complicated job, and VLANs tend to break down as networks expand and more routers are encountered. The industry is working towards "virtual routing" solutions, which allows the network manager to view the entire network as a single routed entity.&lt;/span&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GciOeVn_TLE/Si4QOzpLryI/AAAAAAAADAY/atSe_mvioJY/s1600-h/VIRTLAN.GIF"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 269px;" src="http://3.bp.blogspot.com/_GciOeVn_TLE/Si4QOzpLryI/AAAAAAAADAY/atSe_mvioJY/s320/VIRTLAN.GIF" alt="" id="BLOGGER_PHOTO_ID_5345227654302510882" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-5655509982304987766?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nWmVEnQ3VttuhRRai4qrXr5_wso/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nWmVEnQ3VttuhRRai4qrXr5_wso/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nWmVEnQ3VttuhRRai4qrXr5_wso/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nWmVEnQ3VttuhRRai4qrXr5_wso/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/GAMv1zNLIZ4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/5655509982304987766/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=5655509982304987766" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/5655509982304987766?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/5655509982304987766?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/GAMv1zNLIZ4/vlan-virtual-local-area-network-and.html" title="VLAN: Virtual Local Area Network and IEEE 802.1Q" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_GciOeVn_TLE/Si4QOzpLryI/AAAAAAAADAY/atSe_mvioJY/s72-c/VIRTLAN.GIF" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/06/vlan-virtual-local-area-network-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkINRXo8eyp7ImA9WxJXFEo.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-6617663982599171226</id><published>2009-06-08T19:42:00.002+05:30</published><updated>2009-06-08T19:46:34.473+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-08T19:46:34.473+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="kernel" /><title>Understanding /etc/modules.conf</title><content type="html">&lt;h2&gt;Loading modules for the hardware&lt;/h2&gt; &lt;p&gt; All modules and settings are controlled in /etc/modules.conf for mandrake and /etc/conf.modules for redhat. Other methods are using the lilo.conf and /boot/grub/menu.lst. &lt;/p&gt; &lt;p&gt;By using the lilo.conf the modules are load as part of the kernel (built in), but the correct way of doing this is using the modules.conf file. &lt;/p&gt; &lt;p&gt; Before I go to the actual configuration, you may want to try some of these commands related to modules: &lt;/p&gt; &lt;table border="1" bordercolor="black" cellpadding="0" cellspacing="0" rules="all"&gt; &lt;tbody&gt;&lt;tr bgcolor="#c0c0c0"&gt;&lt;td&gt;Commands&lt;/td&gt;&lt;td&gt;   &lt;/td&gt;&lt;td&gt;Description&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td style=""&gt;/sbin/lsmod&lt;/td&gt;&lt;td&gt;      &lt;/td&gt;&lt;td&gt;Lists all configured modules on your system      &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td style=""&gt;/sbin/modprobe -l&lt;/td&gt;&lt;td&gt;   &lt;/td&gt;&lt;td&gt;Lists all available modules&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td style=""&gt;/sbin/modprobe -c&lt;/td&gt;&lt;td&gt;   &lt;/td&gt;&lt;td&gt;Lists all configured aliases&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td style=""&gt;/sbin/modprobe -r [module]      &lt;/td&gt;&lt;td&gt;   &lt;/td&gt;&lt;td&gt;Removes a loaded module rmmod&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td style=""&gt;/sbin/modprobe [module]&lt;/td&gt;&lt;td&gt;   &lt;/td&gt;&lt;td&gt;Loads a module same as insmod&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td style=""&gt;man modprobe&lt;/td&gt;&lt;td&gt;   &lt;/td&gt;&lt;td&gt;Loads the documentation for modprobe&lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; Note: &lt;i&gt;For all new modules downloaded or compiled must be moved &lt;b&gt;to /lib/modules/[kernel version]/&lt;/b&gt; for the system to be able to use it.&lt;/i&gt; &lt;/p&gt; &lt;p&gt; After moving the modules to the appropriate directory, run &lt;b&gt;depmod -a&lt;/b&gt; to let the system know about the new module, to test the module run this: modprobe [module name] if the module is loaded without error that means everything is OK. If you get any error messages, that means the module is wrong, or maybe the device is already running with the appropriate driver. Believe me it happens. &lt;/p&gt; &lt;p&gt; Modules loaded in the /etc/modules.conf, are loaded as alias of drivers. For example:  &lt;/p&gt; &lt;pre&gt;          Alias          Device          Driver
         &lt;b&gt;alias&lt;/b&gt;          &lt;b&gt;eth0&lt;/b&gt;            &lt;b&gt;8139too&lt;/b&gt; &lt;/pre&gt; &lt;p&gt;Many of the modules require further configurations, like I/O addresses and IRQ numbers. The following is an example of a parallel port assigned in the file modules.conf &lt;/p&gt; &lt;pre&gt;        &lt;b&gt;alias parport_lowlevel parport_pc&lt;/b&gt;
       &lt;b&gt;options parport_pc io=0x378 irq = 7&lt;/b&gt; &lt;/pre&gt; &lt;p&gt; It is very easy to identify, &lt;b&gt;io=0x378&lt;/b&gt; and &lt;b&gt;irq = 7,&lt;/b&gt; is the address and irq assigned to the first onboard parallel port in your system.  &lt;/p&gt; &lt;p&gt;When you install additional hardware in your system, you have to manually edit the modules.conf, unless hard drake allows you to configure it. &lt;/p&gt;  &lt;h3&gt;Step 2&lt;/h3&gt;  &lt;p&gt; &lt;b&gt;From the assumption of our next two-port installation we continue…&lt;/b&gt; &lt;/p&gt; &lt;p&gt; The &lt;b&gt;modules.conf&lt;/b&gt; already contains some information; edit it to add the new information. &lt;/p&gt; &lt;p&gt; &lt;span style=""&gt;This port1 (integrated on the motherboard):&lt;/span&gt; &lt;/p&gt; &lt;pre&gt;       &lt;b&gt;alias parport_lowlevel parport_pc&lt;/b&gt;
      &lt;b&gt;options parport_pc io=0x378 irq=7&lt;/b&gt; &lt;/pre&gt; &lt;p&gt; You could just add the parameters required in the same line or create it separately for each port.
&lt;span style=""&gt;Combination of the ports 1,2,3:&lt;/span&gt; &lt;/p&gt; &lt;pre&gt;&lt;b&gt;alias parport_lowlevel parport_pc&lt;/b&gt;
&lt;b&gt;options parport_pc io=0x378, 0x6400, 0x6500 irq=7, 5, auto&lt;/b&gt; &lt;/pre&gt; &lt;p&gt; As you can see in the &lt;b&gt;io=0x378, 0x6400, 0x650&lt;/b&gt;0 are the IO address for each parallel port1, port2 port3. The port2 and port3 belongs to the dual ports B&amp;amp;C. &lt;/p&gt; &lt;p&gt; The &lt;b&gt;IRQs= 7, 5, auto&lt;/b&gt; are assigned to the port1, port2 and port3. You can either set the IRQ number manually or set it to get first available IRQ automatically. &lt;/p&gt; &lt;p&gt; As I have already stated, you could also separate the settings as in the following: &lt;/p&gt; &lt;p&gt; Separation of ports by line &lt;/p&gt; &lt;pre&gt;       &lt;b&gt;alias parport_lowlevel parport_pc&lt;/b&gt;
      &lt;b&gt;options parport_pc io=0x378 irq=7&lt;/b&gt;
 
      &lt;b&gt;alias parport_lowlevel parport_pc&lt;/b&gt;
      &lt;b&gt;options parport_pc io=0x6400 irq=5&lt;/b&gt;

      &lt;b&gt;alias parport_lowlevel parport_pc&lt;/b&gt;
      &lt;b&gt;options parport_pc io=0x6500 irq=auto&lt;/b&gt; &lt;/pre&gt; &lt;p&gt;If you exit the editor and save the file, restart the system. The parallel ports lp0, lp1 and lp2 should be enabled now and is ready to use.
Other hardware may require special procedures, read the documentations or browse the web for help. You could also load modules or special configuration in other way such as search for it and execute it at boot time, this could be accomplished by creating a bash file.
Call it whatever you want, makes it +x executable and add it in /etc/rc.d/ Before you attempt the rc.d, try adding it in &lt;i&gt;/etc/modules&lt;/i&gt; this file is used to load from the kernel; as far as the documentation concerns. Note I am not referring to modules.conf, which is in the same directory.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight: bold; font-style: italic;font-size:180%;" &gt;&lt;span style="color: rgb(255, 0, 0);"&gt;IMPORTANT&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;&lt;h1&gt;Possible explanation to modules.conf alias
&lt;/h1&gt;&lt;pre&gt;The modules.conf mystery puzzled me. I decided to read the documentation
in the kernel sources. Here's what I found

&gt;From /usr/src/linux/Documentation/modules.txt
---------------------------------------------
Whenever a program wants the kernel to use a feature that is only
available as a loadable module, and if the kernel hasn't got the
module installed yet, the kernel will ask the kerneld daemon to take
care of the situation and make the best of it.

This is what happens:

       - The kernel notices that a feature is requested that is not
         resident in the kernel.
       - The kernel sends a message to kerneld, with a symbolic
         description of the requested feature.
       - The kerneld daemon asks e.g. modprobe to load a module that
         fits this symbolic description.
--------
Here's the important point that I think solves the mystery:
--------
       - modprobe looks into its internal "alias" translation table
         to see if there is a match.  This table can be reconfigured
         and expanded by having "alias" lines in "/etc/modules.conf".
--------

So, as I see it, the ppp aliases *should* already be in modprobe's
internal alias translation table. People with older versions of modutils
might not have it in their modprobe's alias tables, and so would need
the alias lines in /etc/modules.conf .

(NOTE: The following documentation file is a bit old, but it is still
relevant. There is no longer a kerneld daemon, IIRC, but I might be
mistaken.)

Important Note was added by
Jan Michael Ibanez
Student, University of Asia &amp;amp; the Pacific&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-6617663982599171226?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iX7k5r1YaqjRos3v3syZYLEPA30/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iX7k5r1YaqjRos3v3syZYLEPA30/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/iX7k5r1YaqjRos3v3syZYLEPA30/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iX7k5r1YaqjRos3v3syZYLEPA30/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/W1rEuafYrpk" height="1" width="1"/&gt;</content><link rel="related" href="http://linmodems.technion.ac.il/archive-third/msg01198.html" title="Understanding /etc/modules.conf" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/6617663982599171226/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=6617663982599171226" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6617663982599171226?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6617663982599171226?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/W1rEuafYrpk/understanding-etcmodulesconf.html" title="Understanding /etc/modules.conf" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/06/understanding-etcmodulesconf.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcAQn45eSp7ImA9WxJXEUw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-6991004502493579654</id><published>2009-06-03T12:03:00.003+05:30</published><updated>2009-06-04T16:27:23.021+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-04T16:27:23.021+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Perl" /><title>Perl (Practical Report and Extraction Language.)</title><content type="html">Today if have found a good link to learn Perl Script.
Click on the title to start Learning Perl&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-6991004502493579654?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ya6JY2T4Zyk78ZyDWnx3uhlPR5I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ya6JY2T4Zyk78ZyDWnx3uhlPR5I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ya6JY2T4Zyk78ZyDWnx3uhlPR5I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ya6JY2T4Zyk78ZyDWnx3uhlPR5I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/BE9ZNn1t9Fo" height="1" width="1"/&gt;</content><link rel="related" href="http://www.sthomas.net/roberts-perl-tutorial.htm" title="Perl (Practical Report and Extraction Language.)" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/6991004502493579654/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=6991004502493579654" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6991004502493579654?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6991004502493579654?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/BE9ZNn1t9Fo/perl-practical-report-and-extraction.html" title="Perl (Practical Report and Extraction Language.)" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/06/perl-practical-report-and-extraction.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcESXc8eyp7ImA9WxJXEUw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-3159689920145884707</id><published>2009-02-21T21:34:00.003+05:30</published><updated>2009-06-04T16:26:48.973+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-04T16:26:48.973+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tcpdump" /><category scheme="http://www.blogger.com/atom/ns#" term="networking" /><title>TCPDUMP</title><content type="html">TCPdump is a very powerful command line interface packet sniffer.



It must be launched as root or with superuser rights  because of the its use
 of the promiscuous mode or to be sure to have sufficent privilileges on a network device
 or a socket.



&lt;a href="http://www.blogger.com/wireshark.php"&gt;Wireshark&lt;/a&gt; (formerly ethereal)
can be used as an alternative to TCPdump but with a GUI interface. Wireshark can be used to read
the logs captured by TCPdump too.



&lt;table class="texte_petit"&gt;

 &lt;tbody&gt;&lt;tr&gt;
   &lt;td&gt;1. &lt;a href="http://www.blogger.com/post-edit.g?blogID=5094597816208395111&amp;amp;postID=3159689920145884707#tcp_down"&gt;TCPDUMP DOWNLOAD&lt;/a&gt;&lt;/td&gt;
   &lt;td width="50"&gt;
&lt;/td&gt;
   &lt;td&gt;2. &lt;a href="http://www.blogger.com/post-edit.g?blogID=5094597816208395111&amp;amp;postID=3159689920145884707#tcp_use"&gt;TCPDUMP USE&lt;/a&gt;&lt;/td&gt;
   &lt;td width="50"&gt;
&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;&lt;/table&gt;

&lt;a name="tcp_down"&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;&lt;hr align="center" width="550"&gt;
&lt;p class="texte_petit"&gt;




1. TCPDUMP DOWNLOAD:



&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To download TCPdump:


&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#apt-get install tcpdump
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To see the TCPdump dependencies:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;#apt-cache depends tcpdump
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;i&gt;
tcpdump

   Depends: libc6

   Depends: libpcap0.8

   Depends: libssl0.9.8
&lt;/i&gt;



&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To see the installed TCPdump version:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#apt-cache policy tcpdump&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;i&gt;
tcpdump:

   Installed: 3.9.4-2ubuntu0.1

   Candidate: 3.9.4-2ubuntu0.1

   Version table:

  *** 3.9.4-2ubuntu0.1 0

            500 http://security.ubuntu.com dapper-security/main Packages

            100 /var/lib/dpkg/status

         3.9.4-2 0

            500 http://ch.archive.ubuntu.com dapper/main Packages
&lt;/i&gt;

&lt;a name="tcp_use"&gt;&lt;/a&gt;
&lt;/p&gt;&lt;hr align="center" width="400"&gt;

&lt;p class="texte_petit"&gt;


2. TCPDUMP USE


&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To display the Standard TCPdump output:


&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;i&gt;
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes


21:57:29.004426 IP 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53


21:57:31.228013 arp who-has 192.168.1.2 tell 192.168.1.1

21:57:31.228020 arp reply 192.168.1.2 is-at 00:04:75:22:22:22 (oui Unknown)

21:57:38.035382 IP 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53

21:57:38.613206 IP valve-68-142-64-164.phx3.llnw.net.27014 &amp;gt; 192.168.1.2.1034: UDP, length 36
&lt;/i&gt;


&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To display the verbose output:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -v
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;


&lt;i&gt;
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes


22:00:11.625995 IP (tos 0x0, ttl 128, id 30917, offset 0, flags [none], proto: UDP (17), length: 81) 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53

22:00:20.691903 IP (tos 0x0, ttl 128, id 31026, offset 0, flags [none], proto: UDP (17), length: 81) 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53

22:00:21.230970 IP (tos 0x0, ttl 114, id 4373, offset 0, flags [none], proto: UDP (17), length: 64) valve-68-142-64-164.phx3.llnw.net.27014 &amp;gt; 192.168.1.2.1034: UDP, length 36

22:00:26.201715 arp who-has 192.168.1.2 tell 192.168.1.1

22:00:26.201726 arp reply 192.168.1.2 is-at 00:04:11:11:11:11 (oui Unknown)

22:00:29.706020 IP (tos 0x0, ttl 128, id 31133, offset 0, flags [none], proto: UDP (17), length: 81) 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53

22:00:38.751355 IP (tos 0x0, ttl 128, id 31256, offset 0, flags [none], proto: UDP (17), length: 81) 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53

&lt;/i&gt;


&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; Network interfaces available for the capture:


&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -D
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;


&lt;i&gt;
1.eth0

2.any (Pseudo-device that captures on all interfaces)

3.lo
&lt;/i&gt;


&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To display numerical addresses rather than symbolic (DNS) addresses:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -n
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;


&lt;i&gt;
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes


22:02:36.111595 IP 192.168.1.2.1034 &amp;gt; 68.142.64.164.27014: UDP, length 53

22:02:36.669853 IP 68.142.64.164.27014 &amp;gt; 192.168.1.2.1034: UDP, length 36

22:02:41.702977 arp who-has 192.168.1.2 tell 192.168.1.1

22:02:41.702984 arp reply 192.168.1.2 is-at 00:04:11:11:11:11


22:02:45.106515 IP 192.168.1.2.1034 &amp;gt; 68.142.64.164.27014: UDP, length 53

22:02:50.392139 IP 192.168.1.2.138 &amp;gt; 192.168.1.255.138: NBT UDP PACKET(138)

22:02:54.139658 IP 192.168.1.2.1034 &amp;gt; 68.142.64.164.27014: UDP, length 53

22:02:57.866958 IP 125.175.131.58.3608 &amp;gt; 192.168.1.2.9501: S 3275472679:3275472679(0) win 65535 &lt;mss sackok=""&gt;
&lt;/mss&gt;&lt;/i&gt;


&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To display the quick output:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -q
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;i&gt;
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes


22:03:55.594839 IP a213-22-130-46.cpe.netcabo.pt.3546 &amp;gt; 192.168.1.2.9501: tcp 0

22:03:55.698827 IP 192.168.1.2.9501 &amp;gt; a213-22-130-46.cpe.netcabo.pt.3546: tcp 0

22:03:56.068088 IP a213-22-130-46.cpe.netcabo.pt.3546 &amp;gt; 192.168.1.2.9501: tcp 0

22:03:56.068096 IP 192.168.1.2.9501 &amp;gt; a213-22-130-46.cpe.netcabo.pt.3546: tcp 0


22:03:57.362863 IP 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53

22:03:57.964397 IP valve-68-142-64-164.phx3.llnw.net.27014 &amp;gt; 192.168.1.2.1034: UDP, length 36

22:04:06.406521 IP 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53

22:04:15.393757 IP 192.168.1.2.1034 &amp;gt; valve-68-142-64-164.phx3.llnw.net.27014: UDP, length 53
&lt;/i&gt;


&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; Capture the traffic of a particular interface:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;

tcpdump -i eth0
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To capture the UDP traffic:


&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump udp
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To capture the TCP port 80 traffic:


&lt;table class="texte_table1"&gt;

&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;#tcpdump port http
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To capture the traffic from a filter stored in a file:


&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -F file_name
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

To create a file where the filter is configured (here the TCP 80 port)


&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#vim file_name
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
port 80
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;


&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To stop the capture after 20 packets:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -c 20
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;



&lt;img src="http://www.blogger.com/image/carre.gif" /&gt;To send the capture output in a file instead of directly on the screen:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -w capture.log
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To read a capture file:


&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -r capture.log
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;i&gt;
reading from file capture.log, link-type EN10MB (Ethernet)


09:33:51.977522 IP 192.168.1.36.40332 &amp;gt; rr.knams.wikimedia.org.www: P 1548302662:1548303275(613) ack 148796145 win 16527 &lt;nop,nop,timestamp 90351="" 151123756=""&gt;


09:33:52.031729 IP rr.knams.wikimedia.org.www &amp;gt; 192.168.1.36.40332: . ack 613 win 86 &lt;nop,nop,timestamp 151126015="" 90351=""&gt;

09:33:52.034414 IP rr.knams.wikimedia.org.www &amp;gt; 192.168.1.36.40332: P 1:511(510) ack 613 win86 &lt;nop,nop,timestamp 151126015="" 90351=""&gt;

09:33:52.034786 IP 192.168.1.36.40332 &amp;gt; rr.knams.wikimedia.org.www: . ack 511 win 16527 &lt;nop,nop,timestamp 90372="" 151126015=""&gt;
&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/i&gt;


The captured data isn't stored in plain text so you cannot read it with a text editor,
you have to use a special tool like TCPdump (see above) or
&lt;a href="http://www.blogger.com/wireshark.php"&gt;Wireshark&lt;/a&gt; (Formerly Ethereal) which provides a
 graphical interface.




 The capture.log file is opened with Wireshark.



&lt;table style="border: 1px solid black;"&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;
&lt;a href="http://www.blogger.com/image/tcpdump_wireshark.gif"&gt;&lt;img src="http://www.blogger.com/image/tcpdump_wireshark_small.gif" /&gt;&lt;/a&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;



&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To display the packets having "www.openmaniak.com" as their source or destination address:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt; 

#tcpdump host www.openmaniak.com
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To display the FTP packets coming from 192.168.1.100 to 192.168.1.2:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump src 192.168.1.100 and dst 192.168.1.2 and port ftp
&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;img src="http://www.blogger.com/image/carre.gif" /&gt; To display the packets content:



&lt;table class="texte_table1"&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;
#tcpdump -A

&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;


Packets capture during a FTP connection. The FTP password can be easily
intercepted because it is sent in clear text to the server.



&lt;i&gt;
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on ath0, link-type EN10MB (Ethernet), capture size 96 bytes

20:53:24.872785 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: S 4155598838:4155598838(0) win 5840 &lt;mss timestamp="" 241599="" wscale="" 5=""&gt;

....g....................

............

20:53:24.879473 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: . ack 1228937421 win 183 &lt;nop,nop,timestamp 241601="" 0=""&gt;


....g.I@.............

........

20:53:24.881654 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: . ack 43 win 183 &lt;nop,nop,timestamp 241601="" 17742=""&gt;

....g.I@.......8.....

......EN

20:53:26.402046 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: P 0:10(10) ack 43 win 183 &lt;nop,nop,timestamp 241981="" 17742=""&gt;

....g.I@......`$.....

...=..ENUSER teddybear



20:53:26.403802 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: . ack 76 win 183 &lt;nop,nop,timestamp 241982="" 17758=""&gt;


....h.I@.............

...&amp;gt;..E^

20:53:29.169036 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: P 10:25(15) ack 76 win 183 &lt;nop,nop,timestamp 242673="" 17758=""&gt;

....h.I@......#c.....

......E^PASS wakeup



20:53:29.171553 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: . ack 96 win 183 &lt;nop,nop,timestamp 242673="" 17786=""&gt;

....h.I@.,...........

......Ez

20:53:29.171649 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: P 25:31(6) ack 96 win 183 &lt;nop,nop,timestamp 242674="" 17786=""&gt;


....h.I@.,...........

......EzSYST



20:53:29.211607 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: . ack 115 win 183 &lt;nop,nop,timestamp 242684="" 17786=""&gt;

....h.I@.?.....j.....

......Ez

20:53:31.367619 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: P 31:37(6) ack 115 win 183 &lt;nop,nop,timestamp 243222="" 17786=""&gt;

....h.I@.?...........

......EzQUIT



20:53:31.369316 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: . ack 155 win 183 &lt;nop,nop,timestamp 243223="" 17808=""&gt;


....h.I@.g...........

......E.

20:53:31.369759 IP ubuntu.local.40205 &amp;gt; 192.168.1.2.ftp: F 37:37(0) ack 156 win 183 &lt;nop,nop,timestamp 243223="" 17808=""&gt;

....h.I@.h.....e.....

......E.
&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/nop,nop,timestamp&gt;&lt;/mss&gt;&lt;/i&gt;




We see in this capture the FTP username (teddybear) and password (wakeup).


&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-3159689920145884707?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JjaFiUvG_k3o2cDsyOWs2YzhKwA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JjaFiUvG_k3o2cDsyOWs2YzhKwA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JjaFiUvG_k3o2cDsyOWs2YzhKwA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JjaFiUvG_k3o2cDsyOWs2YzhKwA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/a94FmcvaSVk" height="1" width="1"/&gt;</content><link rel="related" href="http://openmaniak.com/tcpdump.php" title="TCPDUMP" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/3159689920145884707/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=3159689920145884707" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/3159689920145884707?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/3159689920145884707?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/a94FmcvaSVk/tcpdump.html" title="TCPDUMP" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/02/tcpdump.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcMSH07cCp7ImA9WxJXEUw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-1519002859523035046</id><published>2009-02-12T17:23:00.006+05:30</published><updated>2009-06-04T16:28:09.308+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-04T16:28:09.308+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="Ip address" /><title>IP Address Range Function in Python</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_GciOeVn_TLE/SZQW9QR0rCI/AAAAAAAACeg/5GoFwMiOVuk/s1600-h/iprange.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 254px;" src="http://4.bp.blogspot.com/_GciOeVn_TLE/SZQW9QR0rCI/AAAAAAAACeg/5GoFwMiOVuk/s320/iprange.png" alt="" id="BLOGGER_PHOTO_ID_5301887902919470114" border="0" /&gt;&lt;/a&gt;
&lt;span&gt;
&lt;pre&gt;
def ipAddrRange(startAddr, endAddr):
 def incrAddr(addrList):
    addrList[3] += 1
    for i in (3,2,1):
      if addrList[i] == 256:
         addrList[i] = 0
         addrList[i-1] += 1
 def asString(addrList):
     return ".".join(map(str,addrList))
 startAddrList = map(int,startAddr.split("."))
 endAddrList = map(int,endAddr.split("."))
 curAddrList = startAddrList[:]
 yield asString(curAddrList)
 for i in range(4):
     while curAddrList[i] &amp;lt; endAddrList[i]:
         incrAddr(curAddrList)
         yield asString(curAddrList)

for addr in ipAddrRange("10.255.255.250","11.0.0.20"):
print addr


&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-1519002859523035046?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8Ndbaw-NaGxV5fyXEemhrSU2vGU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8Ndbaw-NaGxV5fyXEemhrSU2vGU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8Ndbaw-NaGxV5fyXEemhrSU2vGU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8Ndbaw-NaGxV5fyXEemhrSU2vGU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/bgRd5-6hyN0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/1519002859523035046/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=1519002859523035046" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/1519002859523035046?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/1519002859523035046?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/bgRd5-6hyN0/def-ipaddrrangestartaddr-endaddr-def.html" title="IP Address Range Function in Python" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_GciOeVn_TLE/SZQW9QR0rCI/AAAAAAAACeg/5GoFwMiOVuk/s72-c/iprange.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/02/def-ipaddrrangestartaddr-endaddr-def.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYGRnY6fSp7ImA9WxJXEUw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-7150194087859936158</id><published>2009-02-12T15:05:00.003+05:30</published><updated>2009-06-04T16:28:47.815+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-04T16:28:47.815+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="email" /><category scheme="http://www.blogger.com/atom/ns#" term="ssh" /><title>E-mail Alert on Root SSH Login</title><content type="html">Want to be notified instantly when someone logs into your server as root? No problem, check out this nice tutorial on email notification for root logins. Keeping track of who logs into your server and when is very important, especially when you're dealing with the super user account. We recommend that you use an email address not hosted on the server your sending the alert from.
    &lt;p style="color: rgb(51, 102, 255);" class="textArialSpacing"&gt;So lets get started!&lt;/p&gt;

    &lt;ul&gt;&lt;li&gt;Login to your server and su to root.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;vim&lt;span class="textCodeBlueCourier"&gt; /root/.bashrc&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Scroll to the end of the file then add the following:&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: center;"&gt;&lt;span class="textCodeBlueCourier"&gt;                echo 'ALERT - Root Shell Access (YourserverName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" you@yourdomain.com&lt;/span&gt;
&lt;/div&gt;                  
&lt;ul&gt;&lt;li&gt;  Replace YourServerName with the handle for your actual server&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;  Replace you@yourdomain.com with your actual email address&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Now logout of SSH, close the connection and log back in! You should receive an email address of the root login alert a few minutes afterward&lt;span style="font-weight: bold;"&gt;s.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;      &lt;p class="textArialSpacing"&gt;&lt;span style="font-weight: bold;"&gt;Note:&lt;/span&gt; This is a great tool for servers that have multiple admins or if you give someone SSH access for whatever reason, although you should give out the root password to as few people as humanly possible and be sure to change it often.&lt;/p&gt;
    &lt;p class="textArialSpacing"&gt;This will not magically alert you when a hacker runs the latest kernel exploit on your server and logs into SSH because they will create their own SSH/telnet connection. You should keep your system up to date, install a firewall and follow the latest security releases.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-7150194087859936158?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/VnstelYqD0_ABzQTf522GzqcJ7Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VnstelYqD0_ABzQTf522GzqcJ7Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/VnstelYqD0_ABzQTf522GzqcJ7Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VnstelYqD0_ABzQTf522GzqcJ7Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/nZlfmfSXOqI" height="1" width="1"/&gt;</content><link rel="related" href="http://www.crucialp.com/resources/tutorials/secure-server-securing/email-alert-root-ssh-login-e-mail.php" title="E-mail Alert on Root SSH Login" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/7150194087859936158/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=7150194087859936158" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/7150194087859936158?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/7150194087859936158?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/nZlfmfSXOqI/e-mail-alert-on-root-ssh-login.html" title="E-mail Alert on Root SSH Login" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/02/e-mail-alert-on-root-ssh-login.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYMSHc-cSp7ImA9WxJXEUw.&quot;"><id>tag:blogger.com,1999:blog-5094597816208395111.post-6957669981488181910</id><published>2009-02-10T17:58:00.002+05:30</published><updated>2009-06-04T16:29:49.959+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-04T16:29:49.959+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="logs" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><title>How To Tail (View) Multiple Files on UNIX / Linux Console</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GciOeVn_TLE/SZF0t7hy7JI/AAAAAAAACeY/snhdMMEJ5_s/s1600-h/multitail.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 219px;" src="http://1.bp.blogspot.com/_GciOeVn_TLE/SZF0t7hy7JI/AAAAAAAACeY/snhdMMEJ5_s/s320/multitail.png" alt="" id="BLOGGER_PHOTO_ID_5301146568814161042" border="0" /&gt;&lt;/a&gt;
&lt;p&gt;tail is one of the best tool to view log files in a real time (tail -f /path/to/log.file). The  program  MultiTail  lets  you view one or multiple files like the original tail program. The difference is that it creates multiple windows on your console (with ncurses). This is one of those dream come true program for UNIX sys admin job. You can browse through several log files at once and do various operations like search for errors and much more.


&lt;span id="more-4399"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;Install MultiTail&lt;/h2&gt;
&lt;p&gt;Type the following command under &lt;strong&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;Debian / Ubuntu&lt;/span&gt;&lt;/strong&gt; Linux:

&lt;code&gt;$ sudo apt-get update

$ sudo apt-get install multitail&lt;/code&gt;

If you are using &lt;span style="color: rgb(255, 102, 0);"&gt;&lt;strong&gt;F&lt;/strong&gt;&lt;strong&gt;reeBSD&lt;/strong&gt;&lt;/span&gt;, enter:


&lt;code&gt;# portsnap fetch update

# cd /usr/ports/sysutils/multitail

# make install clean&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;How To View Multiple Files Like tail Command&lt;/h3&gt;
&lt;p&gt;To view /var/log/messages and /var/log/auth.log, enter:

&lt;code&gt;# multilog  /var/log/messages /var/log/auth.log&lt;/code&gt;

Sample output:


&lt;/p&gt;
&lt;h3&gt;How do I run a command and view a log file?&lt;/h3&gt;

&lt;p&gt;Simply use command as follows:

&lt;code&gt;# multitail /var/log/iptables.log -l "ping server.nixcraft.in"&lt;/code&gt;

OR

&lt;code&gt;# multitail /var/log/httpd.log -l "netstat -nat"&lt;/code&gt;

The -l option allows command  to  execute in a window. Do not forget to use "'s if the external command needs parameter! (e.g. -l "ping host").&lt;/p&gt;
&lt;h3&gt;How do I display 3 logfiles in 2 columns?&lt;/h3&gt;
&lt;p&gt;To see all 3 files related to anti mail server gateway, enter:

&lt;code&gt;# multitail -s 2 /var/log/maillog /var/log/FuzzyOcr.log /var/log/antivirus.log &lt;/code&gt;

multitail has many other useful options. Please read man page for further details:


&lt;code&gt;man multitail&lt;/code&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5094597816208395111-6957669981488181910?l=vinojdavis.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KJ6y68O8eMxKEHzSkUmd7X8fnoc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KJ6y68O8eMxKEHzSkUmd7X8fnoc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KJ6y68O8eMxKEHzSkUmd7X8fnoc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KJ6y68O8eMxKEHzSkUmd7X8fnoc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EnjoyUrTripToTechnology/~4/CZXx5mALURc" height="1" width="1"/&gt;</content><link rel="related" href="http://www.cyberciti.biz/tips/multitail-view-multiple-files-like-tail-command.html" title="How To Tail (View) Multiple Files on UNIX / Linux Console" /><link rel="replies" type="application/atom+xml" href="http://vinojdavis.blogspot.com/feeds/6957669981488181910/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5094597816208395111&amp;postID=6957669981488181910" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6957669981488181910?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5094597816208395111/posts/default/6957669981488181910?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EnjoyUrTripToTechnology/~3/CZXx5mALURc/how-to-tail-view-multiple-files-on-unix.html" title="How To Tail (View) Multiple Files on UNIX / Linux Console" /><author><name>ViNOJ DAViS</name><uri>http://www.blogger.com/profile/13233254953611727539</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="20" src="http://2.bp.blogspot.com/_GciOeVn_TLE/SfAs4zHgm5I/AAAAAAAAC9U/G6oulpQkMDo/S220/Building.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_GciOeVn_TLE/SZF0t7hy7JI/AAAAAAAACeY/snhdMMEJ5_s/s72-c/multitail.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://vinojdavis.blogspot.com/2009/02/how-to-tail-view-multiple-files-on-unix.html</feedburner:origLink></entry></feed>

