-
-
Notifications
You must be signed in to change notification settings - Fork 198
Open
Description
When I run pdfsig <document_path> I get the following error:
Syntax Error (0): Illegal values in ByteRange array
- Signer Certificate Common Name: (null)
- Signer full Distinguished Name: (null)
- Signing Time: Apr 21 2024 19:09:32
- Signing Hash Algorithm: unknown
- Signature Type: adbe.pkcs7.detached
- Signed Ranges: [0 - 25497], [41883 - 43123]
- Not total document signed
- Signature Validation: Signature has not yet been verified.
My code looks like this:
export async function POST(request: Request) {
try {
const { pdfBase64 } = await request.json();
const pdfBuffer = Buffer.from(pdfBase64, "base64");
// certificate.p12 is the certificate that is going to be used to sign
const certificatePath = join(process.cwd(), "/public/client-identity.p12");
const certificateBuffer = fs.readFileSync(certificatePath);
const signer = new P12Signer(certificateBuffer);
const pdfWithPlaceholder = plainAddPlaceholder({
pdfBuffer,
reason: "The user is decalaring consent.",
contactInfo: "[email protected]",
name: "John Doe",
location: "Free Text Str., Free World",
});
// pdfWithPlaceholder is now a modified buffer that is ready to be signed.
const signedPdf = await signpdf.sign(pdfWithPlaceholder, signer);
const signedPdfBase64 = signedPdf.toString('base64');
console.log(signedPdf);
return NextResponse.json({ signedPdfBase64 }, { status: 200 });
} catch (error) {
console.error(error);
return NextResponse.json(error, { status: 500 });
}
}Metadata
Metadata
Assignees
Labels
No labels