OpenPGP digitaly signs a file using OpenPGP version 3 signatures format (compatible with PGP 6.5 systems).

Namespace: DidiSoft.Pgp
Assembly: 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#
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);                
   }
}
CopyVB.NET
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

ExceptionCondition
System.IO..::..IOExceptionif an I/O error has occurred
DidiSoft.Pgp..::..PGPExceptionif a signing error has occurred
DidiSoft.Pgp.Exceptions..::..WrongPasswordExceptionif the supplied password for the private key is incorrect
DidiSoft.Pgp.Exceptions..::..WrongPrivateKeyExceptionif the supplied private key is not suitable for signing

See Also