PgpSharp 1.0.0-alpha.3
dotnet add package PgpSharp --version 1.0.0-alpha.3
NuGet\Install-Package PgpSharp -Version 1.0.0-alpha.3
<PackageReference Include="PgpSharp" Version="1.0.0-alpha.3" />
paket add PgpSharp --version 1.0.0-alpha.3
#r "nuget: PgpSharp, 1.0.0-alpha.3"
// Install PgpSharp as a Cake Addin #addin nuget:?package=PgpSharp&version=1.0.0-alpha.3&prerelease // Install PgpSharp as a Cake Tool #tool nuget:?package=PgpSharp&version=1.0.0-alpha.3&prerelease
About PgpSharp
This project is an attempt at providing very basic PGP functionality through a C# interface, including listing keys, encrypting/signing data, and decrypting data. It does not generate or manage keys at the moment.
Get it on NuGet
See the package page, or run
Install-Package PgpSharp
Using the lib
The main interface to use is IPgpTool. The lib provides a default implementation that wraps around the GnuPG2 binary and can be instantiated like this:
IPgpTool tool = new GnuPGTool(new GpgOptions());
By default the GpgOptions
will try to find the GnuPG binary in the standard install
folder. To override the binary file path set this property:
new GpgOptions { GpgPath = @"your\path\to\gpg" };
To encrypt/sign/decrypt data, you would use the ProcessData() method of the interface, and you have the option of using the StreamDataInput (for processing streams) or FileDataInput (for processing files).
// example encrypting a file
var encryptArg = new FileDataInput
{
Armor = true,
InputFile = @"path\to\src\file",
OutputFile = @"path\to\output\file",
Operation = DataOperation.Encrypt,
Recipient = "recipient's key id",
};
tool.ProcessData(encryptArg);
// example decrypting a file
SecureString yourPassphrase = ... // somehow generate it
var decryptArg = new FileDataInput
{
InputFile = @"path\to\encrypted\file",
OutputFile = @"path\to\output\file",
Operation = DataOperation.Decrypt,
Passphrase = yourPassphrase
};
tool.ProcessData(decryptArg);
Details on which properties to use for different sign/encrypt/decrypt operation is available in the intellisense of that property.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.6.2
-
net6.0
-
net8.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0-alpha.3 | 71 | 3/30/2024 |
0.2.0 | 7,901 | 3/26/2021 |
0.1.5 | 40,009 | 11/14/2015 |