Crates.io | gcrypt |
lib.rs | gcrypt |
version | 0.7.0 |
source | src |
created_at | 2015-07-14 02:34:14.297255 |
updated_at | 2020-04-18 01:53:39.439167 |
description | Libgcrypt bindings for Rust |
homepage | |
repository | https://github.com/gpg-rs/libgcrypt |
max_upload_size | |
id | 2601 |
size | 197,673 |
Libgcrypt bindings for Rust.
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.
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
.