OpenPGP 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 ) |
| Visual Basic (Declaration) |
|---|
Public Sub EncryptFile ( _ dataFile As FileInfo, _ publicKeyFile As FileInfo, _ outputFile As FileInfo _ ) |
| Visual C++ |
|---|
public: void EncryptFile( FileInfo^ dataFile, FileInfo^ publicKeyFile, FileInfo^ outputFile ) |
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)
Remarks
The encrypted file is in binary format with no integrity check, this is the most compatible format
with old versions of the original PGP program.
Compression algorithm used is the one specified through Compression
Symmetric cipher algorithm used is the one specified through Cypher
Compression algorithm used is the one specified through Compression
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(); 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); } }
Imports System.IO Imports DidiSoft Class EncryptDemo Public Sub Demo() Dim pgp As New PGPLib() 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) End Sub End Class
Exceptions
| Exception | Condition |
|---|---|
| PgpException | if an error has occured |