npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pdfsig

v1.2.15

Published

Valida la firma digital de un pdf

Downloads

79

Readme

pdfsig

Esta librería se creó con el propósito de firmar documentos pdf y validar firmas digitales en documentos PDF en base a las librerías de podofo para la manipulación del pdf, node-forge para la manipulación de los certificados y ocsp para validar la revocación del certificado.

Prerequisitos

Se debe tener instalado y configurado para el usuario actual la herramienta sudo. Así mismo la librería fue probada en Debian 9.

Instalación

$ npm install pdfsig

Ejemplo

Mostrar el número de firmas en el documento

const pdfsig = require('pdfsig');

const firmas = new pdfsig('prueba.pdf');
const nroFirmas = firmas.size();
console.log(nroFirmas);

Verificar que el documentos no haya sido modificado después de la firma

const pdfsig = require('pdfsig');

const firmas = new pdfsig('prueba.pdf');
if (firmas.estado(0)) {
  console.log('Firma válida, el documento no ha sido modificado.');
} else {
  console.log('El documento ha sido modificado, la firma ya no es válida.');
}

Mostrar el nombre del signatario

const pdfsig = require('pdfsig');

const firmas = new pdfsig('prueba.pdf');
const cn = firmas.atributo(0, 'CN');
console.log(cn);

Mostrar el periodo de validez del certificado

const pdfsig = require('pdfsig');

const firmas = new pdfsig('prueba.pdf');
const validez = firmas.validez(0);
console.log(validez);

Validar si el certificado corresponde a la infraestructura de clave pública del Estado Plurinacional de Bolivia

const pdfsig = require('pdfsig');

const firmas = new pdfsig('prueba.pdf');
const pki = firmas.pki(0);
if (pki === true) {
  console.log('El certificado corresponde a la infraestructura de clave pública del Estado Plurinacional de Bolivia.');
} else {
  console.log(pki);
}

Validar si el certificado ha sido revocado

const pdfsig = require('pdfsig');

const firmas = new pdfsig('prueba.pdf');
const ocsp = firmas.ocsp(0);
console.log(ocsp);

Firmar pdf con PKCS12

const pdfsig = require('pdfsig');

const firmas = new pdfsig('prueba.pdf');
console.log(firmas.firmar('prueba.p12', 'I234s678'));

Firmar pdf con PKCS11

const pdfsig = require('pdfsig');

const firmas = new pdfsig('prueba.pdf');
const certs = firmas.certToken('/usr/lib/ePass2003_adsib/redist/libcastle.so.1.0.0');
console.log(firmas.firmarToken('/usr/lib/ePass2003_adsib/redist/libcastle.so.1.0.0', '12345678', certs[0].slot, certs[0].id, certs[0].cert));