/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.test.netbeans.examplesignpdfusbtoken; /** * * @author TuoiCM */ public class DemoSignPDFUsbToken { public static final String SRC = "./resources/test.pdf"; public static final String DEST = "./resources/test_signed.pdf"; public static void main(String[] args) { // linux library // UsbToken tokenUnix = new UsbToken("/my/path/library.so"); // windows library UsbToken tokenWin = new UsbToken("C:\\Windows\\System32\\eps2003csp11.dll"); byte[] signValue = tokenWin.signText("text to sign...", "12345678"); boolean valid = new Notary().verifySignature("text to sign...".getBytes(), signValue, tokenWin.publicKey("12345678")); System.out.println("is valid?: " + valid); //pdf signing tokenWin.signPdf(SRC, DEST, "12345678", "Test", "HCM VIET NAM"); } }