Decrypts a PGP conventional password encrypted file (also known as PBE, symmetric key encrypted).

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

Syntax

C#
public string DecryptFilePBE(
	string encryptedFileName,
	string password,
	string outputFileName
)
Visual Basic
Public Function DecryptFilePBE ( _
	encryptedFileName As String, _
	password As String, _
	outputFileName As String _
) As String
Visual C++
public:
String^ DecryptFilePBE(
	String^ encryptedFileName, 
	String^ password, 
	String^ outputFileName
)

Parameters

encryptedFileName
Type: System..::..String
File name to be decrypted (absolute or relative path)
password
Type: System..::..String
Password used for symmetric encryption of the input file
outputFileName
Type: System..::..String
File name of the Output decrypted file (absolute or relative path)

Return Value

Original file name of the decrypted file as stored in the PGP file.

Examples

CopyC#
using System;
using DidiSoft.Pgp;

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

    string inputFileLocation = @"c:\INPUT.pgp";
    string password = "password";
    string decryptedOutput = @"c:\OUTPUT.txt";

    // decrypt and obtain the original file name
    string originalFileName = 
      pgp.DecryptFilePBE(inputFileLocation,
                      password,
                      decryptedOutput);        
 }
}
CopyVB.NET
Imports System
Imports DidiSoft.Pgp

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

    ' decrypt and obtain the original file name
    Dim originalFileName As String
    originalFileName = _
      pgp.DecryptFilePBE("c:\INPUT.pgp", _
                    "password", _
                    "c:\OUTPUT.txt")
 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
NonPGPDataExceptionif the input data is not a valid OpenPGP encrypted message

See Also