Skip to content

Repository files navigation

PostGuard

For full documentation, visit docs.postguard.eu.

.NET SDK for PostGuard encryption, published as E4A.PostGuard on NuGet. Allows .NET applications to encrypt files for recipients using identity-based encryption. This is a sending-side SDK: it handles encryption and upload, while decryption is handled by the recipient through postguard.eu or the mail plugins.

Quick Start

using E4A.PostGuard;
using E4A.PostGuard.Models;

var pg = new PostGuard(new PostGuardConfig
{
    PkgUrl = "https://pkg.postguard.eu",
    CryptifyUrl = "https://fileshare.postguard.eu"
});

var encrypted = pg.Encrypt(new EncryptInput
{
    Files = [new PgFile("report.txt", fileStream)],
    Recipients = [pg.Recipient.Email("[email protected]")],
    Sign = pg.Sign.ApiKey("PG-API-xxx")
});

var result = await encrypted.UploadAsync();
Console.WriteLine(result.Uuid);

See the full API reference for all encryption options, recipient types, and upload/notification methods.

Development

Prerequisites

  • .NET 10.0+ SDK
  • Rust toolchain (rustup)

Build native library

The pg-ffi crate lives in the postguard repo. Build it first:

cd ../postguard/pg-ffi
./build.sh

This compiles the Rust FFI crate and copies the native library to src/runtimes/. CI and the NuGet publish instead download the pre-built release pinned in .github/pg-ffi-version; check out that tag to build the same binaries locally.

Build the .NET solution

dotnet build E4A.PostGuard.slnx

Run the example

See postguard-examples/pg-dotnet.

Releasing

Releases are automated with release-please. When changes land on main, release-please opens a release PR. Merging that PR triggers CI to download pre-built pg-ffi native libraries and publish the package to NuGet.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages