Decrypts a PGP encrypted file using Private key located in KeyStore.
Namespace:
DidiSoft
Assembly:
PGPLib (in PGPLib.dll) Version: 1.6.3.19546
Syntax
| Visual Basic (Declaration) |
|---|
Public Function DecryptFile ( _
encryptedFileName As String, _
keyStore As KeyStore, _
privateKeyPassword As String, _
outputFileName As String _
) As String |
Parameters
- encryptedFileName
- Type: System..::.String
File name to be decrypted (absolute or relative path)
- keyStore
- Type: DidiSoft..::.KeyStore
Key store containing the Private Key
- privateKeyPassword
- Type: System..::.String
Private key password
- outputFileName
- Type: System..::.String
File name of the Output decrypted file (absolute or relative path). Optional parameter.
If empty the name stored in the PGP decrypted file is used.
Return Value
File name of the decrypted file. null if and error has occured.
Examples
CopyC#
using System;
using DidiSoft;
public class KeyStoreDecryptFile
{
public static void Demo()
{
KeyStore keyStore = new KeyStore(@"DataFiles\key.store", "changeit");
PGPLib pgp = new PGPLib();
String privateKeyPassword = "key password";
pgp.DecryptFile(@"c:\INPUT.pgp", keyStore, privateKeyPassword, @"c:\OUTPUT.txt");
}
}
CopyVB.NET
Imports System
Imports DidiSoft
Public Class KeyStoreDecryptFile
Public Shared Sub Demo()
Dim keyStore As New KeyStore("DataFiles\key.store", "changeit")
Dim pgp As New PGPLib()
Dim privateKeyPassword As String = "key password"
pgp.DecryptFile("c:\INPUT.pgp", keyStore, privateKeyPassword, "c:\OUTPUT.txt")
End Sub
End Class
Exceptions
| Exception | Condition |
|---|
| PgpException | if an error has occured |
See Also