OpenPGP Encrypts given folder with its subfolders and files into a PGP Zip archive
Namespace: DidiSoft.PgpAssembly: 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
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); } }
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
| Exception | Condition |
|---|---|
| DidiSoft.Pgp..::..PGPException | if an OpenPGP related error has occurred |
| DidiSoft.Pgp.Exceptions..::..WrongPublicKeyException | If the supplied public key is not usable |
| DidiSoft.Pgp..::..PGPException | General encryption error |
| System.IO..::..IOException | I/O error |