Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JCE

 
Pete WesternHope
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are we able to ask questions about crypto?
Having been familiar with Java Card crypto, the JCE world is slightly different. The issues of key size, ede vs ded, cbc vs ecb etc seem not to match the Java Card model. Can someone help clarify this for me please?
I want to encipher plain text using triple-DES (i.e. ede). I need a key, but I want to provide only 16 bytes - not usually a problem, internally, the "missing" 'third' key is taken form the 'first' key.
Later I might want to decipher using triple DES (i.e. ded)
I have found a DESedeKeySpec method but I need to init the DES Cipher with a class that implements the Key i/f. I also want to create the DESedeKeySpec with just 16 bytes.
What about decipher, does the same key (if ever I create it) apply for Cipher.MODE_DECRYPT?
Can anyone help?
Is anyone allowed to help? ;-)
Rgds
Pete
 
Torsten Schippel
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pete,
which JCE implementation do you use?
IAIK JCE by University of Graz www.iaik.at supports key initialisation with 16 byte:
rawKey = "1234567890123456".getBytes();
javax.crypto.SecretKey key = new iaik.security.cipher.SecretKey(rawKey, "RAW");
BouncyCastle seems not to support it.
Why can you not just copy the first 8 bytes to fill to 24 bytes? Just theory.
Of course you use the same key for decipher mode. Its a symmetric cipher.
Regards
Torsten
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!