DEV Community

Aniket Chaturvedi
Aniket Chaturvedi

Posted on

Sign a PDF in Java with a green tick — PAdES, timestamp & LTV in one call

Signing a PDF from Java so that Adobe Reader shows the green tick"Signed and all signatures are valid" — usually means wiring up PAdES, a trusted timestamp, the DSS for long-term validation, and a signature appearance by hand. That's a lot of plumbing.

ATick does it in one call — free under AGPL-3.0.

ATick's verified signature appearance — a green-tick validity mark with signer, date, reason and location

Add the dependency

Maven:

<dependency>
  <groupId>io.github.aniketc068</groupId>
  <artifactId>atick</artifactId>
  <version>1.0.6</version>
</dependency>
Enter fullscreen mode Exit fullscreen mode

Sign with a green tick, timestamp and LTV

import io.github.aniketc068.atick.Atick;
import java.nio.file.*;

public class Quickstart {
    public static void main(String[] args) throws Exception {
        byte[] pdf = Files.readAllBytes(Paths.get("doc.pdf"));
        byte[] pfx = Files.readAllBytes(Paths.get("my.pfx"));

        byte[] signed = Atick.signPfx(pdf, pfx,
            "{\"password\":\"your-password\",\"cn\":\"Axonate Tech\",\"reason\":\"Approved\","
          + "\"green_tick\":true,\"page\":1,\"rect\":[300,55,575,175],"
          + "\"pades\":true,\"timestamp\":true,\"ltv\":true}");   // PAdES-B-LT

        Files.write(Paths.get("signed.pdf"), signed);
    }
}
Enter fullscreen mode Exit fullscreen mode

Open signed.pdf in Adobe Reader — with a trusted certificate it shows the green tick and "Signed and all signatures are valid."

Adobe Reader:

  • green_tick → draws the validity mark Adobe greens for a valid + trusted certificate
  • pades / timestamp / ltv → PAdES-B-LT (add lta for B-LTA)

More than the basics

  • USB token / smart-card / HSM via PKCS#11 — Atick.signPkcs11(...).
  • Deferred / remote-key / eSignAtick.prepareDeferred(...) then Atick.embed(...).
  • Certified (no-changes) signatures, encrypted output, and a fully customizable appearance.

The same API exists in Python, .NET, Node.js and PHP — one engine, five languages.

Links

ATick is free under AGPL-3.0 (a commercial license is only needed to resell it). A product by Axonate Tech.

Top comments (0)