Which must differ ("S1", "S2") or be null but it makes no difference. I lived in hope, that the solution lies in the last parameter of setVisibleSignature Sap.setVisibleSignature(new Rectangle(x, y, x+s, y - s), 1, "S2") īut the resulting PDF after the second signing has its first sign always invalid. Sap.setVisibleSignature(new Rectangle(x, y, x+s, y - s), 1, "S1") Sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED) Sap.setLayer2Font(new Font(BaseFont.createFont(BaseFont.TIMES_ROMAN, "Cp1250", true))) PdfSignatureAppearance sap = stp.getSignatureAppearance() PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0') PrivateKey key = (PrivateKey)ks.getKey(alias, certPass.toCharArray()) Ĭertificate chain = ks.getCertificateChain(alias) įileOutputStream fout = new FileOutputStream(pathDst) String alias = (String)ks.aliases().nextElement() Ks.load(new FileInputStream(path), certPass.toCharArray()) KeyStore ks = KeyStore.getInstance("pkcs12") InputStream is = new FileInputStream(pathSrc) Hello, I need to sign PDF twice (for the testing purpose with the same certificate, I hope it does't matter).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |