-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01-self-signed.sh
More file actions
36 lines (31 loc) · 1.08 KB
/
Copy path01-self-signed.sh
File metadata and controls
36 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# verify/01-self-signed.sh — verify a PDF signed with a self-signed certificate
#
# Demonstrates:
# pdfnative verify --input signed.pdf
#
# Scope reminder (v0.2.0):
# verify checks INTEGRITY (byte-range digest) + CHAIN (cert signatures) +
# TRUST (--trust roots, or self-signed acceptance). Full CMS-signature-value
# verification, OCSP/CRL revocation, and RFC 3161 timestamps are out of
# scope until pdfnative exposes the corresponding primitives.
#
# Prerequisites:
# - samples/sign/01-basic.sh has produced a signed PDF
#
# Usage:
# bash samples/verify/01-self-signed.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
SIGNED_PDF="$ROOT_DIR/samples/output/sign/01-basic-signed.pdf"
if [ ! -f "$SIGNED_PDF" ]; then
echo " ✗ Signed PDF not found. Run samples/sign/01-basic.sh first."
exit 1
fi
echo "→ Verifying $SIGNED_PDF"
echo ""
pdfnative verify --input "$SIGNED_PDF" --format text
echo ""
echo "JSON output (machine-readable):"
pdfnative verify --input "$SIGNED_PDF" --format json