My first goal is modify an existent pdf into another in wich every page is the same as the original scaled by 90% in height and a box in the remaining 10% (on the bottom of the page).
In that box I'm going to write signing information.
Finally, I want to digitally sign the resultant file, with CADES if possible.

I'm new to itextsharp. So, I bought the Itext in action second edition book. Besides I googled the Internet for examples.

Starting with former itext versions code examples and a lot of trying, I had achieved the thing, but in an old fashioned and old signing mode and with no CADES option. Besides there are a bit of pasted code that I hardly can understand what makes me uncomfortable.

Googling a bit more, I came to the great 'Digital Signatures for PDF documents' by Bruno Lowagie, and I found there's a complete new way to do signing from version 5.3.5

the simplest example in that paper is:

public void sign(String src, String dest,
Certificate[] chain, PrivateKey pk, String digestAlgorithm, String provider,
CryptoStandard subfilter, String reason, String location)
throws GeneralSecurityException, IOException, DocumentException {
// Creating the reader and the stamper
PdfReader reader = new PdfReader(src);
FileOutputStream os = new FileOutputStream(dest);
PdfStamper stamper = PdfStamper.createSignature(reader, os, '\0');
// Creating the appearance
PdfSignatureAppearance appearance = stamper.getSignatureAppearance();
appearance.setReason(reason);
appearance.setLocation(location);
appearance.setVisibleSignature(new Rectangle(36, 748, 144, 780), 1, "sig");
// Creating the signature
ExternalDigest digest = new BouncyCastleDigest();
ExternalSignature signature =
new PrivateKeySignature(pk, digestAlgorithm, provider);
MakeSignature.signDetached(appearance, digest, signature, chain,
null, null, null, 0, subfilter);
}

I can't find the following elements:

class ExternalDigest : I even iterated through Org.BouncyCastle without success
class BouncyCastleDigest    :      """""
class ExternalSignature : I find the interface iExternalSignature but nothing more class PrivateKeySignature : I find the class but its constructor takes two parameters not three

I solved before some similar troubles by translating sintax from java to c#, but these elements are beyond that.

Is there any additional documentation for these new features of version 5.3.5 ?
Have you got any further code to fullfill the lack ?

My applogies for the long explanation and a lot of thanks in advance.



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


   Javier Cobo

Dept. Informática
DPGR CFV JA
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
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

Reply via email to