5 releases (breaking)

0.7.0 Apr 18, 2020
0.6.1 Jun 14, 2018
0.5.4 Sep 8, 2017
0.5.3 Jul 22, 2017
0.2.0 Jul 24, 2015

#651 in Cryptography

Download history 53/week @ 2022-05-31 18/week @ 2022-06-07 5/week @ 2022-06-14 8/week @ 2022-06-21 6/week @ 2022-06-28 1090/week @ 2022-07-05 29/week @ 2022-07-12 12/week @ 2022-07-19 15/week @ 2022-07-26 22/week @ 2022-08-02 12/week @ 2022-08-09 10/week @ 2022-08-16 20/week @ 2022-08-23 6/week @ 2022-08-30 36/week @ 2022-09-06 24/week @ 2022-09-13

86 downloads per month

LGPL-2.1

130KB
3.5K SLoC

libgcrypt-rs

Build Status crates.io version LGPL-2.1 licensed downloads

Libgcrypt bindings for Rust.

Documentation

Building

These crates require the libgcrypt library and its development files (e.g., headers, libgcrypt-config) to be installed. The buildscript will attempt to detect the necessary information using the libgcrypt-config script distributed with libgcrypt. If for whatever reason this does not work, the required information can also be specified using one or more environment variables:

  • LIBGCRYPT_INCLUDE specifies the path(s) where header files can be found.
  • LIBGCRYPT_LIB_DIR specifies the path(s) where library files (e.g., *.so, *.a, *.dll, etc.) can be found.
  • LIBGCRYPT_LIBS specifies the name(s) of all required libraries.
  • LIBGCRYPT_STATIC controls whether libraries are linked to statically or dynamically by default. Individual libraries can have their linkage overridden by prefixing their names with either static= or dynamic= in LIBGCRYPT_LIBS.
  • LIBGCRYPT_CONFIG specifies the path to the libgcrypt-config script.

Each environment variable, with the exceptions of LIBGCRYPT_STATIC and LIBGCRYPT_CONFIG, can take multiple values separated by the platform's path separator.

NOTE: These crates also depend on the gpg-error crate which has its own requirements.

NOTE: Previous versions of these crates bundled the sources of the libgcrypt library and attempted to build them via the buildscript. This is no longer supported.

Usage

The library requires initialization before first use. The functions init, init_fips, and init_default can be used to initialize the library. The closure passed to the first two functions is used to configure the library. For the third function a default configuration is used. More information on configuration options can be found in the libgcrypt documentation.

An example:

let token = gcrypt::init(|x| {
    x.disable_secmem();
});

Calling any function in the wrapper that requires initialization before one of the initialization functions has been called will cause the wrapper to attempt to initialize the library with a call to init_default.

Dependencies

~230–510KB