JCE and CryptoAPI

S

schw

Hi

In my server app written in c++ I use Microsoft Crypto API with 3DES
algorithms to encrypt/decode data. The API uses effective key length
of 21 bytes - 168 bits.

Now I am writting a client app in java that has to encrypt some data
before sending them over but I've noticed that the JCE uses 24 bytes
length keys - 192bits. This is as 3DES ignores every seventh bit so the
effective key length is 21 bytes long.

is there any other provider that uses same key length as Crypto API or
how could I write a procedure that converts 21 bytes into 24 bytes
adding 1 bit after every seven bits in the source? I am new to Java so
help would be much apreciated.

best regards,
schw
 
J

JPractitioner

Hi schw,
yes u could use padding..
say for example, in your case, u can pad extra 18 bytes to ur data
(with 0s maybe)
so it will be 42 bytes.

when the data is decrypted, u will have to clean-up the trailing pads.

U also might want to check the API for DES encryption with pading
mechanism.
http://java.sun.com/j2se/1.5.0/docs/guide/security/jce/JCERefGuide.html

u can see how the padding is done with
Cipher.getInstance("DES/ECB/PKCS5Padding");


HTH
 
T

Thomas Weidenfeller

JPractitioner said:
Hi schw,
yes u could use padding..
say for example, in your case, u can pad extra 18 bytes to ur data
(with 0s maybe)

And you could use real words like "you".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top