This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Security and the fly likes PGP - Eliminating Temp Files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "PGP - Eliminating Temp Files?" Watch "PGP - Eliminating Temp Files?" New topic
Author

PGP - Eliminating Temp Files?

Chad Step
Greenhorn

Joined: Jun 21, 2006
Posts: 13
I've been following the tutorial at: http://cephas.net/blog/2004/04/01/pgp-encryption-using-bouncy-castle/.

Following this example, I have been able to encrypt files in PGP. The problem is, I just want a few strings that I can then pass along -- I don't need an encrypted file. The strings will be passed in a web query.

Is there a way to only encrypt Strings and not have to first write them to a file? Does the file encryption have to happen? (I'm struggling to find anything to make me believe otherwise,but that just doesn't make sense to me).

thanks
greg stark
Ranch Hand

Joined: Aug 10, 2006
Posts: 220
I have not looked at the example in detail but just use any of the memory-based alternatives, for example for a Writer you can use a CharArrayWriter or StringWriter instead of a FileWriter. Similiarly for Readers, InputStreams, etc.


Nice to meet you.
Chad Step
Greenhorn

Joined: Jun 21, 2006
Posts: 13
Thanks Greg, will do that today and see what I come up with.

The current solution creates 3 files, I think this will eliminate at least two of them.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: PGP - Eliminating Temp Files?