pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Villalobos <jeremyvillalo...@gmail.com>
Subject Encrypt Pdf using a X.509 certificate
Date Sun, 07 Jul 2013 02:13:42 GMT
I googled for a tutorial on using a x.509 certificate to encrypt a pdf. But
I did not find any good source.  What is the benefit of using an X.509
certificate version using owner/user passwords ?

I used a self-signed certificate created with openssl.  I got this error:

Encrypt failed with the following exception:
org.apache.pdfbox.exceptions.COSVisitorException: 1.2.840.113549.3.2
KeyGenerator not available
        at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1347)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1157)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1138)
        at org.apache.pdfbox.Encrypt.encrypt(Encrypt.java:189)
        at org.apache.pdfbox.Encrypt.main(Encrypt.java:53)
        at org.apache.pdfbox.PDFBox.main(PDFBox.java:40)
org.apache.pdfbox.exceptions.CryptographyException: 1.2.840.113549.3.2
KeyGenerator not available
        at
org.apache.pdfbox.pdmodel.encryption.PublicKeySecurityHandler.prepareDocumentForEncryption(PublicKeySecurityHandler.java:364)
        at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1338)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1157)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1138)
        at org.apache.pdfbox.Encrypt.encrypt(Encrypt.java:189)
        at org.apache.pdfbox.Encrypt.main(Encrypt.java:53)
        at org.apache.pdfbox.PDFBox.main(PDFBox.java:40)

Am I missing a dependency (bouncy castle perhaps ) or am I using the wrong
certificate ?

Thanks

-- 
Jeremy Villalobos
Practical Android Apps
http://www.practicalandroidapps.com/
<http://www.youtube.com/user/PdfToSpeech>
<https://plus.google.com/u/0/b/109848961267144267628/109848961267144267628/posts>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message