Hello,

Look at line 2188 please:

if (sub.equals(PdfName.ADBE_X509_RSA_SHA1)) {
               PdfString cert = v.getAsString(PdfName.CERT);
               pk = new PdfPKCS7(contents.getOriginalBytes(),
cert.getBytes(), provider);
           }

In real life there is no self-signed certificate and PdfString cert
will be NULL.
To fix that bug, you may use code like that:

if (sub.equals(PdfName.ADBE_X509_RSA_SHA1)) {
               PdfString cert = v.getAsString(PdfName.CERT);
               if (cert==null) {
                              PdfArray pda = v.getAsArray(PdfName.CERT);
                              for (int i=0; i<pda.size(); i++){
                                             cert = pda.getAsString(i);
                                             //TODO: PdfPKCS7 on each
                              }
               }
               pk = new PdfPKCS7(contents.getOriginalBytes(),
cert.getBytes(), provider);
           }

--
Best regards!
Vladimir Vorontsov

------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to