PgpCore 1.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package PgpCore --version 1.2.1
NuGet\Install-Package PgpCore -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PgpCore" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PgpCore --version 1.2.1
#r "nuget: PgpCore, 1.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PgpCore as a Cake Addin
#addin nuget:?package=PgpCore&version=1.2.1

// Install PgpCore as a Cake Tool
#tool nuget:?package=PgpCore&version=1.2.1

PgpCore

A .NET Core class library for using PGP.

This is based on <a href="https://github.com/Cinchoo/ChoPGP" alt="ChoPGP">ChoPGP</a> but updated to .NET Core framework and to add in a missing utilities class.

Installation

To use PgpCore in your C# project, you can either download the PgpCore C# .NET libraries directly from the Github repository or, if you have the NuGet package manager installed, you can grab them automatically.

PM> Install-Package PgpCore

Once you have the PgpCore libraries properly referenced in your project, you can include calls to them in your code.

Add the following namespaces to use the library:

using PgpCore;

Dependencies

BouncyCastle.NetCore (>= 1.8.1.3)

Microsoft.NETCore.App (>= 1.1.2)

Usage

This is intended for usage in .NET Core projects.

using (PGP pgp = new PGP())
{
                // Generate keys
                pgp.GenerateKey(@"C:\TEMP\keys\public.asc", @"C:\TEMP\keys\private.asc", "email@email.com", "password");
                // Encrypt file
                pgp.EncryptFile(@"C:\TEMP\keys\content.txt", @"C:\TEMP\keys\content__encrypted.pgp", @"C:\TEMP\keys\public.asc", true, true);
                // Encrypt and sign file
                pgp.EncryptFileAndSign(@"C:\TEMP\keys\content.txt", @"C:\TEMP\keys\content__encrypted_signed.pgp", @"C:\TEMP\keys\public.asc", @"C:\TEMP\keys\private.asc", "password", true, true);
                // Decrypt file
                pgp.DecryptFile(@"C:\TEMP\keys\content__encrypted.pgp", @"C:\TEMP\keys\content__decrypted.txt", @"C:\TEMP\keys\private.asc", "password");
                // Decrypt signed file
                pgp.DecryptFile(@"C:\TEMP\keys\content__encrypted_signed.pgp", @"C:\TEMP\keys\content__decrypted_signed.txt", @"C:\TEMP\keys\private.asc", "password");

                // Encrypt stream
                using (FileStream inputFileStream = new FileStream(@"C:\TEMP\keys\content.txt", FileMode.Open))
                using (Stream outputFileStream = File.Create(@"C:\TEMP\keys\content__encrypted2.pgp"))
                using (Stream publicKeyStream = new FileStream(@"C:\TEMP\keys\public.asc", FileMode.Open))
                    pgp.EncryptStream(inputFileStream, outputFileStream, publicKeyStream, true, true);

                // Decrypt stream
                using (FileStream inputFileStream = new FileStream(@"C:\TEMP\keys\content__encrypted2.pgp", FileMode.Open))
                using (Stream outputFileStream = File.Create(@"C:\TEMP\keys\content__decrypted2.txt"))
                using (Stream privateKeyStream = new FileStream(@"C:\TEMP\keys\private.asc", FileMode.Open))
                    pgp.DecryptStream(inputFileStream, outputFileStream, privateKeyStream, "password");
}

A good resource for generating keys and messages is <a href="https://wp2pgpmail.com/pgp-key-generator/" alt="PGP Key Generator">PGP Key Generator</a>.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on PgpCore:

Package Downloads
DTF.Services.Common.V2

DTF common services.

APF.Core

Package Description

Hona.Tool

消息队列,如:kafka等

EDennis.AspNetCore.Utils

Provides various classes that assist with ASP.NET Core 2 development.

Sonar.Lib.SFTP

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on PgpCore:

Repository Stars
axzxs2001/Asp.NetCoreExperiment
原来所有项目都移动到**OleVersion**目录下进行保留。新的案例装以.net 5.0为主,一部分对以前案例进行升级,一部分将以前的工作经验总结出来,以供大家参考!
automuteus/amonguscapture
Capture of the local Among Us executable state
Version Downloads Last updated
6.3.1 122,532 12/19/2023
5.13.1 44,641 11/15/2023
5.13.0 50,154 10/21/2023
5.10.0 456,470 3/23/2023
5.9.0 382,134 11/16/2022
5.8.1 298,002 9/6/2022
5.7.0 178,290 7/11/2022
5.6.0 70,497 6/8/2022
5.5.0 623,173 11/19/2021
5.4.0 20,338 11/14/2021
5.3.2 27,806 11/5/2021
5.3.1 182,492 9/14/2021
5.3.0 32,998 8/27/2021
5.2.0 674,520 4/16/2021
5.1.0 72,995 2/2/2021
4.0.1 157,902 12/14/2020
4.0.0 41,789 12/1/2020
3.2.0 254,779 10/28/2020
3.1.0 30,559 10/16/2020
2.4.2 232,011 7/30/2020
2.4.1 15,800 6/29/2020
2.4.0 17,040 5/13/2020
2.3.0 29,255 3/30/2020
2.2.0 407,410 1/15/2020
2.1.1 33,242 11/20/2019
2.1.0 83,706 9/18/2019
2.0.0 88,295 8/28/2019
1.7.2 94,511 8/20/2019
1.7.0 99,494 7/24/2019
1.6.0 8,445 7/4/2019
1.4.1 177,636 3/29/2019
1.4.0 64,406 2/20/2019
1.3.1 33,670 12/6/2018
1.3.0 1,032 12/3/2018
1.2.1 30,006 8/20/2018
1.2.0 17,407 7/4/2018
1.1.1 6,620 2/10/2018
1.1.0 108,417 9/15/2017
1.0.3 1,248 8/3/2017
1.0.2 1,271 6/8/2017
1.0.1 1,253 6/5/2017
1.0.0 1,991 6/2/2017

Added EncryptStreamAndSignAsync.