OpenPGP clear signs a file, using OpenPGP version 3 signature format (old format)
Use when needed compatibility with PGP 2.x and PGP 5.x systems.
GPG equivalent command: gpg --force-v3-sigs --output outputFileName --clearsign inputFileName
Namespace: DidiSoft.PgpUse when needed compatibility with PGP 2.x and PGP 5.x systems.
GPG equivalent command: gpg --force-v3-sigs --output outputFileName --clearsign inputFileName
Assembly: DidiSoft.Pgp (in DidiSoft.Pgp.dll) Version: 1.7.3.35547
Syntax
| C# |
|---|
public void ClearSignFileV3( string inputFileName, string privateKeyFileName, string privateKeyPassword, string hashingAlgorithm, string outputFileName ) |
| Visual Basic |
|---|
Public Sub ClearSignFileV3 ( _ inputFileName As String, _ privateKeyFileName As String, _ privateKeyPassword As String, _ hashingAlgorithm As String, _ outputFileName As String _ ) |
| Visual C++ |
|---|
public: void ClearSignFileV3( String^ inputFileName, String^ privateKeyFileName, String^ privateKeyPassword, String^ hashingAlgorithm, String^ outputFileName ) |
Parameters
- inputFileName
- Type: System..::..String
File name to be clear signed (absolute or relative path)
- privateKeyFileName
- Type: System..::..String
Private Key file (absolute or relative path)
- privateKeyPassword
- Type: System..::..String
Private key password
- hashingAlgorithm
- Type: System..::..String
Hashing algorithms, one of: SHA256, SHA384, SHA512, SHA224, SHA1, MD5, RIPEMD160, MD2
- outputFileName
- Type: System..::..String
Output file name (absolute or relative path)
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.
Examples
This example demonstrates how to OpenPGP clear sign a text file with the old OpenPGP signature format.
CopyC#
CopyVB.NET
using System; using DidiSoft.Pgp; class ClearSignFileV3Example { public static void Demo() { // create an instance of the library PGPLib pgp = new PGPLib(); // clear text sign pgp.ClearSignFileV3(@"DataFiles\INPUT.txt", @"DataFiles\private.key", "private key password", "SHA256", @"DataFiles\OUTPUT.sig.txt"); } }
Imports System Imports DidiSoft.Pgp Class ClearSignFileV3Example Public Shared Sub Demo() Dim pgp As New PGPLib() pgp.ClearSignFileV3("DataFiles\INPUT.txt", _ "DataFiles\private.key", _ "private key password", _ "SHA256", _ "DataFiles\OUTPUT.sig.txt") End Sub End Class
Exceptions
| Exception | Condition |
|---|---|
| System..::..ArgumentException | If the specified hashingAlgorithmparameter is not among the expected values |
| System.IO..::..IOException | If an I/O error occures |
| DidiSoft.Pgp.Exceptions..::..WrongPrivateKeyException | If there is no private key in this KeyStore having such User Id |
| DidiSoft.Pgp.Exceptions..::..WrongPasswordException | If the supplied private key password is incorrect |