| By Wayne Graham | Article Rating: |
|
| September 15, 2004 12:00 AM EDT | Reads: |
42,219 |
To allow your users to provide their own public key to your public keyring, the importKey() method is particularly useful. By passing the importKey() method the public key you are able to store it for use on your public key ring. If the key is invalid, an error data stream is returned:
badKey = gpg.importKey("not a key");
<cfoutput><pre>#badKey#</pre></cfoutput>
which generates the following message:
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
If you would like to maintain your user's keys on the server, you can generate key pairs by invoking the newKey() method. This method takes several arguments: a real name, comment (helps differentiate people of the same name), e-mail address, expiration date (see comments for usage), and a passphrase. Again, since this method passes sensitive data, as do most methods in the GnuPG object, it is important to secure the transmission of that data via SSL. The newKey() method does take a few seconds to complete, as GnuPG implements complex mathematical algorithms to generate your public and secret keys.
Signing data is another important aspect of this wrapper. Signing allows others to verify that a data stream was not tampered with, be it a Web page, source file, image, or any other type of data stream. As with encrypt and decrypt, you utilize the sign/verify methods in the CFC.
signed = gpg.sign("Text to sign.", "passphrase");
verify = gpg.verify(signed);
The output from the verify variable will notify you if the signature matches the key ring. One potential use of this is to sign download files that you might host on your site. The examples included with this article show you how to create a file upload system that automatically signs files that you might have on your Web site for download. Also included, is a simple e-mail encryption example that allows you to quickly integrate encrypted e-mail into your existing ColdFusion e-mail application. Examples using this CFC and Java wrapper can be downloaded from www.sys-con.com/coldfusion/sourcec.cfm.
Conclusion
The CFC and Java wrappers for Gnu Privacy Guard make it nearly painless to integrate strong encryption into your programming projects. However, if you do not take the proper steps in encrypting transmission, or remain vigilant in your security implementation using strong key encryption methods as provided here, your work will be for naught. GnuPG does a very good job at securing data, as long as the passphrase is kept secret. Developing an encryption system that does not require user intervention will require the storage of passphrases in a database or other persistence mechanism. It is essential that this security issue be addressed during the design phase of your project, and that steps be taken to properly obfuscate the passphrases.
References
Published September 15, 2004 Reads 42,219
Copyright © 2004 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Wayne Graham
Wayne Graham is a systems administrator at the College of William and Mary's Earl Gregg Swem Library. Wayne is also the co-manager of the Williamsburg Macromedia User's Group and has been developing with ASP, Java, and ColdFusion since 2001.
![]() |
Thomas Gorgolione 07/23/08 05:05:27 PM EDT | |||
You have to compile the code manually from the zip file (see post #5). I did that already, so if you want you can just download it here: |
||||
![]() |
Jeff 01/31/08 08:07:47 AM EST | |||
Does anyone have the GnuPG.jar file? I found the CF component but that still needs the GnuPG.jar file to operate and the link in the article to get GnuPG.jar does not work. |
||||
![]() |
Shaun 09/04/07 02:21:25 PM EDT | |||
Found this: |
||||
![]() |
William Broadhead 07/21/05 03:00:51 PM EDT | |||
Good story. Very informative. One thing I would note is that in cf using the encrypt/decrypt: You don't have to, and shouldn't include the actual key in your code, NOR in your Database... A tecnnique I use is to store the key in a text file on the server in a directory that is accessible to coldfusion but NOT part of the http accessible directory. Using cffile you can read and load the information in the file to memory as an application key to use for hashing passwords while never having the key in your code nor in your database. Although obviously, as the article points out, security can never be completely infallible, this can reduce the capacity of your data to be compromised if you did somehow lose a copy of your database or page code, you would need also need to lose the file for someone to put it all together... |
||||
![]() |
Mark 07/14/05 01:53:05 PM EDT | |||
Great article, very well written. |
||||
![]() |
Brad 03/28/05 10:13:32 AM EST | |||
Great Article, convinced my peers to use this instead of upgrading to CF7Mx. As for the gentleman looking for the source, click the Source Code link located under Related Sites. Scroll down... you're welcome. |
||||
![]() |
Nguyen Tran 03/21/05 10:50:00 AM EST | |||
Where to download the file? GnuPG.jar The link you provided as: On this page, there is no link to download the file GnuPG.jar Please give us the link to download the file GnuPG.jar Thank you |
||||
![]() |
Tom 02/08/05 06:05:04 AM EST | |||
hello, i´ve the same problem: where is gnupg.jar? |
||||
![]() |
Shane 12/16/04 11:14:17 AM EST | |||
nevermind.... I found it. |
||||
![]() |
Shane 12/16/04 11:09:21 AM EST | |||
Great article. I've been looking forward to trying this out but haven't been able to find the gnupg.jar file. Am I overlooking it somewhere? Please advise. Thanks. |
||||
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe Fiddles with its Web Apps
- Adobe & Salesforce Cut Cloud Deal
- Hosting.com Launches ColdFusion 9 in the Cloud
- The Real Time Infrastructure Ultimatum
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF































