File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Encrypt/Decrypt Write/Read To/From a File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Encrypt/Decrypt Write/Read To/From a File" Watch "Encrypt/Decrypt Write/Read To/From a File" New topic

Encrypt/Decrypt Write/Read To/From a File

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

I want to know how to write to a file an encrypted piece of data. I also need to know how to read a file and decrypt the data. For network programming, I use "SSL_DH_anon_WITH_RC4_128_MD5" type encryption for my network projects. Is there something similar or can I use this for files?

John Price

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Rob Spoor

Joined: Oct 27, 2005
Posts: 19911

The usual way is to create a javax.crypto.Cipher and use that with a CipherInputStream / CipherOutputStream.

How To Ask Questions How To Answer Questions
rocket mass heater kickstarter
subject: Encrypt/Decrypt Write/Read To/From a File