Install Unrestricted policy files di Java Crypto


Normalnya key yang dapat digunakan di java crypto adalah tidak lebih dari 128 bit (terkecuali untuk 3DES) dan RSA yang dibatasi sampai 2048 bit. Bagaimana jika kita ingin mengunakan kunci lebih dari 128 misal untuk symetric algorithm seperti blowfish 192 bit?
untuk itu kita perlu mengaktifkan unrestrited policy files, untuk java7 dapat didownload di http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
dan java8 di http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

setelah itu jika menggunakan linux replace file kedalam direktori jvm sebagai berikut: /usr/lib/jvm/java-8-oracle/jre/lib/security US_export_policy.jar dan local_policy.jar dengan file yg kita download sebelumnya.
untuk linux diperlukan akses root untuk mereplace kedua file tersebut

gunakan script dibawah ini untuk mengetest apakan Policy sudah di unrestricted


import javax.crypto.*;
import javax.crypto.spec.*;
public class SimplePolicyTest
{
public static void main(String[] args) throws Exception
{
byte[] data = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
// create a 64 bit secret key from raw bytes
SecretKey key64 = new SecretKeySpec(
new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
"Blowfish");
// create a cipher and attempt to encrypt the data block with our key
Cipher c = Cipher.getInstance("Blowfish/ECB/NoPadding");
c.init(Cipher.ENCRYPT_MODE, key64);
c.doFinal(data);
System.out.println("64 bit test: passed");
// create a 192 bit secret key from raw bytes
SecretKey key192 = new SecretKeySpec(
new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
"Blowfish");
// now try encrypting with the larger key
c.init(Cipher.ENCRYPT_MODE, key192);
c.doFinal(data);

System.out.println("192 bit test: passed");
System.out.println("Tests completed");
}
}

Jika sukses maka print di console sebagai berikut
64 bit test: passed
192 bit test: passed
Tests completed

jika tidak maka:
64 bit test: passedException in thread “main”
java.security.InvalidKeyException: Illegal key size or default parameters
at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1026)
at javax.crypto.Cipher.init(Cipher.java:1245)
at javax.crypto.Cipher.init(Cipher.java:1186)
at SimplePolicyTest.main(SimplePolicyTest.java:24)

History of our nation in 1998.


1998 at that time I was 12 years old and until now I still remember what’s happened especially when I was with my father. In practically my father taught me many good things that I didn’t felt and that incident always still in my mind. Shortly at that time for me started to know good thing or bad thing, I still remember that KKN (Korupsi, Kolusi, Nepotisme) corruption, collusion and nepotism is a worst, because every day at that moment people always said that. And also my father told to me about that. In 1997 when Indonesia has election, at that moment I know a little about politic. My father taught me about politics, in this case how politic that contra-goverment. Actually, I saw and read some bulletin in my home that in the cover has Megawati Soekarnoputri and my father always told me to not tell everybody about this bulletin. I always like a secret, and I asked to him why, and he explained to me, we could put in the jail because this bulletin. And I thought Okey.

Every body told about politics, in our home, in television. But in school we don’t care about politics. We just care, if something happened like chaos or dangerous situation it’s mean holiday, and we was very happy!. Back to 1998, I’ve my brother who studied at Trisakti university which has some dangerous situation, a few of students was killed in the middle May. And of course my father has attention of this situation, and we have home where placed not so far between Trisakti, Istana Negara, and Gedung MPR/DPR where was mass concentration at that place. If something happened in Gedung MPR/DPR it’s mean exactly, I could go to school because we’ve to pass that way to go my school, I was happy like usually students at that moment.

My brother appeared several times in Television, and it’s became a good news for our family because he still alive. In the middle of May, I remember that peoples made some damage, they broke everything, they burned everything, they stole every thing and many bad thing. And I still remember that time my father took me to saw everything what’s happened. Because our home near in the trade center and also Metro (that largest supermarket at this time), I saw many people broke the door and stole everything inside that supermarket. And also they wanted to burn that supermarket. And I remember that my father prevent people to do this, but he couldn’t prevent to the people not to stole or etc. But he taught me that is bad to stole every thing that you have although many people do that.

I with my father just looked not far away, it’s far about 50 meter. And I saw many people that we knew each other who take everything from this supermarket. Until now, that condition always in my mind, I never forget about that. I learned many thing about that. Before it’s happen, around that supermarket, we have a many thing, culinary,  playing ground for the children, and also economic around there was life. And I had a goat which my father gave to me keep, my goat ate an expensive food that we said, because the food like vegetables or fruits which wasn’t fresh anymore, they put into the trash which near in my home. The goat, Jackson that we gave him the name was very lucky goat.

Back to the chaos condition, in other side my our home. Many building that sold cars also got chaotic condition, people not stole cars but just destroyed and burned. I remember that BMW was burned that I saw directly with my father. My father didn’t forbid me to see this situation, instead on he took me to see but of course, I couldn’t go with my himself. But until now, sometime I still think about that. And I also saw many of tanks went in the road, and destroyed a road and some pots. And I also remember that I saw PHH (Pasukan Huru Hara) which drove trail motorcycle which I very impressed that. Actually people judge PHH or Police was an enemy because they were very repressive, reserve of Marinir (Marine). That’s why at this time many people liked marine with tanks although tanks destroy pots.

Now, when I’m writing this words, I’ve already 29 years old, it’s 17 years ago. I’m very lucky that I has dad. He passed away two years after Soeharto was resigned.

People said that era is Reformation, but until know I still think is not Reformation.