This repository contains the code for the Proton.Cryptography NuGet package which wraps proton-rpgp and proton-srp for use in .NET projects.
Please see LICENSE file for the license.
- .NET SDK 10.0
- Rust (stable), with the
rustuptarget 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-gnullvmtargets, plus theCARGO_TARGET_*_LINKER,CC_*,AR_*andRC_*variables for those targets, which point into it (seebuild/Dockerfile) - Linux ARM64:
gcc-aarch64-linux-gnuandlibc6-dev-arm64-crosson Debian-based systems - Android: the Android NDK, plus the
CARGO_TARGET_*_LINKER,CC_*andAR_*variables for the Android targets, which point into the NDK (seebuild/Dockerfile) - Apple: a Mac with Xcode, since Apple targets cannot be cross-built
- Build the native library for each platform, from
src/rust/proton-crypto-ffi:
just mode=release builder=cargo linux-x64Run 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.
- Run the tests, from the repository root, once the library for your platform is built:
dotnet run --project tests/dotnet- 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-repositoryAdd a reference to the package in your project configuration (.csproj):
<PackageReference Include="Proton.Cryptography" Version="1.0.0" />This package currently does not support the following features:
- Validation of UTF-8 content
Contributions are not accepted at the moment.