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(
	FileInfo file,
	FileInfo privateKeyFile,
	string privateKeyPassword,
	FileInfo signedFile,
	bool asciiArmor
)
Visual Basic
Public Sub SignFileV3 ( _
	file As FileInfo, _
	privateKeyFile As FileInfo, _
	privateKeyPassword As String, _
	signedFile As FileInfo, _
	asciiArmor As Boolean _
)
Visual C++
public:
void SignFileV3(
	FileInfo^ file, 
	FileInfo^ privateKeyFile, 
	String^ privateKeyPassword, 
	FileInfo^ signedFile, 
	bool asciiArmor
)

Parameters

file
Type: System.IO..::..FileInfo
File to be OpenPGP signed
privateKeyFile
Type: System.IO..::..FileInfo
Private key file
privateKeyPassword
Type: System..::..String
Private key password
signedFile
Type: System.IO..::..FileInfo
Output OpenPGP signed file
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 System.IO;
using DidiSoft.Pgp;

public class SignV3Demo
{
   public void Demo()
   {
       // Create an instance of the library 
       PGPLib pgp = new PGPLib();
       // Should output be in ASCII armored format
       bool asciiArmor = true;

       pgp.SignFileV3(new FileInfo(@"C:\Test\INPUT.txt"), 
                       new FileInfo(@"C:\Test\private.pkr"), 
                       "password",
                       new FileInfo(@"C:\Test\OUTPUT.pgp"), 
                       asciiArmor);                
   }
}
CopyVB.NET
Imports System
Imports System.IO
Imports DidiSoft.Pgp

Public Class SignV3Demo
   Public Sub Demo()
       ' Create an instance of the library 
       Dim pgp As New PGPLib()
       ' Should output be in ASCII armored format
       Dim asciiArmor As Boolean = True

       pgp.SignFileV3(New FileInfo("C:\Test\INPUT.txt"), _
                    New FileInfo("C:\Test\private.asc"), _
                    "password", _
                    New FileInfo("C:\Test\OUTPUT.pgp", _
                    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