OpenPGP Encrypts given folder with its subfolders and files into a PGP Zip archive

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

Syntax

C#
public void EncryptFolder(
	FileInfo folder,
	FileInfo publicKeyFile,
	FileInfo outputFile,
	bool asciiArmor,
	bool withIntegrityCheck
)
Visual Basic
Public Sub EncryptFolder ( _
	folder As FileInfo, _
	publicKeyFile As FileInfo, _
	outputFile As FileInfo, _
	asciiArmor As Boolean, _
	withIntegrityCheck As Boolean _
)
Visual C++
public:
void EncryptFolder(
	FileInfo^ folder, 
	FileInfo^ publicKeyFile, 
	FileInfo^ outputFile, 
	bool asciiArmor, 
	bool withIntegrityCheck
)

Parameters

folder
Type: System.IO..::..FileInfo
Folder to be encrypted
publicKeyFile
Type: System.IO..::..FileInfo
Public key file name
outputFile
Type: System.IO..::..FileInfo
Output encrypted file
asciiArmor
Type: System..::..Boolean
Should the encrypted file be in ASCII Armored format. If false the encrypted file is in binary format.
withIntegrityCheck
Type: System..::..Boolean
Should integrity check information be added to the encrypted file.

Remarks

This feature is compatible with PGP Desktop version 9 and above.

Examples

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

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

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

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

     pgp.EncryptFolder(New FileInfo("c:\DataFiles"), _
                        New FileInfo("c:\public_key.asc"), _
                        New FileInfo("c:\OUTPUT.pgp"), _
                        asciiArmor, _
                        withIntegrityCheck)
    End Sub
End Class

Exceptions

ExceptionCondition
DidiSoft.Pgp..::..PGPExceptionif an OpenPGP related error has occurred
DidiSoft.Pgp.Exceptions..::..WrongPublicKeyExceptionIf the supplied public key is not usable
DidiSoft.Pgp..::..PGPExceptionGeneral encryption error
System.IO..::..IOExceptionI/O error

See Also