Hello, I have a problem with a PDFSignature with Itext and I hope you can help me. When I sign a document with another program, I have in the document a PdfDictionary of Type /Sig. When I sign the same document with my own program, I have the problem, that the Signature can't be verified from Adobe Reader and from my own program. I think, the problem is, that the PdfDictionary of Type /Sig is not on the signed Document.
Barbara Here is a Code Snippet of my program: vis_sign = stmp.SignatureAppearance; vis_sign.SetCrypto(null, certs, null, PdfSignatureAppearance.WINCER_SIGNED); vis_sign.Reason = "fact4web.com PDF Signatur"; vis_sign.Location = "Austria"; vis_sign.SignDate = DateTime.Now; vis_sign.SetExternalDigest(new byte[48], null, "RSA"); vis_sign.Render = PdfSignatureAppearance.SignatureRender.NameAndDescription; vis_sign.Acro6Layers = true; PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKMS, PdfName.ADBE_PKCS7_DETACHED); dic.Date = new PdfDate(vis_sign.SignDate); dic.Name = PdfPKCS7.GetSubjectFields(certs[0]).GetField("CN"); if (vis_sign.Reason != null) dic.Reason = vis_sign.Reason; if (vis_sign.Location != null) dic.Location = vis_sign.Location; dic.Put(PdfName.M, new PdfDate(cal)); vis_sign.CryptoDictionary = dic; int csize = 4000; Hashtable exc = new Hashtable(); exc[PdfName.CONTENTS] = csize * 2 + 2; vis_sign.PreClose(excl); content = streamToByteArray(vis_sign.RangeStream); hash = hashFunct.ComputeHash(content); byte[] sig = new byte[signature.Length-2]; for (int i = 0; i < hash.Length; i++) { Console.Write(hash[i].ToString("X2")); Console.Write(" "); } PdfDictionary dict = new PdfDictionary(); Array.Copy(signature, 0, sig, 0, signature.Length-2); dict.Put(PdfName.CONTENTS, new PdfString(sig).SetHexWriting(true)); vis_sign.Close(dict); ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar