PGP Encrypts a file for miltiple recipients.
Namespace: DidiSoft.PgpAssembly: DidiSoft.Pgp (in DidiSoft.Pgp.dll) Version: 1.7.3.35547
Syntax
| C# |
|---|
public void EncryptFile( string dataFileName, string[] publicKeyFiles, string outputFileName, bool asciiArmor, bool withIntegrityCheck ) |
| Visual Basic |
|---|
Public Sub EncryptFile ( _ dataFileName As String, _ publicKeyFiles As String(), _ outputFileName As String, _ asciiArmor As Boolean, _ withIntegrityCheck As Boolean _ ) |
| Visual C++ |
|---|
public: void EncryptFile( String^ dataFileName, array<String^>^ publicKeyFiles, String^ outputFileName, bool asciiArmor, bool withIntegrityCheck ) |
Parameters
- dataFileName
- Type: System..::..String
File name to be encrypted (absolute or relative path)
- publicKeyFiles
- Type: array<System..::..String>[]()[][]
Array of paths to PGP public key files (absolute or relative paths), that will be used for the encryption
- outputFileName
- Type: System..::..String
File name of the Output encrypted file (absolute or relative path)
- 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
Compression algorithm used is the one specified through Compression
Symmetric cipher algorithm used is the one specified through Cypher
Symmetric cipher algorithm used is the one specified through Cypher
Examples
using System.IO; using DidiSoft.Pgp; class EncryptForMultiRecipientsDemo { public void Demo() { PGPLib pgp = new PGPLib(); // ASCII armor or binary bool asciiArmor = true; // append integrity protection check bool withIntegrityCheck = false; string[] recipientsPublicKeys = {@"c:\recipient_1_key.asc", @"c:\recipient_2_key.asc", @"c:\recipient_3_key.asc"}; pgp.EncryptFile(@"c:\INPUT.txt", recipientsPublicKeys, @"c:\OUTPUT.pgp", asciiArmor, withIntegrityCheck); } }
Imports System.IO Imports DidiSoft.Pgp Class EncryptForMultiRecipientsDemo Public Sub Demo() Dim pgp As New PGPLib() ' ASCII armor or binary Dim asciiArmor As Boolean = True ' append integrity protection check Dim withIntegrityCheck As Boolean = False Dim recipientsPublicKeys As String() = _ New String() {"c:\recipient_1_key.asc", _ "c:\recipient_2_key.asc", _ "c:\recipient_3_key.asc"} pgp.EncryptFile("c:\INPUT.txt", _ recipientsPublicKeys, _ "c:\OUTPUT.pgp", _ asciiArmor, _ withIntegrityCheck) End Sub End Class
Exceptions
| Exception | Condition |
|---|---|
| DidiSoft.Pgp..::..PGPException | if an OpenPGP related error has occurred |
| DidiSoft.Pgp..::..PGPException | General encryption error |
| System.IO..::..IOException | I/O error |