In our project we had to encrypt all fields in the person table that can identify a person.
I found a nice framework that makes encryption quite easy called Jasypt and more specifically, it had very nice and easy configuration for Seam 2, which can be found here: Jasypt with Seam 2.
The problem however is that all our searches that we had created for the person fields that are now encrypted fail. For obvious reasons, you cannot compare (run LIKE) on encrypted fields.
But the user demanded to still be able to filter the search based on the encrypted values.
There are two theories on how I could do this.
The first, was to encrypt the user input and then try to find a match against the encrypted fields. However since Jasypt uses SALT I cannot easily do this because SALT generates x amount of random bytes and makes two equal values different chipertext. So to solve that I would have to remove the SALT and do the comparing. However we have very little time to solve this, so I went with the second option which I really wanted to avoid.
What I do know is create a query based on the values that are not encrypted and return the List. However, it is not certain that the user will enter one of the values that is not encrypted, so the search will then retrieve all Person objects, and then I loop through the List, decrypt the values (which Jasypt automatically does) and compare against what the user has inputted in the search criteria and then return the correct list.
This is a very cumbersome method to retrieve the List. Having all the Person objects in memory is not feasible. I will have to add some sort of caching so that it at least will be better when it is in production, but still this is something I would like to avoid. (Yes I know I have all the objects decrypted in the memory/cache, but I don't see any other solution)
If anyone has other ideas on how could be solved, then please leave a comment or contact me.
This blog is mainly about Java...
Friday, August 22, 2008
Friday, July 4, 2008
How to change the language of your Firefox
I have installed ubuntu on a HP Compaq 6910p for my mom. She is not so fluent in english, so she wanted everything in Norwegian. I thought first that it would be easy to install firefox in norwegian. Boy was I wrong. Yes, I can easily download firefox in the language I wanted, but I wanted to modify the already existing mozilla firefox that was in Ubuntu Hardy Heron. This because all the plugins and whatnot was already installed for me.
Anyways, about two days worth of Googling, and I found a way.
What you need to do is go to this page:
http://releases.mozilla.org/pub/mozilla.org/firefox/releases/
Then you want to find your version of firefox, choose xpi, and then the language you want for firefox, and voilla! Enjoy...
Anyways, about two days worth of Googling, and I found a way.
What you need to do is go to this page:
http://releases.mozilla.org/pub/mozilla.org/firefox/releases/
Then you want to find your version of firefox, choose xpi, and then the language you want for firefox, and voilla! Enjoy...
Labels:
firefox
Generating InnoDB engine and UTF-8 for MySQL using hibernate
I found these blogs:
http://blog.tremend.ro/2007/08/14/how-to-set-the-default-charset-to-utf-8-for-create-table-when-using-hibernate-with-java-persistence-annotations
and
http://neoexpedition.wordpress.com/2007/11/01/persisting-japanese-characters-in-db-using-hibernate
They had the same problem as me, on how to generate InnoDB engine and UTF-8 for MySQL through hibernate.
This is the solution for doing it:
In persistence.xml or hibernate.cfg.xml (depending on what you are using), you add this line to get InnoDB as engine.
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
or
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect">
if you are using MySQL 4.x.
To get utf8 as default charset, you have to create the database as default charset utf8 and hibernate will do that automatically for you.
create database foo default charset utf8;
http://blog.tremend.ro/2007/08/14/how-to-set-the-default-charset-to-utf-8-for-create-table-when-using-hibernate-with-java-persistence-annotations
and
http://neoexpedition.wordpress.com/2007/11/01/persisting-japanese-characters-in-db-using-hibernate
They had the same problem as me, on how to generate InnoDB engine and UTF-8 for MySQL through hibernate.
This is the solution for doing it:
In persistence.xml or hibernate.cfg.xml (depending on what you are using), you add this line to get InnoDB as engine.
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
or
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect">
if you are using MySQL 4.x.
To get utf8 as default charset, you have to create the database as default charset utf8 and hibernate will do that automatically for you.
create database foo default charset utf8;
Labels:
Hibernate,
InnoDB,
MySQL,
persistence.xml,
UTF-8
Sunday, June 15, 2008
Friday, May 23, 2008
Visiting Iran first time in 21 years (part 2)
Heading back from where I used to live, it was time for dinner. My aunt had made a list of all the food she knew to be good, and wanted me to choose which ones I liked. Mmmm. In hindsight, I shouldn't have eaten that much. I did gain a few kilos in the short period I was there :-DOh well....
Food like "Fesenghon", "Ghormesabsi", "Mirza Ghasemi", "Joje kabab", "Cholo kabab" and more are all coming back to me...
Party party party
But one thing that can never prepare you was the smoking. The house was filled with smoke. I had to go out and take fresh air every 10 minutes.
Not much more happened that evening. We ended the party quite early and went home singing in the car.
Here is a short video clip from that car...
The days that followed was spent on sightseeing in Tehran. I went to a big museum, which is a park and some castles of the old palace from the Shah time, plus some other cool stuff.
Here is some pictures from inside and outside of the museum.
These pictures are taken from outside of the museum. You can see the old cars which was used back during the Shah times.
These pictures are from inside of the castle. The rugs are hand made the one on the left was huge!
We also went to another castle where one could see The Marble Throne terrace.
It was a place where the former King used to receive gifts among other things when visitors came. There was also other gifts from Kings, Queens and other royalty as well as countries in one of the museums.
The king used to sit up on the throne and people would come from both sides and give gifts.
Here is right outside of the throne.
to be continued....
Subscribe to:
Posts (Atom)
Labels
- Seam (14)
- Java (11)
- Hibernate (5)
- JPA (4)
- Seam 2 (4)
- Seam 2.1.1 (4)
- Seam Series (4)
- Devoxx (3)
- EJB3 (3)
- JavaOne (3)
- MySQL (3)
- PDF (3)
- jodconverter (3)
- jodconverter 3 (3)
- axis2 (2)
- hash password (2)
- pdfa (2)
- sigar (2)
- swing (2)
- testng (2)
- webservice (2)
- AngularJS (1)
- Cache (1)
- Comment (1)
- Dropwizard (1)
- Encryption (1)
- Enum (1)
- Freemarker (1)
- Guava (1)
- IE8 (1)
- IdentityManager (1)
- InnoDB (1)
- Iran (1)
- JOOReport (1)
- JSF (1)
- Jasypt (1)
- JavaPolis (1)
- Memory (1)
- MyISAM (1)
- ODT (1)
- OSS (1)
- OpenOffice (1)
- REST (1)
- Seam book (1)
- Tehran (1)
- UTF-8 (1)
- Ubuntu hardy (1)
- Windows vista (1)
- ant (1)
- chess (1)
- damenes tale (1)
- filters (1)
- firefox (1)
- html cache (1)
- interceptor (1)
- java 5 (1)
- java 6 (1)
- java 7 (1)
- javazone (1)
- javazone 2015 (1)
- jaxb (1)
- jboss (1)
- jboss 4 (1)
- jboss-ws (1)
- jdbc (1)
- jquery (1)
- jrebel (1)
- julebord (1)
- junit (1)
- musehÄnd (1)
- ojdbc (1)
- oracle (1)
- persistence.xml (1)
- prettify (1)
- ptql (1)
- richfaces (1)
- rollermouse pro (1)
- rpi (1)
- s:cache (1)
- seam-gen (1)
- second level cache (1)
- treecache (1)
- wicket (1)
