Skip to content

qie.pgpDecryptFileWithoutVerify

Signature: qie.pgpDecryptFileWithoutVerify(inputFile, outputFile, privateKey, privateKeyPassphrase)

Returns: Boolean succeeded - true if decryption was successful

Decrypts inputFile using PGP encryption with the supplied private key, the signatures are NOT validated. The output is written to the outputFile.

Note

The privateKey must be generated from a system that can generate valid PGP key pairs.

Parameters

Type Name Description Default
String, File inputFile the file to be encrypted
String, File outputFile the output file containing decrypted data
String, File, or byte[] privateKey the PGP private key to use for decrypting data
String privateKeyPassphrase password to unlock the private key for decryption

Example

// Example: inputFile as String path, outputFile as String path,
// privateKey as String path
var success = qie.pgpDecryptFileWithoutVerify(
   "/tmp/encryptedFoot.txt",
   "/tmp/decryptedFoot.dcm",
   "/tmp/pgpPrivate.key",
   "changeit"
);

if (success) {
   // File successfully decrypted (signature was not verified).
} else {
   // File decryption failed.
}


// Example: inputFile as File, outputFile as File,
// privateKey as File
var encryptedFile = qie.newFile("/tmp/encryptedFoot.txt");     // java.io.File
var decryptedFile = qie.newFile("/tmp/decryptedFoot-file.dcm");// java.io.File
var pgpPrivateKeyFile = qie.newFile("/tmp/pgpPrivate.key");    // java.io.File

var successWithFiles = qie.pgpDecryptFileWithoutVerify(
   encryptedFile,
   decryptedFile,
   pgpPrivateKeyFile,
   "changeit"
);

if (successWithFiles) {
   // File successfully decrypted (signature was not verified).
} else {
   // File decryption failed.
}


// Example: inputFile as String path, outputFile as String path,
// privateKey as byte[]
var pgpPrivateKeyBytes = qie.readFile("/tmp/pgpPrivate.key");  // byte[]

var successWithByteKey = qie.pgpDecryptFileWithoutVerify(
   "/tmp/encryptedFoot.txt",
   "/tmp/decryptedFoot-bytes.dcm",
   pgpPrivateKeyBytes,
   "changeit"
);

if (successWithByteKey) {
   // File successfully decrypted (signature was not verified).
} else {
   // File decryption failed.
}