I try to sign an encrypted PDF document for which the signature is allowed.
This document : Encrypted PDF document
With the PDFBox 2.0.0 sample code : CreateSignature.java
But I got this exception :
Exception in thread "main" java.lang.NullPointerException
at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRevisionNumber(StandardSecurityHandler.java:131)
at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareDocumentForEncryption(StandardSecurityHandler.java:335)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1254)
at org.apache.pdfbox.pdmodel.PDDocument.saveIncremental(PDDocument.java:966)
at principal.CreateSignature.signDetached(CreateSignature.java:179)
at principal.CreateSignature.signDetached(CreateSignature.java:154)
at principal.CreateSignature.main(CreateSignature.java:334)
I don't know the pass of the document but signing is allowed :
What should I do for sign this document?