Package org.apache.pdfbox.examples.signature

Examples of org.apache.pdfbox.examples.signature.CreateSignature


        // load the keystore
        KeyStore keystore = KeyStore.getInstance("PKCS12");
        keystore.load(new FileInputStream(keystorePath), password.toCharArray());

        // sign PDF
        CreateSignature signing = new CreateSignature(keystore, password.toCharArray());
        signing.signDetached(new File(inDir + "sign_me.pdf"), new File(outDir + "signed.pdf"));

        // TODO verify the signed PDF file
    }
View Full Code Here


        // sign PDF (will fail due to nonce and timestamp differing)
        try
        {
            String inPath = inDir + "sign_me_tsa.pdf";
            String outPath = outDir + "signed_tsa.pdf";
            CreateSignature signing = new CreateSignature(keystore, password.toCharArray());
            signing.signDetached(new File(inPath), new File(outPath), tsaClient);
        }
        catch (IOException e)
        {
            assertTrue(e.getCause() instanceof TSPValidationException);
        }
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.examples.signature.CreateSignature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.