Skip to content
BiNeuralePublic

About

Native Linux reader for signed .p7m envelopes, PDF, Markdown and office files, with local CAdES/PAdES signature verification against the EU trusted lists. Written in Rust.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MiDas

A native document reader for Linux that opens signed .p7m envelopes, PDF, Markdown and office files, and checks digital signatures locally.

MiDas showing a signed .pdf.p7m: the PDF on the left, the signature panel with the signer, the verdict and the verification steps on the right

Why

In Italy, public administrations, notaries and companies send documents as contratto.pdf.p7m: a PDF wrapped in a CAdES signature envelope. On Windows people install the reader their signing provider gives them; on Linux there is very little, and what there is usually means a web upload or a Java tool from another era. I wanted a double click on a .p7m to show the document and, next to it, who signed it and whether the signature holds, without sending the file anywhere.

Once the reader existed, it was natural to make it open everything else I read every day: PDF, Markdown with formulas and diagrams, plain text and logs, images, DOCX/ODT/RTF.

Status: 0.1.0, first public release. The interface is in Italian for now; an English translation is in progress and will come in a later release. The code identifiers are partly Italian too: see docs/GLOSSARY.md.

What it does today

Opening a signed .pdf.p7m: a short animation of the envelope opening, then the PDF and the signature panel with signer, tax code, issuer and the verification steps

Signed documents

  • .p7m envelopes (CAdES, DER or Base64), nested envelopes (.p7m.p7m), .m7m and .tsd with RFC 3161 timestamps. The content is extracted in memory and opened with the right viewer; the original file is never written.
  • PAdES signatures inside PDFs, including detection of changes made after signing.
  • A signature panel in plain language: a traffic-light verdict (valid / intact with reservations / not valid), and for each signer name, tax code, organization, issuer, signing time, certificate expiry, qualification. Technical details and the list of verification steps are one click away.
  • Checks: integrity, cryptographic validity, chain up to a provider of the EU trusted lists (LOTL and the Italian TSL, downloaded and cached), validity at signing or timestamp time, revocation via OCSP and CRL. Without network it says plainly that revocation was not checked.
  • Save the extracted original, export a verification report (Markdown).
  • Short explanation cards ("What is this?") for envelope, timestamp, chain, revocation, qualification, PAdES and so on, at three levels of detail.

Markdown

A Markdown file with a formula, a Mermaid flowchart and a table, re-rendered live while the file is edited in another program

  • CommonMark + GFM (tables, task lists, footnotes, GitHub-style callouts, front matter).
  • LaTeX formulas ($…$, $$…$$, also \(…\) and \[…\]) rendered natively through Typst.
  • Mermaid diagrams rendered natively, no browser.
  • Live reload when the file changes on disk, keeping the scroll position.
  • Tolerant of Markdown pasted from chat tools: unclosed code blocks, ragged tables, 【1†source】 citation marks, invisible characters. The file is never modified.
  • Paste from the clipboard to read it; copy as rich text for Word or e-mail.

Everything else

  • PDF via PDFium (search, selection, outline, links, password prompt, night mode), with hayro (pure Rust) as automatic fallback for damaged files or when PDFium is missing.
  • Plain text, logs and CSV: encoding detection, memory-mapped files with a background line index, so very large files open at once.
  • Images: PNG, JPEG, GIF, WebP, TIFF, SVG.
  • DOCX, ODT, RTF: a content view rendered by MiDas, and a faithful view through LibreOffice when it is installed (converted to PDF in a cache).
  • Tabs, folder panel, outline, search, command palette (Ctrl+K), single instance, session restore, light/dark/compact themes.

No account, no telemetry. The network is used only for the trusted lists and for OCSP/CRL, and it can be switched off.

Install (Linux, from source)

You need a Rust toolchain (rustup; the version is pinned in rust-toolchain.toml and installed automatically) and curl.

git clone https://github.com/BiNeurale/MiDas
cd MiDas
tools/installa-linux.sh               # builds in release and installs into ~/.local

The script needs no root. It installs the binary and PDFium into ~/.local/lib/midas/, the midas command into ~/.local/bin/, a menu entry, the MIME types and the icons. MiDas becomes the default application for signed envelopes (.p7m, .m7m, .tsd, with their own icon); for the other formats it shows up in "Open with".

PDFium is the prebuilt library from bblanchon/pdfium-binaries (chromium/8100), downloaded by tools/scarica-pdfium.sh with a pinned SHA-256. To use your own copy, set MIDAS_PDFIUM_DIR to the folder that contains libpdfium.so. Without PDFium MiDas still opens PDFs with the fallback engine.

tools/installa-linux.sh --ricompila    # force a rebuild
tools/installa-linux.sh --disinstalla  # remove everything it installed

Run from the source tree: cargo run --release -p midas -- file.pdf.p7m. Checks used during development: tools/check.sh (rustfmt, clippy, tests, cargo deny).

Numbers

Release build, laptop with an AMD Ryzen 7 5700U, measured on 4 reserved cores while the rest of the machine was busy. These are whole-process times of midas-inspect, the command-line front end of the same verification and parsing code the window uses (median of 30 runs, 10 for Markdown):

Task Median
verify the 80 kB .pdf.p7m shown above, offline (open envelope, extract PDF, CMS signature, chain) 8.8 ms
same, plus fetching and checking the CRL over HTTP (local server) 15.2 ms
parse a 5.3 MB Markdown file (39,601 blocks) 602 ms
process start and exit, for reference 5.2 ms

The release binary is 99 MB (fonts, the Typst math engine and the Mermaid renderer are built in); PDFium adds 8 MB next to it.

Limits

  • Linux only for now. Windows builds are being worked on; macOS is not planned yet.
  • Italian interface only in this release.
  • It is a reader: it does not create signatures and does not edit any format.
  • Qualification ("qualified signature") comes from the EU trusted lists: a certificate from a provider that is not on the lists is shown with its chain, but not as qualified.
  • The office content view is simplified (no exact pagination); use the faithful view, which needs LibreOffice, when layout matters.
  • PDFium is native code: a crash inside it takes the window down. Running it in a separate process is on the list.
  • The XML signature of the trusted lists is not verified yet: the lists are fetched over HTTPS from the official URLs and cached, and that is the only protection for now.
  • Mermaid support covers the common diagram types, not all of them.

Layout

Crate Role
midas the application (egui + wgpu)
midas-sign CAdES/PAdES verification, timestamps, OCSP/CRL, EU trusted lists
midas-pdf PDF behind one trait: PDFium, hayro fallback
midas-markdown Markdown parsing and the tolerant pre-pass
midas-math, midas-diagram formulas (Typst) and Mermaid diagrams to images
midas-office DOCX/ODT/RTF import, LibreOffice conversion
midas-text large text files: encoding, line index
midas-ui layout and views shared by the formats
midas-learn the explanation cards
midas-inspect command-line check of a file: midas-inspect [--offline] doc.pdf.p7m, exit code = verdict
midas-core, midas-limits format detection, size and time limits for hostile input

The test corpus in tests/corpus/ is synthetic: a fictional test CA, the specimen tax code RSSMRA80A01H501U, generated PDFs and office files. tests/corpus/tsl/ holds public copies of the EU and Italian trusted lists used as parser fixtures.

The images and animations in this README come from the real program, recorded headless by tools/capture-media.sh on synthetic documents.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option. Bundled fonts are under the SIL Open Font License (assets/fonts/licenses/); PDFium and its components keep their own licenses (licenses/pdfium/).

Copyright © 2026 BiNeurale.

About

Native Linux reader for signed .p7m envelopes, PDF, Markdown and office files, with local CAdES/PAdES signature verification against the EU trusted lists. Written in Rust.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages