OpenPGP digitaly signs a file using OpenPGP version 3 signatures format (compatible with PGP 6.5 systems).
Namespace: DidiSoft.PgpAssembly: DidiSoft.Pgp (in DidiSoft.Pgp.dll) Version: 1.7.3.35547
Syntax
| C# |
|---|
public void SignFileV3( string fileName, string privateKeyFileName, string privateKeyPassword, string signedFileName, bool asciiArmor ) |
| Visual Basic |
|---|
Public Sub SignFileV3 ( _ fileName As String, _ privateKeyFileName As String, _ privateKeyPassword As String, _ signedFileName As String, _ asciiArmor As Boolean _ ) |
| Visual C++ |
|---|
public: void SignFileV3( String^ fileName, String^ privateKeyFileName, String^ privateKeyPassword, String^ signedFileName, bool asciiArmor ) |
Parameters
- fileName
- Type: System..::..String
File Name to be OpenPGP Signed (absolute or relative path)
- privateKeyFileName
- Type: System..::..String
Private key file (absolute or relative path)
- privateKeyPassword
- Type: System..::..String
Private key password
- signedFileName
- Type: System..::..String
File name of the OpenPGP signed file (absolute or relative path)
- asciiArmor
- Type: System..::..Boolean
if true, output file is in ASCII armored format
Examples
This sample shows how to digitaly sign file using private key located in file
CopyC#
CopyVB.NET
using System; using DidiSoft.Pgp; public class SignV3Demo { public void Demo() { // Create and instance of the library PGPLib pgp = new PGPLib(); // Should output be ASCII armored (true) or binary (false) bool asciiArmor = true; pgp.SignFileV3(@"C:\Test\INPUT.txt", @"C:\Test\private.pkr", "password", @"C:\Test\OUTPUT1.pgp", asciiArmor); } }
Imports System Imports DidiSoft.Pgp Public Class SignV3Demo Public Sub Demo() ' Create and instance of the library Dim pgp As New PGPLib() ' Should output be ASCII armored (true) or binary (false) Dim asciiArmor As Boolean = True pgp.SignFileV3("C:\Test\INPUT.txt", _ "C:\Test\private.key", _ "password", _ "C:\Test\OUTPUT1.signed", _ asciiArmor) End Sub End Class
Exceptions
| Exception | Condition |
|---|---|
| System.IO..::..IOException | if an I/O error has occurred |
| DidiSoft.Pgp..::..PGPException | if a signing error has occurred |
| DidiSoft.Pgp.Exceptions..::..WrongPasswordException | if the supplied password for the private key is incorrect |
| DidiSoft.Pgp.Exceptions..::..WrongPrivateKeyException | if the supplied private key is not suitable for signing |