5 releases (breaking)
0.7.0 | Apr 18, 2020 |
---|---|
0.6.1 |
|
0.5.4 |
|
0.5.3 |
|
0.2.0 | Jul 14, 2015 |
#2102 in Cryptography
75 downloads per month
Used in 3 crates
(2 directly)
55KB
1K
SLoC
libgcrypt-rs
Libgcrypt bindings for Rust.
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 eitherstatic=
ordynamic=
inLIBGCRYPT_LIBS
.LIBGCRYPT_CONFIG
specifies the path to thelibgcrypt-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
~42–280KB