developer.com
Search EarthWeb
CodeGuru | Gamelan | Jars | Wireless | Discussions
Navigate developer.com
Architecture & Design  
Database  
Java
Languages & Tools
Microsoft & .NET
Open Source  
Project Management  
Security  
Techniques  
Voice  
Web Services  
Wireless/Mobile
XML  
Technology Jobs  

   Developer.com Webcasts:
  The Impact of Coding Standards and Code Reviews

  Project Management for the Developer

  Defining Your Own Software Development Methodology

  more Webcasts...




See the Winners!


Linked Data Planet Conference & Expo


Developer Jobs

Be a Commerce Partner
Imprinted Promotions
Promotional Pens
Free Business Cards
Promotional Gifts
Holiday Gift Ideas
Shop Online
Career Education
Online Education
Condos For Sale
Dental Insurance
KVM Switch over IP
Find Software
Disney World Tickets
Online Shopping

 


Download these IBM resources today!
e-Kit: IBM Rational Systems Development Solution
With systems teams under so much pressure to develop products faster, reduce production costs, and react to changing business needs quickly, communication and collaboration seem to get lost. Now, theres a way to improve product quality and communication.

Webcast: Asset Reuse Strategies for Success--Innovate Don't Duplicate!
Searching for, identifying, updating, using and deploying software assets can be a difficult challenge.

eKit: Rational Build Forge Express
Access valuable resources to help you increase staff productivity, compress development cycles and deliver better software, fast.

Download: IBM Data Studio v1.1
Effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life.

eKit: Rational Asset Manager
Learn how to do more with your reusable assets, learn how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse.
Developer News -
SaaS Tool Offers Custom Database Development    May 9, 2008
Microsoft’s Automated Agent: Can We Talk?    May 7, 2008
Borland Finally Sells CodeGear    May 7, 2008
Red Hat Heads For The JON 2.0    May 7, 2008
Free Tech Newsletter -

Best Practices for Developing a Web Site: Checklists, Tips, Strategies & More. Download Exclusive eBook Now.

NakovDocumentSigner: A System for Digitally Signing Documents in Web Applications
By Svetlin Nakov

Go to page: 1  2  3  4  5  Next  

NakovDocumentSigner is an example of putting the pieces of the puzzle together. NakovDocumentSigner is a freeware, open-source framework for digitally signing documents in Java-based Web applications developed at Sofia University "St. Kliment Ohridski" by Prof. Svetlin Nakov and his team. The framework consists of the following components:

  • A signed Java applet that is used to digitally sign files before uploading them to the server.
  • A reference Web application that receives the signed files, along with their digital signatures, and verifies whether the calculated signature corresponds to the received file and certificate.
  • A simple subsystem for certificate and certification chain verification, implemented as a part of the reference Web application.

The Signed Java Applet

The signed Java applet requires that Java Plug-In version 1.4 or later is installed on the client machine. This is necessary because the applet uses the Java Cryptography Architecture, which is unavailable in earlier versions of the Java Plug-In. The applet does not work with the standard virtual machine distributed with some versions of Internet Explorer. The applet is signed so that it can gain access to the user's local file system and works properly only if allowed to be executed with full rights.

The applet firmly follows the steps described in the previous part of this paper about signing documents and it represents, all in all, a button that is to be embedded in the HTML form for uploading files. It takes as parameters the field name wherefrom the file to be signed is taken and the names of the fields in which the calculated signature, the digital certificate, and the full certification chain should be written.

Obtaining Digital Certificates for Test Purposes

The client is supposed to have a digital certificate and a corresponding private key saved in a PFX file and the password to access this file should be the same as the one for the private key in it. Such PFX files can usually be obtained by purchasing a certificate from a certification authority.

For test purposes, some trial certificates can be used, such as the ones that are issued to potential customers by some well-known certification authorities, such as Thawte, VeriSign, and GlobalSign. By submitting a valid e-mail address, users can, absolutely free, get a certificate for digitally signing e-mails by Thawte. This can be done in just a few minutes at the address: http://www.thawte.com/html/COMMUNITY/personal/index.html. VeriSign issues trial certificates valid within 60 days upon submission of a valid e-mail address at http://www.verisign.com/client/enrollment/index.html. GlobalSign also offers trial certificates upon a valid e-mail address submission at http://secure.globalsign.net/ but theirs have a 30 day expiration period. All three of these certification authorities issue their certificates through the Internet and, as a result, users get them directly installed in their Web browsers. To use such certificates with NakovDocumentSigner, users have to export them from their Web browsers along with their associated private keys in a .PFX or a .P12 files.

DigitalSignerApplet—The Source Code

The source code of the applet that signs files before their uploading consists of several Java source-code files DigitalSignerApplet.java, CertificateFileAndPasswordDialog.java, and Base64Utils.java.

DigitalSignerApplet is available for free download as part of the NakovDocumentSigner framework from its official Web site http://www.nakov.com/documents-signing/. It is available in two forms: as source code and as a compiled and digitally signed .JAR file.

How DigitalSignerApplet Works

The applet extracts the selected file name from the HTML form where the applet is hosted, signs the file with the private key supplied by the user, and stores the calculated signature and user's certificate into the HTML form. This is done in several steps:

Step 1. Obtaining the Name of the File for Signing

Upon signing, the name of the file for signing and uploading is obtained from the HTML form. As we already know, the applet looks like a button that is placed in the HTML form for file uploading. The applet uses Java-to-JavaScript communication techniques to access the HTML document that hosts the applet. This communication is performed through the standard class netscape.javascript.JSObject.

A Few Words about the JSObject Class

The netscape.javascript.JSObject class is available for all browsers that support Java applet execution. It serves as a bridge between Java code running in applets hosted within the Web browser and JavaScript code and the HTML document object model of the browser.

JSObject converts Java objects to JavaScript objects and vice versa. Actually, JSObject creates Java wrappers for the JavaScript objects and coverts the primitive JavaScript types (such as int, string, and so forth) to their corresponding Java types. In the reverse direction, the JSObject class converts Java objects to JavaScript wrapper objects, coverts the primitive Java types to their corresponding primitive JavaScript types, and converts wrapped JavaScript objects (JSObject instances) back to their original JavaScript representation.

The most important methods of the JSObject class are:

  • getWindow()—a static method that returns an object that corresponds to the browser's window where the Java applet is running. It is used as a starting point for further accessing the browser's window and HTML document displayed in it.
  • eval()—returns the result of evaluating a JavaScript object. We use eval("document.forms[0]") to get access to the first HTML form in the HTML document that hosts the applet.
  • getMember()—returns the value of given JavaScript property of given JavaScript object.
  • setMember()—assigns a value to given JavaScript property of given JavaScript object. We use this method to set values to some fields in the HTML form.

Step 2. Reading the File for Signing

Next, the contents of the selected file for uploading file are read. If the file is freely readable, that means that the applet has enough security privileges to do its job.

Step 3. Choosing the Certificate Keystore File (.PFX File)

Next, the user is shown the dialog for choosing a PFX file and entering a password to access it. Later, this password is used twice—once to access the keystore and once to access the user's private key in it.

Step 4. Extracting the Private Key and Certification Chain from the .PFX File

After the PFX file is selected, it is read and the private key and corresponding certification chain are extracted. The chain always begins with the user's certificate but it is possible to consist of it only (that is, to not contain any other certificates). If the extraction of the private key and the certification chain from the PFX file is successful, the certification chain is appropriately encoded in text form to be transferred through a text field in the HTML form. Standard PkiPath encoding is used, that represents a series of ASN.1 DER-encoded certificates. The resultant certification chain is additionally encoded with Base64 to be rendered in text form.

Step 5. Signing the File

Afterwards, the signing itself takes place with the private key read from the PFX file. The digital signature thereupon obtained is encoded in text form with Base64 encoding. In the end, the text value of the certification chain extracted from the PFX file and the digital signature are written in certain fields in the HMTL form.

The fields' names in the HTML form accessed during the signing process are taken from parameters passed to the applet. The HTML document containing the signing applet is expected to have exactly one HMTL form.

Go to page: 1  2  3  4  5  Next  

Next article: Java Applet for Signing with a Smart Card


Tools:
Add www.developer.com to your favorites
Add www.developer.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed


Security Archives

Five Trends for Application Development. Download Your Complimentary Report. Exclusive. Act Now.
Whitepaper: Enterprise Information Integration--Deployment Best Practices for Low-Cost Implementation
Developing Intelligent Communications? Visit the Avaya DevConnect Center on DevX.
Best Practices for Developing a Web Site. Checklists, Tips & Strategies. Download Exclusive eBook Now.
Data Sheet: IBM Information Server Blade



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES