/* * 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 DemoSignPDFUsbTokenMSCAPI { public static final String SRC = "./resources/test.pdf"; public static final String DEST = "./resources/test_signed.pdf"; public static void main(String[] args) { // windows library UsbTokenMSCAPI mSCAPI = new UsbTokenMSCAPI("C:\\Windows\\System32\\eps2003csp11.dll"); byte[] signValue = mSCAPI.signText("text to sign...", "12345678"); boolean valid = new Notary().verifySignature("text to sign...".getBytes(), signValue, mSCAPI.publicKey()); System.out.println("is valid?: " + valid); //Sign PDF Solution MS-CAPI mSCAPI.signPdf(SRC, DEST, "Test MS-CAPI", "HCM-VN"); } }