Files
pdfcraft/vendor/hayro-syntax/Cargo.toml
Joel Tony 9d6552291b Issue #1296: hayro-syntax applies SASLprep to AES-256 passwords (PdfCraft patch 16) (#1345)
Revisions 5-6 of the standard security handler key the file on the
password processed with SASLprep (ISO 32000-2 7.6.4.3.3, Algorithm 2.A
step a). pdfcraft-crypt writes and reads it so, but the vendored
hayro-syntax skipped the step ("TODO: Do the above.") and used the UTF-8
bytes as typed. A password that SASLprep changes (a decomposed "cafe" +
U+0301, a no-break space, fullwidth letters typed by an IME in full-width
mode) was wrong for the renderer: Protect with such an open password was
rolled back ("the password is incorrect"), and an AES-256 file with such a
password did not open in a session with it, although pdfcraft-cos
accepted it.

- hayro-syntax (vendored patch 16) tries an R5/R6 password in its SASLprep
  form (as pdfcraft-crypt computes it: as given if SASLprep refuses it,
  UTF-8, at most 127 bytes), then, when that differs, as given.
  stringprep, already in the tree through pdfcraft-crypt, is an optional
  dependency enabled by the std feature; without std nothing changes.
- Tests: hayro-syntax crypto::pdfcraft_password_tests (candidate list and
  R5/R6 dictionaries built from prepared passwords) and two engine tests
  (Protect and reopen, and pdfcraft-cos-encrypted files) for the three
  cases, with precomposed "caf\u{E9}" as the control. The dictionary test
  and both engine tests fail without the fix.

Fixes #1296.
2026-10-12 05:41:38 -04:00

161 lines
3.2 KiB
TOML

# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2024"
rust-version = "1.92"
name = "hayro-syntax"
version = "0.7.2"
authors = ["Laurenz Stampfl <laurenz.stampfl@gmail.com>"]
build = false
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "A low-level crate for reading PDF files."
readme = "README.md"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/LaurenzV/hayro"
resolver = "2"
[features]
default = [
"std",
"images",
]
images = [
"dep:zune-jpeg",
"dep:hayro-ccitt",
"dep:hayro-jbig2",
"dep:hayro-jpeg2000",
]
logging = [
"dep:log",
"hayro-jpeg2000?/logging",
]
std = [
"hayro-jbig2?/std",
"hayro-jpeg2000?/std",
"dep:rustc-hash",
"dep:stringprep",
"zune-jpeg?/std",
]
unsafe = [
"std",
"dep:flate2",
"dep:memchr",
"hayro-jbig2?/simd",
"hayro-jpeg2000?/simd",
"zune-jpeg?/x86",
"zune-jpeg?/neon",
]
[lib]
name = "hayro_syntax"
path = "src/lib.rs"
[[example]]
name = "iterate"
path = "examples/iterate.rs"
[dependencies.flate2]
version = "1"
optional = true
[dependencies.hayro-ccitt]
version = "0.3.0"
optional = true
default-features = false
[dependencies.hayro-jbig2]
version = "0.3.0"
optional = true
default-features = false
[dependencies.hayro-jpeg2000]
version = "0.3.5"
optional = true
default-features = false
[dependencies.log]
version = "0.4"
optional = true
[dependencies.memchr]
version = "2.8.0"
features = ["alloc"]
optional = true
default-features = false
[dependencies.rustc-hash]
version = "2"
optional = true
[dependencies.smallvec]
version = "1"
[dependencies.stringprep]
version = "0.1"
optional = true
[dependencies.zune-jpeg]
version = "0.5"
optional = true
default-features = false
[dev-dependencies.aes]
version = "0.8.4"
[dev-dependencies.cbc]
version = "0.1.2"
[dev-dependencies.md5]
version = "0.8"
[dev-dependencies.sha2]
version = "0.10"
[lints.clippy]
collection_is_never_read = "warn"
dbg_macro = "warn"
debug_assert_with_mut_call = "warn"
default_trait_access = "warn"
doc_markdown = "warn"
fn_to_numeric_cast_any = "warn"
infinite_loop = "warn"
large_stack_arrays = "warn"
mismatching_type_param_order = "warn"
negative_feature_names = "warn"
redundant_feature_names = "warn"
same_functions_in_if_condition = "warn"
semicolon_if_nothing_returned = "warn"
todo = "warn"
too_many_arguments = "allow"
unseparated_literal_suffix = "warn"
use_self = "warn"
wildcard_dependencies = "warn"
[lints.rust]
elided_lifetimes_in_paths = "warn"
keyword_idents_2024 = "forbid"
missing_docs = "warn"
non_ascii_idents = "forbid"
non_local_definitions = "forbid"
trivial_numeric_casts = "warn"
unnameable_types = "warn"
unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "forbid"
unused_import_braces = "warn"
unused_lifetimes = "warn"
unused_macro_rules = "warn"
unused_qualifications = "warn"