0

I am currently evaluating iTextSharp (5.5.8) for a business case that includes pdf signing. The signature must include the pades-epes signature-policy-identifier attribute. I cannot find documentation and or samples to include this attribute. So the question I have is, is iTextSharp capable of providing this attribute and if so how can it be added.

usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305
Marc
  • 3
  • 2

2 Answers2

1

I hope won't be too late, but I added some changes to iTextSharp source code to support PAdES-EPES signatures. Here are an example of my code:

        SignaturePolicyInfo spi = new SignaturePolicyInfo();
        spi.PolicyIdentifier = "2.16.724.1.3.1.1.2.1.9";
        spi.PolicyHash = "G7roucf600+f03r/o0bAOQ6WAs0=";
        spi.PolicyDigestAlgorithm = "SHA-1";
        spi.PolicyUri = "https://sede.060.gob.es/politica_de_firma_anexo_1.pdf";

        MakeSignature.SignDetached(signatureAppearance, externalSignature, chain, null, null, null, 0, CryptoStandard.CADES, spi);

You can take a look at: https://github.com/zinkpad/itextsharp

I hope this help you.

J. Arturo
  • 26
  • 1
0

Unfortunately you did not show where in your code you got stuck.

If you are using MakeSignature.SignDetached, I'm afraid adding a policy identifier is not supported.

But you can always use MakeSignature.SignExternalContainer instead. This helper allows you to create the actual signature container to embed externally using e.g. BouncyCastle, so you can include any attribute you want while iText(Sharp) does all the rest.

mkl
  • 90,588
  • 15
  • 125
  • 265