Problem with CryptoAPI and JCE
I'm having a problem getting the Windows world and Java to talk (any suprises there? ;) ). I'm trying to encrypt some text by creating a hash value via the SHA algorithm, creating a key with that hash value via the DES algorithm, and subsequently creating my ciphertext with the key.
Here's the problem. Say my text is "Here's some text to encrypt.", and my password is "FearFactory". If I create a hash value given the password, I get the same value in both worlds (in hex):
So far, so good. However, when I create the encrypted text, things get wacky. Here's the result I get via the CryptoAPI (in hex):
And here's the result in the JCE world (in hex):
Note that the first 8 bytes are the same; after that, things fall apart. Also note that I can look at the raw key information in Java (i.e. its content in bytes), but the CryptoAPI doesn't let you see that information because it's a symmetric and therefore private key. Windows won't let you see the private key in bytes, as far as I can tell (although I may be wrong on this).
I didn't want to paste the code right now (to save on space), but if someone has an idea as to what the problem is and/or is willing to figure out what the discrepancy is, I'd be more than happy to post my test code. If you have ANY insight into this problem, I'd greatly appreciate your help.
P.S. I didn't want to cross-post this to honor DevX's newsgroup policy, but I'm kind of stuck in this case posting it to one group. Would anybody object if I posted this to a Java group on DevX's server in the near future if nothing materializes here?