Decrypts an PGP encrypted file using Private key file.
Namespace: DidiSoft.PgpAssembly: DidiSoft.Pgp (in DidiSoft.Pgp.dll) Version: 1.7.3.35547
Syntax
Return Value
File name of the decrypted file. null if an error had occurred.
Examples
CopyC#
public void DecryptDemo() {
PGPLib pgp = new PGPLib();
FileInfo encryptedFile = new FileInfo(@"C:\Test\INPUT.pgp");
FileInfo privateKeyFile = new FileInfo(@"C:\Test\private.key");
FileInfo outputFile = new FileInfo(@"C:\Test\decrypted.txt");
pgp.DecryptFile(encryptedFile, privateKeyFile, "pass123", outputFile);
}
CopyC#
using System;
using System.IO;
using DidiSoft.Pgp;
public class DecryptDemo
{
public void Demo()
{
PGPLib pgp = new PGPLib();
FileInfo inputFile = new FileInfo(@"c:\INPUT.pgp");
FileInfo privateKeyLocation = new FileInfo(@"c:\private_key.asc");
string privateKeyPassword = "key password";
FileInfo decryptedOutput = new FileInfo(@"c:\OUTPUT.txt");
string originalFileName =
pgp.DecryptFile(inputFileLocation,
privateKeyLocation,
privateKeyPassword,
decryptedOutput);
}
}
CopyVB.NET
Imports System
Imports System.IO
Imports DidiSoft.Pgp
Public Class DecryptDemo
Public Sub Demo()
Dim pgp As New PGPLib()
Dim originalFileName As String
originalFileName =
pgp.DecryptFile(New FileInfo("c:\INPUT.pgp"), _
New FileInfo("c:\private_key.asc"), _
"key password", _
New FileInfo("c:\OUTPUT.txt"))
End Sub
End Class
Exceptions
See Also