March 26th, 2008
I have been recently working on a plugin that provides ability to securely create, install and verify license for closed source grails applications. This plugin utilizes TrueLicense Library Collection (TLC). You can download the plugin here.
Installation
grails install-plugin <path-to-grails-license-0.1.zip>
Usage
- Generate license file: grails generate-license
- Start app: grails run-app
- Instal/verify license at http://localhost:8080/your_app/license. If you try to access your app without installing license, you will be redirected to this page.
Components
- /plugins/license-0.1/etc/privateKey.store - private key file. This never gets included in your WAR. (You should generate your own private/public keys with keytool command. see tips section below)
- /plugins/license-0.1/etc/LicensePrivateConfig.properties - holds all necessary configuration to create a license such as issuer, holder, validity etc. Again not included in WAR
- /plugins/license-0.1/conf/publicCerts.store - public key file. This is included in WAR
- /plugins/license-0.1/conf/LicensePublicConfig.groovy - holds all necessary information required for the client. Included in WAR
- /plugins/license-0.1/controller/LicenseController - Install, verify license
- /plugins/license-0.1/services/LicenseService - Install, verify license
- /plugins/license-0.1/conf/LicenseFilter - defines which controllers, actions need to be protected.
Tips
- To generate private key:
keytool -genkey -alias privatekey -keystore privateKeys.store
- To generate public key
keytool -export -alias privatekey -file certfile.cer -keystore privateKeys.store
keytool -import -alias publiccert -file certfile.cer -keystore publicCerts.store
- The system preferences are stored in the registry in windows and file system (/etc/.java/) in Linux. You may need appropriate permissions to be able to do this.
Posted in Tech | 2 Comments »
December 12th, 2007
Last year, I created a simple gadget to fetch my Picasa albums. Since then, I have received numerous requests to provide additional features and functionalities. While I continued to support the gadget and provided simple enhancements, I couldn’t find time to look at the major ones. Finally, I did spend some time and I have just released an updated version with the following features:
- Display random photos from Picasa albums at specified intervals
- Display description of the photo
- Auto width and height adjustment based on screen size
- Display private albums
- Display albums for your friends
- Complete player controls - play, pause, forward, rewind
If interested, check this out:

Posted in News | No Comments »
November 5th, 2007
Okay! You decided to have three OS on your machine. After experimenting with various procedures, this worked well for me. Here are the steps:
Note: This procedure involves re-partioning your system, hence you would lose your data. Please BACKUP your data before you try any of these.
I. Instal Mac OS X 10.4
- Boot your machine with Mac CD. From the Disk Utilities menu, make 3 partitions. I created partitions with sizes 16GB for Mac, 8GB for Windows and 13GB for Ubuntu.
- Format Mac partition with Mac OS X journaled, Windows partition with NTFS and Linux partition with Linux types.
- Instal Mac OS X on Mac partition.
II. Instal Windows
- Insert windows CD, make sure you select the windows partition.
- Just follow the instructions and complete the installation.
III. Instal Ubuntu Linux
- Restart the machine with Ubuntu Feisty CD.
- Select the linux partition. You may also need to create a 1GB partition for swap
- Follow instructions and complete installation.
Now restart the system. GRUB starts and you will have options to choose Ubuntu and Windows. But where is Mac option? Don’t panic! Log into Ubuntu. Add the following entry to /boot/grub/menu.lst
title Mac OS X (Tiger)
root (hd0,0)
makeactive
chainloader +1
Restart now. Hopefully you now have options to choose all three OS.
Posted in Tech | 5 Comments »
October 22nd, 2007
Last friday (10-19-2007), I became dad for the second time. Our daughter SAHANA was born. We are all pretty much excited.
More photos
Posted in News | No Comments »
September 6th, 2007
Recently I installed Ubuntu Feisty 7.04 on my Dell Latitude D600 laptop, but still had to do some work to get wireless working.
For those interested, here are the steps involved:
- Determine your Wireless card.
lspci | grep -i network
02:03.0 Network controller: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller (rev 03)
- Disable BCM43XX Driver
sudo -s
echo blacklist bcm43xx >> /etc/modprobe.d/blacklist
exit
- Instal ndiswrapper. This enables wireless network cards on Linux by implementing the Windows kernel and NDIS APIs and dynamically linking the vendor’s Windows drivers
sudo apt-get install ndiswrapper-utils
- Get your windows driver
wget http://ftp.us.dell.com/network/R151517.EXE
- Extract driver to MYDRIVER directory
unzip -a R151517.EXE
- Install the driver
cd MYDRIVER
sudo ndiswrapper -i bcmwl5.inf
- Verify driver, hardware
sudo ndiswrapper -l
- configure ndsiwrapper
sudo ndiswrapper -m
sudo modprobe ndiswrapper
sudo -s
echo ndiswrapper >> /etc/modules
exit
If this is your lucky day, you should have your wireless up and ready.
Posted in Tech | No Comments »
December 13th, 2006
This post provides step by setp instruction on implementing license management for Java web applications. I have used open source product TrueLicense for license management and aspects to weave the license verification into the code.
TrueLicense Library Collection(TLC) is a collection of Java packages to securely create, install and verify license for closed source products. TLC is rich in features - License can be perpetual or temparary, bound to users, systems or other entity, free trial period implementation, privacy of license content using password based encryption provided by Java Cryptography Extension (JCE), authenticity of license using digital signature mechanism provided by Java Security API etc.
How to implement License management
What you (Developer) need to do:
- You already have your web application (say HelloWorld) and you would like to implement License Management. If this is your case, read on.
- You may want to add a new page for licene management. The client should be able to see the validity of the current license, and instal new license from this page.
- Write an ascpect to verify license. The pointcut will specify the critical areas of the application. The right approach is to have the licence verification done in every critical functionality of the application. License verification is a ‘cross-cutting’ concern, and hence we can effectively use aspects to weave license verification into our code.
- Generate private and public key using keytool command.
- Generate license file. A license file contains encrypted, digitally signed information.
- Use AspectJ compiler to compile your application.
- Use a good Code Obfuscator, such as Proguard to guard against Decompilation tools. This is a very important step in real life situtation. If this step is skipped, hackers could exchange your public key and KeyStoreParam implementation with their their own code and bypass the license verification. Since this is a demo app and I’m lazy, this step is skipped.

- Build your application along with the public key.
- Distribute application and license file to your client. (NEVER give your private key)
What your client needs to do:
- Pays $$$ and buys your HelloWorld application
- Fires up the app, navigates to the licenese management page, instals the license file.
- Uses the app. If the license is expired or not installed, he will not be able to use the application.
Demo Application
The demo application can be used with Tomcat. Download LicenseDemo. Please refer README before using the demo app.
How to use this Demo
- Unzip HelloWorld-Licensed.zip
- Run ‘ant clean generateLicense’ from /buildtools folder. This creates a file called sample.lic
- Run ‘ant clean dist’. This creates HelloWorld-Licensed.war in dist folder.
- Drop the HelloWorld-Licensed.war file in your webapps folder of Tomcat installation. You are all done!
- Access the application by http://localhost:8080/HelloWorld-Licensed
First, access the Greetings page without installing license. The error message should be dislayed.
Next, instal sample.lic from the License management page and then access Greetings page. Later, allow the license to expire and access the Greetings page again.
Posted in Tech | No Comments »
November 23rd, 2006
What do you do on Thanksgiving day when you don’t cook turkey, everything is closed, its raining and too cold to go outside? Say bye to Win-doze and welcome Ubuntu.
I’m actually surprised that it has taken a long time to make this move ‘cos I use Linux/Unix a lot at work. Now, it feels great for two reasons:
- Ubuntu is cool and I love it
- No more blue screen of death!
Posted in News | No Comments »
August 30th, 2006
Did you ever had the requirement to run multiple JBoss instances on the same machine? Its a trivial task if you exactly know the parameters to be tweaked.
Carryout the following steps with your second instance (This is applicable for JBoss 4.0.3):
- default/deploy/jbossweb-tomcat55.sar/server.xml
- default/conf/jboss-service.xml
- change 1099 to 11099
- change 1098 to 11098
- change 4445 to 14445
- change 4444 to 14444
- default/conf/jboss-minimal.xml
- change 1099 to 11099
- change 1098 to 11098
- default/deploy/jms/uil2-service.xml
Voila! You’re done!!
Update (04/24/2008):
Many of you requested steps for current release of JBoss 4.2.2 GA, here it goes:
- deploy/jboss-web.deployer/server.xml
- change 8080 to 18080
- change 8443 to 18443
- change 8009 to 18009
- deploy/http-invoker.sar/META-INF/jboss-service.xml
- deploy/jbossws.sar/jbossws.beans/META-INF/jboss-beans.xml
- change 8080 to 18080
- change 8443 to 18443
- deploy/ejb3.deployer/META-INF/jboss-service.xml
- deploy/jms/uil2-service.xml
- conf/jboss-service.xml
- conf/jboss-minimal.xml
- change 1099 to 11099
- change 1098 to 11098
- conf/jboss-service.xml
- change 1099 to 11099
- change 1098 to 11098
- change 4444 to 14444
- change 4445 to 14445
- change 4446 to 14446
There can be many entries of these port numbers in these files. Make sure you change all of them.
Posted in Tech | 6 Comments »
July 18th, 2006
When you think of Web services, SOAP immediately comes to your mind. Not any more! Thanks to REST, there is a simpler way to develop web services. While SOAP is well established with most vendors supporting it, REST is really catching up.
Representational State Transfer (REST) is an architectural style for distributed hypermedia systems. REST relies on a single application protocol (HTTP), universal resource indicators (URI) and standardized data formats, through XML. It employs established HTTP methods such as GET and POST to direct applications.
I’m not attempting to explain the concept of REST, there are already enough stuff all over the Internet. You may have noticed that most of the Internet giants offer their services as REST web services. They may be good APIs but not RESTful.
What is not REST?
- APIs that involve Plain Old XML over HTTP are not necessarily REST.
- Using GET for all operations - including insert, updates etc is not REST
Creating a new Person resource:
GET myhost/api?action=create&item=person&name=mano |
Incorrect |
POST myhost/api/person
name=mano |
Correct |
- Not having distinct URI for first class objects is also a violation of the REST way.
Retrieving a Person resource
GET myhost/api?item=person&id=202 |
Incorrect |
GET myhost/api/person/202 |
Correct |
A RESTful service has use http methods such as POST, GET, PUT and DELETE to achieve the basic CRUD operations (create, read, update, and delete). All resources are identified using distinct URIs.
Framework in Java
I found Restlet to be a good framework. Restlet ensures that your application can easily be developed in a RESTful manner. Each concept of REST has a corresponding Java interface or class in the Restlet API. Another advantage is the ability to work with multiple protocols (HTTP, JDBC, SMTP, etc.) using the exact same API.
However, I could not find a good example for restlet + spring + tomcat integration, I took the liberty of writing one. You can download the restdemo application here. Just run ant, drop the WAR in your webapps folder - you are all set.
Download RestDemo ZIP
Posted in Tech | No Comments »
June 30th, 2006
We just became proud owners of our dream house. The house is 2-storied with 4 bedrooms, has a welcoming front yard, a huge private backyard, great schools and a lovely community. We are all quite excited about this.I hope to publish more pictures and videos of the house in near future.
Posted in News | No Comments »