OpenPGP clear signs a file.

Namespace:  DidiSoft
Assembly:  PGPLib (in PGPLib.dll) Version: 1.6.3.19546

Syntax

C#
public void ClearSignFile(
	FileInfo inputFile,
	FileInfo privateKeyFile,
	string privateKeyPassword,
	HashAlgorithm hashingAlgorithm,
	FileInfo outputFile
)
Visual Basic (Declaration)
Public Sub ClearSignFile ( _
	inputFile As FileInfo, _
	privateKeyFile As FileInfo, _
	privateKeyPassword As String, _
	hashingAlgorithm As HashAlgorithm, _
	outputFile As FileInfo _
)
Visual C++
public:
void ClearSignFile(
	FileInfo^ inputFile, 
	FileInfo^ privateKeyFile, 
	String^ privateKeyPassword, 
	HashAlgorithm hashingAlgorithm, 
	FileInfo^ outputFile
)

Parameters

inputFile
Type: System.IO..::.FileInfo
File to be clear signed
privateKeyFile
Type: System.IO..::.FileInfo
Private Key file
privateKeyPassword
Type: System..::.String
Private key password
hashingAlgorithm
Type: DidiSoft..::.HashAlgorithm
Hashing algorithm to be used
outputFile
Type: System.IO..::.FileInfo
Output file

Remarks

Clearsigned messages contain both the original message in clear text and the signature used to verify that the message comes from a trusted sender and has not been changed.

GPG equivalent command: gpg --output outputFileName --clearsign inputFileName

Examples

This example demonstrates how to OpenPGP clear sign a text file.
CopyC#
using System;
using System.IO;
using DidiSoft;

class ClearSignFileExample 
{
 public static void Demo()
 {
    // create an instance of the library
    PGPLib pgp = new PGPLib();

    // clear text sign
    pgp.ClearSignFile(new FileInfo(@"DataFiles\INPUT.txt"), 
                      new FileInfo(@"DataFiles\private.key"), 
                        "private key password", 
                        HashAlgorithm.SHA256, 
                        new FileInfo(@"DataFiles\OUTPUT.sig.txt"));
 }
}
CopyVB.NET
Imports System
Imports System.IO
Imports DidiSoft

Class ClearSignFileExample
 Public Shared Sub Demo()
    Dim pgp As New PGPLib()

    pgp.ClearSignFile(New FileInfo("DataFiles\INPUT.txt"), _
                    New FileInfo("DataFiles\private.key"), _
                    "private key password", _
                    HashAlgorithm.SHA256, _
                    New FileInfo("DataFiles\OUTPUT.sig.txt"))
 End Sub
End Class

See Also