Can't Encrypt PDFs in Lucee 5.1.0.34

Hello,

I upgraded an application from Lucee 4.5 to Lucee 5.1.0.34 yesterday and
now:

pdf action=“protect” […]

fails with the following error:

java.lang.ClassNotFoundException:
lucee.runtime.exp.NativeException: org.bouncycastle.asn1.DEREncodable not
found by bcprov [92]
at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1558)
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1998)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at
org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1399)
at
org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1579)
at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1509)
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1998)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.lowagie.text.pdf.PdfEncryption.(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.setEncryption(Unknown Source)
at org.lucee.extension.pdf.util.PDFUtil.encrypt(PDFUtil.java:264)
at org.lucee.extension.pdf.tag.PDF.doActionProtect(PDF.java:1085)
at org.lucee.extension.pdf.tag.PDF.doEndTag(PDF.java:583)

As far as I can tell, the issue is that the iText PDF extension requires
Bouncycastle v1.49 or greater (http://itextpdf.com/tags/bouncycastle).

This has previously been reported here:
https://luceeserver.atlassian.net/browse/LDEV-1038 and the workaround on
that issue (uninstalling the S3 extension) was not a good idea (or workable
in our case).

I figure I could try solving this myself by rebuilding the extension. Is
there a good step-by-step guide out there which would facilitate this?

Thanks,

Juan

OK. I see my thinking about this was backwards. The changes in Bouncycastle
that break the version of iText which ships with the PDF Extension occur in
v1.47 and later (
http://www.bouncycastle.org/wiki/display/JA1/Porting+from+earlier+BC+releases+to+1.47+and+later
).

The PDF Extension uses BC v1.38 but the S3 extension uses BC v1.52 and 1.52
overrides 1.38. Uninstalling the S3 extension is not an option so I tried
rebuilding the S3 extension using BC v1.38 but something keeps deploying
bcprov-1-52-0.jar to /opt/railo/tomcat/lucee-server/bundles/. No clue why
that’s happening but it’s probably deep within Lucee.

So, as of now you cannot use pdf action=“protect” in Lucee 5.1 (and
probably 5.0) and I can see why it’s been backlogged. Because fixing it
would require rebuilding the PDF Extension with a newer version of iText
which is probably a lot of work (and I don’t know if it presents licensing
issues).

Back to 4.5 for me, then, which is too bad because I really wanted to
upgrade to 5.1. Unless I workaround the need to use pdf action=“protect”.

Resolving version conflicts like this are exactly the reason that Lucee
5 was refactored to use OSGi.

Please file a ticket in the JIRA for this:
https://luceeserver.atlassian.net/

Thank you,

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/On 11/22/2016 1:52 PM, Juan Aguilar wrote:

OK. I see my thinking about this was backwards. The changes in
Bouncycastle that break the version of iText which ships with the PDF
Extension occur in v1.47 and later
(http://www.bouncycastle.org/wiki/display/JA1/Porting+from+earlier+BC+releases+to+1.47+and+later).

The PDF Extension uses BC v1.38 but the S3 extension uses BC v1.52 and
1.52 overrides 1.38. Uninstalling the S3 extension is not an option so
I tried rebuilding the S3 extension using BC v1.38 but something keeps
deploying bcprov-1-52-0.jar to
/opt/railo/tomcat/lucee-server/bundles/. No clue why that’s happening
but it’s probably deep within Lucee.

So, as of now you cannot use pdf action=“protect” in Lucee 5.1 (and
probably 5.0) and I can see why it’s been backlogged. Because fixing
it would require rebuilding the PDF Extension with a newer version of
iText which is probably a lot of work (and I don’t know if it presents
licensing issues).

Back to 4.5 for me, then, which is too bad because I really wanted to
upgrade to 5.1. Unless I workaround the need to use pdf action=“protect”.

Get 10% off of the regular price for this years CFCamp in Munich,
Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp.
189€ instead of 210€. Visit
https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp

You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/c240e8d9-4989-4aca-84bf-504761526a0d%40googlegroups.com
https://groups.google.com/d/msgid/lucee/c240e8d9-4989-4aca-84bf-504761526a0d%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.

Thanks, Igal.

A bug report was filed
at https://luceeserver.atlassian.net/browse/LDEV-1038.

JuanOn Tuesday, November 22, 2016 at 5:00:55 PM UTC-5, Igal wrote:

Resolving version conflicts like this are exactly the reason that Lucee 5
was refactored to use OSGi.

Please file a ticket in the JIRA for this:
https://luceeserver.atlassian.net/

Thank you,

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/