Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Encrypt a zip file using PGP in java

 
sarada bokka
Ranch Hand
Posts: 80
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I tried doing PGP encryption for a file using "PGP Encryption using Bouncy Castle" (http://cephas.net/blog/2004/04/01/pgp-encryption-using-bouncy-castle/) and it is working fine.

I would like to have the same kind of PGP encrypting for a zip file using java.

Could some one throw your thought's in achieving this.

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you think encrypting a ZIP file would be different than encrypting any other kind of file?
 
sarada bokka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to encrypt the xip file as normal file

But after decrypting I am unable to unzip the file and throws "cannot open decrypttest.zip file as archive"

Encryption source

Decryption source


jar file required : bcprov-jdk15-147b01.jar,bcpg-jdk15-1.44.jar

Please advice me how to proceed?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ZIP files are binary data - you can't use Readers and Writers to work with them; you need to use Streams.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic