Expand description
§HTTP Digest Headers
A partial implementation of http-digest-headers that is easily extensible for additional digest algoritms and crypto libs. For deets, read_the_docs
§Features
§Crypto Support
Both OpenSSL and Ring are currently supported (with openssl as the default). But the crate is designed such that extending for additional crypto libs should be trivial. Just send me a PR!
- use_openssl: This is the default
- use_ring: Turn off default features and add
use_ring
[dependencies]
http_digest_headers = { version="0.1.0", default-features = false, features ="use_ring" }
§Examples
§Generate a digest header value
use http_digest_headers::{DigestHeader, DigestMethod, Error};
fn make_digest_header() -> Result<String, Error> {
// Generate some simple test data. This can be anything.
let data = b"this is some data";
// Create a builder, and digest with both SHA-256 and SHA-512.
let builder = DigestHeader::new()
.with_method(DigestMethod::SHA256, data)?
.with_method(DigestMethod::SHA512, data)?;
// Generate the resulting strings for the digest header value.
let header_value = format!("{}", builder);
// The result:String can now be used in a digest header. For instance,
// for reqwest, you might use client.header("digest", result).
Ok(header_value)
}
Structs§
- Digest
- Encapsulates the cryptographic methods
- Digest
Header - Helper struct to create the actual
Digest
orContent-Digest
header value
Enums§
- Digest
Method - Digest methods supported by this crate.
- Error
- Standard Error values. Errors are developed with thiserror.