File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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:

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: 19543

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:
subject: Java / .NET rijndael File Encryption Interop
Similar Threads
How encrpyt all files on web server so decryptable by all users' keys?
wave file encryption API
Store HTTPS file upload on server encrypted?
string encrypt/decrypt API
AES encryption from within a Tomcat web container