I don't see anything wrong with you code or with iTexts code. Can I have a look 
at the PDF?

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Robert Esterer
> Sent: Thursday, April 26, 2007 4:11 PM
> To: 'Post all your questions about iText here'
> Subject: Re: [iText-questions] Including the CRL in the signature
> 
> The rest is just the usual signing code:
> 
>         md = MessageDigest.getInstance("SHA1");
>         byte[] buf = new byte[8192];
> 
>         inp = sap.getRangeStream();
>         int n = 0;
>         while ((n = inp.read(buf)) > 0)
>         {
>             md.update(buf, 0, n);
>         }
>         inp.close();
>         hash = md.digest();
> 
>         signature = s.sign(hash);
>         pkcs = sap.getSigStandard();
>         slit = (PdfLiteral) pkcs.get(PdfName.CONTENTS);
>         buf = new byte[(slit.getPosLength() - 2) / 2];
>         p7Sig = pkcs.getSigner();
>         p7Sig.setExternalDigest(signature, hash, "RSA");
>         dic = new PdfDictionary();
>         byte[] p7Bytes = p7Sig.getEncodedPKCS7();
>         System.arraycopy(p7Bytes, 0, buf, 0, p7Bytes.length);
>         dic.put(PdfName.CONTENTS, new 
> PdfString(buf).setHexWriting(true));
>         sap.close(dic); 
> 
> I use iText 2.0.2 btw.
> 
> -Robert
> 
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Im 
> Auftrag von Paulo
> Soares
> Gesendet: Donnerstag, 26. April 2007 15:44
> An: Post all your questions about iText here
> Betreff: Re: [iText-questions] Including the CRL in the signature
> 
> Works for me, although I'm not an heavy user of CRLs. Can you 
> post the rest
> of the code until the final close and a link for the resulting PDF?
> 
> Paulo 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of 
> > Robert Esterer
> > Sent: Thursday, April 26, 2007 1:55 PM
> > To: 'Post all your questions about iText here'
> > Subject: [iText-questions] Including the CRL in the signature
> > 
> > Hello,
> > 
> > Im currenty trying to include the CRLs for the certificate chain in 
> > the signature.
> > The signature creation itself works perfectly fine, only problem is 
> > that the CRLs seem to be missing. At least the Acrobat tells me so.
> > 
> > My Code looks like this:
> > 
> > sap.setCrypto(null, s.getCertificateChain(), s.getCRLs(),
> >               PdfSignatureAppearance.WINCER_SIGNED);
> > sap.setExternalDigest(new byte[s.sigLength], new 
> byte[s.hashLength], 
> > "RSA");
> > sap.preClose();      
> > System.out.println(sap.getCrlList().length);
> > System.out.println(((java.security.cert.X509CRL)sap.getCrlList
> > ()[0]).getNext
> > Update().toString());
> > 
> > The last two lines are just output for me to make sure that the 
> > SignatureAppearance object does have the CRLs.
> > The array returned by "getCrlList()" does indeed contain 
> the correct 
> > CRLs, but the final PDF does not seem to contain them.
> > 
> > Am I missing some flag or is this a bug?
> > 
> > Regards,
> > -Robert
> > 


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to