Skip to main content

fiscal_crypto/
lib.rs

1//! Digital-certificate loading and XML signing for Brazilian fiscal documents.
2//!
3//! `fiscal-crypto` provides two capabilities:
4//! - **Certificate management** — load a PKCS#12 `.pfx` file and extract the
5//!   signing key plus X.509 certificate chain ([`certificate`] module).
6//! - **XML signing** — produce `<Signature>` elements conforming to the
7//!   NF-e / NFC-e XML-DSIG specification, using the loaded certificate.
8//!
9//! # Signature algorithms
10//!
11//! By default, XML signing uses RSA-SHA1 for backwards compatibility.
12//! For ICP-Brasil v5 certificates or SEFAZs that reject SHA-1
13//! (rejeição 297), use [`SignatureAlgorithm::Sha256`] with the
14//! `*_with_algorithm` signing functions.
15
16/// Digital certificate loading, management, and XML signing.
17pub mod certificate;
18
19pub use certificate::SignatureAlgorithm;