Hi,
decryption/encryption using BC 1.46 an iText 5.2.1 is working fine. Encryption
using BC 1.49 and iText 5.4.2 is working fine, but decrypting throws :
com.itextpdf.text.exceptions.InvalidPdfException: cannot create cipher: No such
algorithm: 1.2.840.113549.3.2
at com.itextpdf.text.pdf.PdfReader.readPdf(PdfReader.java:649)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:187)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:265)
at
org.btrust.pdfencryption.PDFEncryption.decrypt(PDFEncryption.java:90)
at
org.btrust.pdfencryption.DecryptPDFOnePanel.button4ActionPerformed(DecryptPDFOnePanel.java:415)
at
org.btrust.pdfencryption.DecryptPDFOnePanel.access$5(DecryptPDFOnePanel.java:324)
at
org.btrust.pdfencryption.DecryptPDFOnePanel$7.actionPerformed(DecryptPDFOnePanel.java:744)
at javax.swing.AbstractButton.fireActionPerformed(Unknown
Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown
Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown
Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown
Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I debugged it down to EnvelopedDataHelper.createCipher(ASN1ObjectIdentifier
algorithm); In my case the algorithm is 1.2.840.113549.3.2.
This value comes from the very beginning (I guess at the time of encryption),
from the encrypted document as "messageAlgorithm", as well as "keyEncAlg" which
in my case is 1.2.840.113549.1.1.1.
On line 179 it tries to find this algorithm from HashMap, but there is no such
algorithm. So it tries directly Cipher.getInstance("1.2.840.113549.3.2",
pkcs11prov); but it fails.
Yes, I know this is in BC code, but the algorithm strings come from iText code.
What should I do?
Best Regards, Valentin
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php