PGP Encrypts given file using the first available Public PGP key from a Key ring file
Namespace:
DidiSoftAssembly: PGPLib (in PGPLib.dll) Version: 1.6.3.19546
Syntax
| C# |
|---|
public void EncryptFile( FileInfo dataFile, FileInfo publicKeyFile, FileInfo outputFile, bool asciiArmor, bool withIntegrityCheck ) |
| Visual Basic (Declaration) |
|---|
Public Sub EncryptFile ( _ dataFile As FileInfo, _ publicKeyFile As FileInfo, _ outputFile As FileInfo, _ asciiArmor As Boolean, _ withIntegrityCheck As Boolean _ ) |
| Visual C++ |
|---|
public: void EncryptFile( FileInfo^ dataFile, FileInfo^ publicKeyFile, FileInfo^ outputFile, bool asciiArmor, bool withIntegrityCheck ) |
Parameters
- dataFile
- Type: System.IO..::.FileInfo
File to be encrypted
- publicKeyFile
- Type: System.IO..::.FileInfo
Public Key ring file
- outputFile
- Type: System.IO..::.FileInfo
Output file (encrypted)
- 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; class EncryptDemo { public void Demo() { PGPLib pgp = new PGPLib(); bool asciiArmor = true; bool withIntegrityCheck = true; FileInfo inputFile = new FileInfo(@"DataFiles\INPUT.txt"); FileInfo publicKey = new FileInfo(@"DataFiles\public.asc"); FileInfo encryptedFile = new FileInfo(@"DataFiles\OUTPUT.pgp"); pgp.EncryptFile(inputFile, publicKey, encryptedFile, asciiArmor, withIntegrityCheck); } }
Imports System.IO Imports DidiSoft Class EncryptDemo Public Sub Demo() Dim pgp As New PGPLib() Dim asciiArmor As Boolean = True Dim withIntegrityCheck As Boolean = False Dim inputFile As New FileInfo("DataFiles\INPUT.txt"); Dim publicKey As New FileInfo("DataFiles\public.asc") Dim encryptedFile As New FileInfo("DataFiles\OUTPUT.pgp") pgp.EncryptFile(inputFile, _ publicKey, _ encryptedFile, _ asciiArmor, _ withIntegrityCheck) End Sub End Class
Exceptions
| Exception | Condition |
|---|---|
| PgpException | if an error has occured |