Decrypts a PGP conventional password encrypted file that may contain multiple files to a specified directory.

Namespace: DidiSoft.Pgp
Assembly: DidiSoft.Pgp (in DidiSoft.Pgp.dll) Version: 1.7.3.35547

Syntax

C#
public string[] DecryptFilePBEInFolder(
	string encryptedFileName,
	string decryptionPassword,
	string outputFolderName
)
Visual Basic
Public Function DecryptFilePBEInFolder ( _
	encryptedFileName As String, _
	decryptionPassword As String, _
	outputFolderName As String _
) As String()
Visual C++
public:
array<String^>^ DecryptFilePBEInFolder(
	String^ encryptedFileName, 
	String^ decryptionPassword, 
	String^ outputFolderName
)

Parameters

encryptedFileName
Type: System..::..String
PGP conventional password encrypted file to be decrypted (absolute or relative path)
decryptionPassword
Type: System..::..String
Decryption password (this is the same password used for encrypting the file)
outputFolderName
Type: System..::..String
Folder where decrypted file(s) will be extracted (absolute or relative path)

Return Value

Array of file name(s) of the decrypted file(s)

Examples

CopyC#
using System;
using System.IO;
using DidiSoft.Pgp;

public class DecryptDemo
{
 public void Demo()
 {
    // initialize the library
    PGPLib pgp = new PGPLib();

    string inputFile = @"c:\INPUT.pgp";
    string decryptionPassword = "decryption password";
    string outputFolder = @"c:\Folder1";

    // decrypt and obtain the decrypted file name(s)
    string[] decryptedFileNames = 
      pgp.DecryptFilePBEInFolder(inputFile,
                      decryptionPassword,
                      outputFolder);

     // print the full path of the decrypted file(s)
     foreach (string filename in decryptedFileNames)
     {
        System.Console.WriteLine(filename);
     }
 }
}
CopyVB.NET
Imports System
Imports System.IO
Imports DidiSoft.Pgp

Public Class DecryptDemo
 Public Sub Demo()
     ' create an instance of the library
     Dim pgp As New PGPLib()

     Dim inputFile As String = "c:\INPUT.pgp"
     Dim outputFolder As String = "c:\Folder1"

     ' decrypt and obtain the decrypted file name(s)
     Dim decryptedFileNames As String() = _
      pgp.DecryptFilePBEInFolder(inputFile, _
                    "decryption password", _
                    outputFolder)

  ' print the full path of the decrypted file(s)
  For Each filename As String In decryptedFileNames
      System.Console.WriteLine(filename)
  Next   
 End Sub
End Class

Exceptions

ExceptionCondition
System.IO..::..IOExceptionI/O error
DidiSoft.Pgp..::..PGPExceptionGeneral OpenPGP error
DidiSoft.Pgp.Exceptions..::..WrongPasswordExceptionIf the decryption password is incorrect
DidiSoft.Pgp.Exceptions..::..FileIsEncryptedExceptionIf the file is encrypted with a public key

See Also