Christmas is coming soon! To thank for the support from all our dear customers, Christmas promotional activity is going on in JavaCardOS online store. For more activities details, please check this post.
- Posts: 12
- Joined: Thu Dec 03, 2015 5:29 am
- Points :86
I have to encrypt data with 3DES algo in my applet. I also need to decrypt the data in my host application. And the key for 3DES should be 24 bytes, anyone can figure out how to extend the 16 byte key to 24 byte key?
Here is my code
Code: Select all
cipherDES = Cipher.getInstance(Cipher.ALG_DES_CBC_ISO9797_M1, false);
randomData = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
sessionKey = (DESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_DES,KeyBuilder.LENGTH_DES3_2KEY, false);
randomData.generateData(sessionKeyBytes, (short) 0, (short) 15);sessionKey.setKey(sessionKeyBytes, (short) 0);
- Posts: 24
- Joined: Mon Nov 30, 2015 3:02 am
- Points :188
If you use bouncy castle, you can use a 16 byte 2TDEA key.
- Posts: 33
- Joined: Fri Jul 31, 2015 2:47 am
- Points :213
Usually, the structure of 24 byte key is ABA, where
A: the first 8 bytes of 16 byte key;
B: the next 8 bytes of 16 byte key.
It's hunting season!
Users browsing this forum: No registered users and 1 guest