Package org.commonlib.crypto

Examples of org.commonlib.crypto.PadesSignatureEngine$PdfSignatureAppearanceInfo


  {
    File input = new File("/Users/nicola/Documents/rad-image/argo-installation-report.pdf");
    File output = new File("/tmp/firmato.pdf");

    File libSmartcard = new File("/opt/smartcard-aruba/libbit4xpki.dylib");
    PadesSignatureEngine engine = new PadesSignatureEngine(libSmartcard);

    // inserisci QUI il PIN della smartcard
    engine.prepareSmartCardAndData("".toCharArray());

//      CardReaders readers = new CardReaders();
//      for(CardTerminal terminal : readers.getReaders())
//      {
//        System.out.println(terminal.getName());
//      }
//      for(CardTerminal terminal : readers.getReadersWithCard())
//      {
//        System.out.println(terminal.getName());
//        SmartCard card = new SmartCard(terminal);
//        IdentityPojo id = BeIDFileFactory.getIdentity(card);
//        System.out.println(id.toString());
//        AddressPojo address = BeIDFileFactory.getAddress(card);
//        System.out.println(address);
//        PhotoPojo photo = BeIDFileFactory.getPhoto(card);
//        FileOutputStream fos = new FileOutputStream(PHOTO);
//        fos.write(photo.getPhoto());
//        fos.flush();
//        fos.close();
//      }
    PadesSignatureEngine.PdfSignatureAppearanceInfo info = new PadesSignatureEngine.PdfSignatureAppearanceInfo();
    info.location = "Luogo della firma.";
    info.reason = "Motivo della firma.";
    info.position = new Rectangle(36, 748, 144, 780);
    info.page = 1;
    engine.setAppearanceInfo(info);

//      TSAClient tsa = engine.getTSAfromSmartcard();
    // Usa Digistamp per ottenere un account di test per il rilascio di timestamp
    TSAClient tsa = new TSAClientBouncyCastle("http://tsatest1.digistamp.com/tsa", "12345678", "12345678");
    engine.setTsaClient(tsa);

    engine.setUseInternetCrl(true);
    engine.signDocument(input, output);
  }
View Full Code Here


    File input = new File("/Users/nicola/Documents/rad-image/argo-installation-report.pdf");
    File output1 = new File("/tmp/firmato1.pdf");
    File output2 = new File("/tmp/firmato2.pdf");

    File libSmartcard = new File("/opt/smartcard-aruba/libbit4xpki.dylib");
    PadesSignatureEngine engine = new PadesSignatureEngine(libSmartcard);

    // inserisci QUI il PIN della smartcard
    engine.prepareSmartCardAndData("07751650".toCharArray());

    // applica la prima firma
    PadesSignatureEngine.PdfSignatureAppearanceInfo info1 = new PadesSignatureEngine.PdfSignatureAppearanceInfo();
//    info1.infoName = "Firma 1";
//    info1.location = "Luogo della prima firma.";
//    info1.reason = "Motivo della prima firma.";
//    info1.position = new Rectangle(300, 750, 400, 780);
//    info1.page = 1;
//    engine.setAppearanceInfo(info1);
    engine.signDocument(input, output1);

    // applica la seconda firma
    PadesSignatureEngine.PdfSignatureAppearanceInfo info2 = new PadesSignatureEngine.PdfSignatureAppearanceInfo();
//    info2.infoName = "Firma 2";
//    info2.location = "Luogo della seconda firma.";
//    info2.reason = "Motivo della seconda firma.";
//    info2.position = new Rectangle(400, 750, 500, 780);
//    info2.page = 1;
//    engine.setAppearanceInfo(info2);
    engine.signDocument(output1, output2);
  }
View Full Code Here

TOP

Related Classes of org.commonlib.crypto.PadesSignatureEngine$PdfSignatureAppearanceInfo

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.