Encrypts a whole folder with it's contents only with a passphrase.
The same passphrase is used to decrypt the file.

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

Syntax

C#
public void EncryptFolderPBE(
	FileInfo folder,
	string passphrase,
	FileInfo outputFile,
	bool asciiArmor,
	bool withIntegrityCheck
)
Visual Basic
Public Sub EncryptFolderPBE ( _
	folder As FileInfo, _
	passphrase As String, _
	outputFile As FileInfo, _
	asciiArmor As Boolean, _
	withIntegrityCheck As Boolean _
)
Visual C++
public:
void EncryptFolderPBE(
	FileInfo^ folder, 
	String^ passphrase, 
	FileInfo^ outputFile, 
	bool asciiArmor, 
	bool withIntegrityCheck
)

Parameters

folder
Type: System.IO..::..FileInfo
Folder to be encrypted
passphrase
Type: System..::..String
Passphrase used to encrypt the file
outputFile
Type: System.IO..::..FileInfo
File of the output encrypted file
asciiArmor
Type: System..::..Boolean
Should file be in ASCII armored format
withIntegrityCheck
Type: System..::..Boolean
Should integrity check information be added to the file.

Remarks

This format requires that your recipient use PGP Desktop 9 or newer in order to decrypt the file.

Examples

This example shows how to encrypt a whole folder only with a password.
CopyC#
using System.IO;
using DidiSoft.Pgp; 

class EncryptPasswordBasedDemo {
  public void Demo() {
    PGPLib pgp = new PGPLib();
    bool asciiArmor = true;
    bool withIntegrityCheck = true;

    pgp.EncryptFolderPBE(new FileInfo(@"c:\DataFiles"),
                       "encryption_password",
                       new FileInfo(@"DataFiles\OUTPUT.pgp"), 
                       asciiArmor, 
                       withIntegrityCheck);    
 }
}
CopyVB.NET
Imports System.IO
Imports DidiSoft.Pgp

Class EncryptPasswordBasedDemo
 Public Sub Demo()
   Dim pgp As New PGPLib()
   Dim asciiArmor As Boolean = True
   Dim withIntegrityCheck As Boolean = False

   pgp.EncryptFolderPBE(New FileInfo("c:\DataFiles"), _
                       "encryption_password", _
                       New FileInfo("DataFiles\OUTPUT.pgp"), _
                       asciiArmor, _
                       withIntegrityCheck)
  End Sub
End Class

Exceptions

ExceptionCondition
DidiSoft.Pgp..::..PGPExceptionif an OpenPGP related error has occurred
DidiSoft.Pgp..::..PGPExceptionGeneral encryption error
System.IO..::..IOExceptionI/O error

See Also