vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
688 stars 175 forks source link

PAdES compliant signatures #149

Closed Maxteke closed 2 years ago

Maxteke commented 2 years ago

Hello,

I'm trying to make a pades signature with your library.

function sign(pdfName, p12Name, passphrase)
{
    let pdfBuffer = fs.readFileSync(__dirname + "/../ressources/" + pdfName);
    const p12Buffer = fs.readFileSync(__dirname + "/../ressources/" + p12Name);

    pdfBuffer = plainAddPlaceholder({
                pdfBuffer,
                signatureLength: p12Buffer.length,
                subFilter: SUBFILTER_ETSI_CADES_DETACHED,
            });

    try {
        const signedPdf = signer.sign(pdfBuffer, p12Buffer, {passphrase: passphrase});
        fs.writeFileSync(__dirname + "/../ressources/Signed_" + pdfName, signedPdf);
    } catch (e) {
        console.log(e.message);
    }
}

from this code the signature is invalid on dss platform: Capture

I tried to put the subFilter option on plainAddPlaceholder but the sub filter stay adbe.pkcs7.detached https://github.com/vbuch/node-signpdf#pades-compliant-signatures

vbuch commented 2 years ago

Ah. I never got that released. In the repo you are looking at the docs of develop. Npm has what's in master. So... either wait for me to get a release out or use the develop code.

vbuch commented 2 years ago

This is out with 1.4.1 https://github.com/vbuch/node-signpdf/releases/tag/v1.4.0 Closing here.

Maxteke commented 1 year ago

Hi,

I retry with the latest version of your library.

The result change a little bit but stay invalid. image Thanks in advance for the help!