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: 9
- Joined: Wed Dec 21, 2016 11:46 pm
- Points :82
I have to use DES alg in my applet. But the length of Data are 132 bytes. So I wonder if it's feasible to implement DES encryption with data length 132 byte?
Code: Select all
skey = (DESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_DES,KeyBuilder.LENGTH_DES3_2KEY, false);
cDES = Cipher.getInstance(Cipher.ALG_DES_CBC_ISO9797_M2, false);
cDES.doFinal(Data, doffset, dlen, EBuffer, eoffset); // Data and EBuffer are 132 byte length
- Posts: 234
- Joined: Mon May 18, 2015 3:09 am
- Points :1667
DES requires the data to be block-aligned to an 8 byte boundary. You can have different length input as long as the cipher instance pads the data. Then the output would be block-aligned.
- Posts: 7
- Joined: Thu Feb 25, 2016 3:48 am
- Points :74
Under javacard implementation, the padding is done transparently so it can be block-aligned automatically. You don't need to worry about data length.
Users browsing this forum: No registered users and 1 guest