Does Qoppa’s PDF API support signing using “Advanced Electronic Signatures (AdES)”, as recognized by eIDAS regulation? Qoppa’s PDF library and components currently support the following digital signature types: • PKCS7 Signatures • B-B PAdES signatures • B-T PAdES signatures Qoppa’s PDF library and components currently do not support the following types of signatures (which are […]
Category: jPDFSecure: Secure / Sign PDFs
Developer library to secure PDF documents with passwords and permissions as well as digitally sign PDF documents in Java.
Merging signed PDFs with Java PDF SDK jPDFProcess
Q: When merging signed PDFs or assembling pages from signed PDFs, jPDFProcess is throwing permission exceptions. How can I get around this? A: We try to prevent operations on signed PDFs that would invalidate digital signatures in PDF documents. This is so that customers do not invalidate signatures by accident. If you do not mind […]
Add Document TimeStamp (DTS) to a PDF document with Java
Using Qoppa’s PDF library products, jPDProcess and jPDFSecure, it is possible to add a Document Time Stamp (DTS added in PDF 2.0) to a PDF document. Here is a sample java program that does so. PDFDocument doc = new PDFDocument(in, null); // Invisible signature field SignatureField field = doc.getPage(0).addSignatureField("Signature1", new Rectangle2D.Double(0, 0, 0, 0)); […]
Can a digital signature in a PDF document have multiple linked widgets?
Q: We know that standard interactive form fields can have multiple widgets associated with them. In this case, all “linked” widgets in the document will contain the same form field data & have the same appearance stream. But how about digital signature fields? Do they allow multiple widgets to be associated with them? Answer: The […]
How to lock a PDF document when applying a digital signature in Java
Below is sample Java code showing how to lock a PDF document when applying a digital signature to it using jPDFSecure, Qoppa’s Java PDF Security SDK. // load PDF document into jPDFSecure PDFSecure pdf = new PDFSecure("c:/test/test01.pdf", null); // add a signature field SignatureField signField = pdf.addSignatureField(0, "sign here", new Rectangle(72, 72, 144, […]
Sign a PDF document with Java & Azure
Qoppa has 2 Java libraries that can apply signatures to a PDF document: jPDFSecure and jPDFProcess. To allow signature calculation with external signature appliances such as hardware security modules (HSM), we’ve defined a ContentSigner interface in our API, which allows our libraries to send the PDF content data to be signed externally and then receive […]
Sign a PDF document with 2 digital signatures
Here is some sample code showing how to use Qoppa’s Java PDF library jPDFSecure to apply 2 digital signatures to the same document or in other words, to sign a PDF document twice. This code can be very simply adpated to use our other library jPDFProcess and a PDFDocument object instead of a PDFSecure object. […]
Which hash algorithm is used when applying digital signatures
Qoppa’s PDF libraries components (v2020 and up) and Android PDF toolkit (v6.8 and up) use the safest hash algorithm available and supported by the PDF file version when applying digital signatures. This is priority order in which we look for hash algorithms based on the document version: PDF File Version 1.7 & up: “SHA512”, “SHA384”, […]
Resolve Error “JCE Provider does not support SHA hash algorithm”
Q: I am building a web application to sign a PDF document with a given .pfx key store. I am running Spring Boot and using Qoppa’s PDF library jPDFSecure. I am getting an exception which states “JCE Provider does not support SHA hash algorithm”. How can I resolve this error? com.qoppa.pdf.PDFException: JCE Provider does not […]
Signature hash will not fit in allotted space
When signing using PKCS7 or PAdes with a timestamp server, you might receive the following exception: com.qoppa.pdf.PDFException: Signature hash (7895 bytes) will not fit in allotted space (7500 bytes).Increase timestamp server length estimate. To resolve this issue, you can increase the length estimate when defining the timestampserver parameters (the default length is originally set to […]
Difference between PKCS11 and PKCS12
Though the names are very similar, PCKS11 and PKCS12 are actually defining 2 very different things and this can create some confusion. PKCS11 is a protocol used to access hardware encryption devices such as USB tokens, smart card or vaults (such as Azure Vault). Keystore API in Java allows to abstract access to the PKCS11 […]
Retrieving signature information from a signed PDF
This java sample program shows how to open a signed PDF and retrieve signature information from it such as signer’s name, sign reason, location, date, etc…. This sample uses Qoppa’s Java PDF Library jPDFSecure but can be easily changed to use jPDFProcess. // Load the signed document PDFSecure pdfDoc = new PDFSecure ("C:\\test\\output.pdf", null); if(pdfDoc.getSignatureFields() […]
Signing a PDF with a p12 file in Java
This is a sample java program showing how to sign a PDF document using a certificate loaded from a p12 file. The signature appearance is customized with an image, signer’s name and date. A signature field is added to the PDF document and then signed. This code uses jPDFSecure library but could very easily be adapted […]
Digital signatures and PDF/A compliance
Converting to PDF/A an existing Signed Document It is not possible to convert an existing PDF document that is already signed to PDF/A. This is because any changes that you make to a PDF even if it’s only adding PDF/A tags information in the metadata would invalidate the signature. If your PDF is already signed, […]
Add a PAdES signature to a PDF document using Java library jPDFSecure, jPDFProcess
PDF 2.0 defines a new filter (Adobe.PPKLite) and sub-filter (ETSI.CAdES.detached) for PAdES signatures, which are compliant with the European eIDAS regulation. Support for PAdES was added in v2017R1 of Qoppa’s Java PDF libraries. This sample shows how to add a PAdES signature to a PDF document using Qoppa’s Java PDF library jPDFSecure. It is easy […]
Clear Password and Permissions in a PDF document
It is possible to clear permissions and passwords in a PDF document using several of Qoppa’s Java PDF libraries and components. With jPDFSecure, use PDFSecure.clearPasswordPermissions() With jPDFProcess, use PDFDocument.clearPasswordPermissions() With jPDFEditor, use PDFEditorBean.getDocument().clearPasswordPermissions() Calling PDFSecure.clearPasswordPermissions will clear all password permissions for this document: it will reset all password permissions to true. it will clear open/user […]
Changing PDF Document Permissions and Passwords
It is possible to set / update permissions and passwords in a PDF document using several of Qoppa’s Java PDF libraries and components. Call to change document permissions and passwords depending on which Qoppa library you use: // with jPDFSecure PDFSecure.setPasswordPermissions(newPermPwd, newOpenPwd, permissions, currentPermPwd, encryptType); // with jPDFProcess PDFDocument.setPasswordPermissions(newPermPwd, newOpenPwd, permissions, currentPermPwd, encryptType); […]
Create your own pfx pkcs12 certificate to test jPDFSecure and digitally sign PDF
Here is the command line to create a pfx file with the Java keytool. This assumes that you have jdk 1.7.0_79 installed under your C:\Program Files folder. “C:\Program Files\Java\jdk1.7.0_79\bin\keytool” -genkeypair -keystore signature.pfx -storepass mypassword -storetype pkcs12 -alias myalias -dname “cn=John Smith, ou=Google, o=Google, c=US” Using the signature.pfx file generated above, you can add a digital […]
Apply a digital signature to a PDF using a custom image appearance
This Java sample code applies a digital signature to a document with a custom appearance. The appearance of signatures can be modified in jPDFSecure to include an image, choose the fields that show or custom text. /** * Qoppa Software – Sample Source Code */ package jPDFSecureSamples; import java.awt.geom.Rectangle2D; import java.io.FileInputStream; import java.security.KeyStore; […]
Sample Signed PDF with Digital Signature from a Java Recognized Certificate Authority
Here is a sample PDF signed with a digital ID issued by GlobalSign, a certificate authority recognized by Java. blank_signed.pdf This is a blank PDF page that only contains a signed signature field. This sample PDF can be used to test digital signature validation in Java 1.7 and Java 1.8. The digital signature in this […]
Adding custom properties to PDF digital signatures
Q: Is it possible to set custom properties to digital signatures using Qoppa’s PDF SDK? A: Yes, it is possible to do so using jPDFSecure, jPDFProcess or qPDF Toolkit. Adding custom property to the signature dictionary This method can be used to add additional custom properties to the signature dictionary. SigningInformation.setCustomProperty(key, value);SigningInformation.setCustomProperty(key, value); You can […]
jPDFSecure v2015R2 Build Notes
v2015R2.01 – March 28 2016 JPDF-733 – Sample application used a non-public class PDFEncryption.is256(): Exception occurred during event dispatching: java.lang.NoClassDefFoundError: com/qoppa/pdf/security/PDFEncryption
Exception reading certificates from Windows store with specific versions of Java 1.6 64bit
There is an issue with reading from the Windows certificate store with Java version 1.6.0_37, 64-bit. This is the error log: java.security.KeyStoreException: Windows-MY not found It is fixed in Java 64-bit version 1.6.0_45 but unfortunately Update 45 has introduced other issues. It is also fixed in latest 64-bit versions of Java 1.7 (1.7.0_76 for instance).
Trust Windows Store Certificates
Q: Can I read from the Windows Certificate store to get digital IDs to use as trusted Certificate Authorities (CAs)? A: By default, our libraries jPDFSecure and jPDFProcess and components jPDFNotes and jPDFEditor use the Java trusted Certificate Authorities when verifying digital signatures in PDF documents. It is possible to customize the trusted authorities through the SignatureSettings static methods. To add the Windows trusted CAs, […]
Multiple digital signatures on a PDF document
Q: I am using your Java library jPDFSecure to add 2 digital signatures to a PDF document (sign, save, sign again and save) but only the last signature shows as valid, the first signature is showing as invalid. Am I doing anything wrong? This KB entry applies to the following Java libraries and components: jPDFProcess, […]
jPDFSecure Java API
Q: Where can I find jPDFSecure javadoc API? A: You can find the API specification for the latest version of our library jPDFSecure on our website at this link. jPDFSecure is a java library to set permissions and passwords, encrypt and digitally sign PDF documents.
Code Sample: Sign PDF Using Windows IDs
Windows maintains a certificate and digital ID store. Digital IDs in the store can come from certificate authorities, or can come from USB hardware tokens. Our Java libraries jPDFSecure, jPDFProcess and visual components jPDFNotes or jPDFEditor can apply a digital signature to a PDF document using a digital ID from the Windows certificate store. Here is sample java code showing how to retrieve […]
Code Sample: Set permissions on a PDF document in Java
This Java program encrypts a document and restricts permissions to only allow printing using Qoppa’s library jPDFSecure.
Code Sample: Get encryption and permission settings of a PDF file in Java
This Java program lists the encryption and permissions settings of a PDF document using Qoppa’s library jPDFSecure.
Code Sample: Clear Security and reset permissions in Java
This Java program clears the encryption and allows all permissions in a PDF document using Qoppa’s library jPDFSecure.