Search code examples
itextdigital-signaturepades

Add signature pades-epes signature-policy-identifier attribute with iTextsharp (5.5.8)


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.


Solution

  • 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.