wood burning stoves
The moose likes Java in General and the fly likes Java / .NET rijndael File Encryption Interop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java / .NET rijndael File Encryption Interop" Watch "Java / .NET rijndael File Encryption Interop" New topic

Java / .NET rijndael File Encryption Interop

Ola Daniel
Ranch Hand

Joined: Jul 27, 2005
Posts: 105
I need to create a Java version of an existing .NET application which uses Xceed Encryption Library to encrypt and decrypt files. I need help on how to get a Java to encrypt and decrypt files which have been encrypted with the .NET Xceed Encryption library.

See this link here for an example of how the Xceed encryption library works: http://doc.xceedsoft.com/products/XceedCry/Encrypting_and_decrypting_from_file_to_file_%28C__example%29.html

The Xceed library creates a symmetric key using a passphrase from the user. How do I do this in Java?

I already have code which generates a random secret key, this is no good. How do I create an AES 128 bit SecretKey from a given passphrase.

Any Ideas?

SCJP 1.4, SCWCD 1.4
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler et al, Refactoring: Improving the Design of Existing Code, 1999
Rob Spoor

Joined: Oct 27, 2005
Posts: 20274

How about using SecretKeySpec?

How To Ask Questions How To Answer Questions
Ola Daniel
Ranch Hand

Joined: Jul 27, 2005
Posts: 105
Is this correct way of doing it (see code below)? using PBEWithMD5AndDES for key factory? and MD5 hashing? Is it possible to use SHA-256 to generate a 128 bit hash?

I agree. Here's the link: http://aspose.com/file-tools
subject: Java / .NET rijndael File Encryption Interop
jQuery in Action, 3rd edition