diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2013-10-01 15:27:32 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2013-10-01 15:27:32 +0200 |
commit | add4460d9619f3586a02ae0d8c028f01903494bc (patch) | |
tree | 244ef6d0f0af028da98f9cecd3ee9a3424223889 /pdf-as-cli/src/main | |
parent | 25f5495b60fb0fb089c7af216986d2f3abf92375 (diff) | |
download | pdf-as-4-add4460d9619f3586a02ae0d8c028f01903494bc.tar.gz pdf-as-4-add4460d9619f3586a02ae0d8c028f01903494bc.tar.bz2 pdf-as-4-add4460d9619f3586a02ae0d8c028f01903494bc.zip |
+ Extracting information from Certificate (Ognl)
+ CMS KeyStore Signer (still wrong format)
Diffstat (limited to 'pdf-as-cli/src/main')
-rw-r--r-- | pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java index cae1171e..4b9a4e33 100644 --- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java +++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java @@ -13,22 +13,34 @@ import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; import at.gv.egiz.pdfas.lib.api.Configuration; import at.gv.egiz.pdfas.lib.api.PdfAs; import at.gv.egiz.pdfas.lib.api.PdfAsFactory; +import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; +import at.gv.egiz.pdfas.lib.impl.signing.IPdfSigner; +import at.gv.egiz.pdfas.lib.impl.signing.sig_interface.JKSSigner; public class DeveloperMain { + public static final String keyStoreFile = "/home/afitzek/devel/pdfas_neu/test.p12"; + public static final String keyStoreType = "PKCS12"; + public static final String keyStorePass = "123456"; + //public static final String keyAlias = "pdf"; + public static final String keyAlias = "ecc_test"; + public static final String keyPass = "123456"; + public static void main(String[] args) { String user_home = System.getProperty("user.home"); String pdfas_dir = user_home + File.separator + "PDF-AS"; PdfAs pdfas = PdfAsFactory.createPdfAs(new File(pdfas_dir)); Configuration config = pdfas.getConfiguration(); - byte[] data; try { + IPlainSigner signer = new JKSSigner(keyStoreFile, keyAlias, keyStorePass, keyPass, keyStoreType); data = StreamUtils.inputStreamToByteArray(new FileInputStream("/home/afitzek/devel/pdfas_neu/simple.pdf")); SignParameter parameter = PdfAsFactory.createSignParameter(config, new ByteArrayDataSource(data)); ByteArrayDataSink bads = new ByteArrayDataSink(); + parameter.setSignatureProfileId("SIGNATURBLOCK_DE_NEU"); parameter.setOutput(bads); + parameter.setPlainSigner(signer); pdfas.sign(parameter); FileOutputStream fos = new FileOutputStream("/home/afitzek/devel/pdfas_neu/simple_out.pdf"); fos.write(bads.getData()); |