Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

11 stars

Watchers

4 watching

Forks

Latest commit

 

History

66 Commits

Folders and files

Repository files navigation

Cryptography package for .NET

Introduction

This repository contains the code for the Proton.Cryptography NuGet package which wraps proton-rpgp and proton-srp for use in .NET projects.

License

Please see LICENSE file for the license.

Build prerequisites

  • .NET SDK 10.0
  • Rust (stable), with the rustup target of each platform you build for
  • just and jq, used by the build recipes

Cross-compiling the native library needs a C toolchain and linker for each target platform. build/Dockerfile installs all of them and sets the environment variables Cargo needs, so it is the reference for exact versions and settings:

  • Windows: llvm-mingw, for the *-pc-windows-gnullvm targets, plus the CARGO_TARGET_*_LINKER, CC_*, AR_* and RC_* variables for those targets, which point into it (see build/Dockerfile)
  • Linux ARM64: gcc-aarch64-linux-gnu and libc6-dev-arm64-cross on Debian-based systems
  • Android: the Android NDK, plus the CARGO_TARGET_*_LINKER, CC_* and AR_* variables for the Android targets, which point into the NDK (see build/Dockerfile)
  • Apple: a Mac with Xcode, since Apple targets cannot be cross-built

Build

  1. Build the native library for each platform, from src/rust/proton-crypto-ffi:
just mode=release builder=cargo linux-x64

Run just without arguments to list the recipes: one per .NET runtime identifier (such as win-x64 or linux-bionic-arm64), plus linux-all, android-all, windows-all and apple-all. Each recipe copies the library to bin/runtimes/<runtime identifier>/native, where the .NET project picks it up. The default builder, cross, runs the build in the container image configured in Cross.toml, which is hosted on an internal registry; outside Proton, use builder=cargo (toolchains installed on your machine), or build your own image from build/Dockerfile and point Cross.toml at it.

  1. Run the tests, from the repository root, once the library for your platform is built:
dotnet run --project tests/dotnet
  1. Pack into a NuGet package, which includes every library found under bin/runtimes:
dotnet pack -c Release -p:Version=1.0.0 src/dotnet/Proton.Cryptography.csproj --output ~/local-nuget-repository

Usage

Add a reference to the package in your project configuration (.csproj):

<PackageReference Include="Proton.Cryptography" Version="1.0.0" />

Known issues and missing features

This package currently does not support the following features:

  • Validation of UTF-8 content

Contributions

Contributions are not accepted at the moment.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

11 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages