Easy way to Decrypt the "PGP encrypted file" using JAVA program.
Step1: Download below jars
1) bcpg-jdk14-145.jar
2) bcprov-ext-jdk14-145.jar
3) pgplib-2.5.jar
from http://www.softpedia.com/get/Programming/Components-Libraries/PGPLib.shtml and add them to class path (OR) Make sure the jars available to our java program.
Step 2: Use the below program for Decryption.
Java Program:
package pgplib;
import com.didisoft.pgp.PGPLib;
public class PGPSample {
public static void main(String[] args) throws Exception {
// initialize the library instance
PGPLib pgp = new PGPLib();
String privateKeyFile = "your .skr file path here";
String privateKeyPass = "your pass key here";
String originalFileName = pgp.decryptFile("your .pgp encrypted file path",
privateKeyFile, privateKeyPass, " your output file path");
}
}
Sample program:
package pgplib;
import com.didisoft.pgp.PGPLib;
public class PGPSample {
public static void main(String[] args) throws Exception {
// initialize the library instance
PGPLib pgp = new PGPLib();
String privateKeyFile = "c:\\secring.skr";
String privateKeyPass = "javacodehelp";
String originalFileName = pgp.decryptFile("c:\\abc.pgp",
privateKeyFile, privateKeyPass, "c:\\OUTPUT.txt");
}
}
Step1: Download below jars
1) bcpg-jdk14-145.jar
2) bcprov-ext-jdk14-145.jar
3) pgplib-2.5.jar
from http://www.softpedia.com/get/Programming/Components-Libraries/PGPLib.shtml and add them to class path (OR) Make sure the jars available to our java program.
Step 2: Use the below program for Decryption.
Java Program:
package pgplib;
import com.didisoft.pgp.PGPLib;
public class PGPSample {
public static void main(String[] args) throws Exception {
// initialize the library instance
PGPLib pgp = new PGPLib();
String privateKeyFile = "your .skr file path here";
String privateKeyPass = "your pass key here";
String originalFileName = pgp.decryptFile("your .pgp encrypted file path",
privateKeyFile, privateKeyPass, " your output file path");
}
}
Sample program:
package pgplib;
import com.didisoft.pgp.PGPLib;
public class PGPSample {
public static void main(String[] args) throws Exception {
// initialize the library instance
PGPLib pgp = new PGPLib();
String privateKeyFile = "c:\\secring.skr";
String privateKeyPass = "javacodehelp";
String originalFileName = pgp.decryptFile("c:\\abc.pgp",
privateKeyFile, privateKeyPass, "c:\\OUTPUT.txt");
}
}