mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-29 20:47:32 -06:00
* i18n: let the layers below hand their sentences over, so they can be translated The accessibility findings, the PDF/A problems, the signature details, the page-range mistakes and the edit labels were English in all ten languages, because matching their wording from the UI with a tl! literal would break silently whenever the engine changed it. So each layer now hands the wording over instead, apart from the document's own words: a WORDINGS list of every sentence it can say, with holes in it, and said(&words), which looks the wording up through the closure it is given and fills the holes in a single pass. in_english changes nothing, for the CLI and the tests; the UI passes &i18n::words, a catalog lookup. A wording with no entry comes back as it stands, which is the English, so the nine catalogs this does not touch read exactly as before. a11y::report_html takes a language tag and a words closure, so a saved report reads the way the panel read, down to its lang attribute. print::PrintError gained a variant per thing a person can be wrong about, with the numbers apart from the words; faults rather than mistakes keep their own text. Spanish translates all of it (107 entries). spanish_covers_what_the_engine_says requires an entry per wording in the eight lists and spanish_keeps_the_holes_in_what_the_engine_says requires the holes to survive the translation, so the catalog cannot fall behind the engine unnoticed. No new tl! literal, so the Chinese, French and Russian UI-literal gates are unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Sign tests from #1099: compare against the &'static str kinds * Camera tests: undo returns a Label now --------- Co-authored-by: Fernando Areán <soporte@codebit.es> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>
53 lines
1.7 KiB
Rust
53 lines
1.7 KiB
Rust
//! Digital signatures (execution plan M9; ISO 32000-2 §12.8; ETSI EN 319 142 PAdES).
|
|
//!
|
|
//! - [`der`], [`x509`], [`cms`], [`pkcs12`], [`keys`]: the cryptographic formats, on RustCrypto
|
|
//! primitives (RSA private-key operations use aws-lc-rs on native targets, ADR-0009).
|
|
//! - [`pdf`]: signature fields in a document — listing and validating them, and signing
|
|
//! (PAdES B-B, `ETSI.CAdES.detached`) with an incremental save.
|
|
|
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
|
|
pub mod cms;
|
|
pub mod der;
|
|
pub mod dss;
|
|
mod ec512;
|
|
pub mod graphic;
|
|
#[cfg(target_os = "macos")]
|
|
pub mod keychain;
|
|
pub mod keys;
|
|
pub mod pdf;
|
|
pub mod pkcs12;
|
|
pub mod revocation;
|
|
mod rsa_pad;
|
|
pub mod timestamp;
|
|
#[cfg(target_os = "windows")]
|
|
pub mod windows;
|
|
pub mod x509;
|
|
|
|
pub use der::Time;
|
|
pub use graphic::Graphic;
|
|
pub use keys::{DigestAlg, PrivateKey, PublicKey};
|
|
pub use pdf::{
|
|
Appearance, AppearanceLabels, Detail, DigestCache, Fill, Modification, SignOptions, SignatureInfo, Status, TrustStore, WORDINGS, Words,
|
|
in_english, kind, list as signatures, sign, sign_with_timestamp, timestamp_document, validate,
|
|
};
|
|
pub use pkcs12::DigitalId;
|
|
pub use timestamp::{TimestampAuthority, TimestampQuery, TimestampToken};
|
|
pub use x509::{Certificate, Name};
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum SignError {
|
|
#[error("malformed data: {0}")]
|
|
Malformed(String),
|
|
#[error("not supported: {0}")]
|
|
Unsupported(String),
|
|
#[error("the password is incorrect")]
|
|
WrongPassword,
|
|
#[error("{0}")]
|
|
Crypto(String),
|
|
#[error("{0}")]
|
|
Pdf(String),
|
|
#[error(transparent)]
|
|
Cos(#[from] pdfcraft_cos::CosError),
|
|
}
|