Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DES Keygeneration and parity adjustments

843851Jan 21 2005 — edited Jan 27 2005
Hi,

I am just writing some code for generation a DES-Key on the card. Generally it's very simple, get the keylength, generate some random data and set it as the keyData:
RandomData secureRandom = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
DESKey key = KeyBuilder.buildKey(KeyBuilder.TYPE_DES,KeyBuilder.LENGTH_DES3_3KEY,false);
byte[] keyData = new byte[key.getSize()/8];
secureRandom.generateData(keyData, (short) 0, (short) keyData.length);
key.setKey(keyData,(short) 0);
What I was wondering about is that I can not find anything in the JavaCard/JCOP documentation concerning the parity adjustment of the keyData. I want to use the DES-key for onCard encryption and offCard decryption. For the offCard decryption I need a DES-Key wich is partity-adjusted.
Do I have to test and adjust the parity bits of the keyData myself or does the DESKey makes that internally for me?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 24 2005
Added on Jan 21 2005
2 comments
1,104 views