Low-level Rust bindings for the Nettle cryptographic library.
The documentation can be found here.
To build the Nettle bindings, you need a few libraries and support packages. Notably, you need the Nettle cryptographic library version 3.4.1 or up.
Please see below for OS-specific commands to install the needed libraries.
$ sudo apt install clang llvm pkg-config nettle-dev
$ sudo pacman -S clang pkg-config nettle --needed
$ sudo dnf install clang pkg-config nettle-devel
macOS (Mojave), using MacPorts
$ sudo port install nettle pkgconfig
You can install the needed libraries with the following command:
$ pacboy -S clang:x nettle:x
nettle-sys can be cross compiled using
cross and a custom Docker container. First, build the container and install
cargo install cross docker -t nettle-sys/<toolchain>:1 docker/<toolchain>
Then, you can cross compile the project:
cross --target <toolchain> -v
The build artifacts will be placed in
nettle-sys is dynamically linked to its dependencies.
By defining the
NETTLE_STATIC environment variable during the build, it can
also be statically link to its dependencies:
env NETTLE_STATIC=yes cargo build
This is particularly useful to produce standalone binaries that can be easily distributed.
bindgen to generate bindings for
Nettle. In some build environments, this might not work due to
bindgen depending on
libllvm. In this case, the
be pregenerated, and used by setting:
env NETTLE_PREGENERATED_BINDINGS=/path/to/bindings.rs cargo build
bindings.rs is specific to target architecture, operating
system, and Nettle version.
This project is licensed under either of
- GNU General Public License, Version 2.0, (LICENSE-GPL2 or https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- GNU General Public License, Version 3.0, (LICENSE-GPL3 or https://www.gnu.org/licenses/gpl.html)
- GNU Lesser General Public License, Version 3.0, (LICENSE-LGPL3 or https://www.gnu.org/licenses/lgpl.html)
at your option.