Code Monkey home page Code Monkey logo

pdfsign.js's Introduction

PDFSign.js

PDFSign.js is a JavaScript library that signs a PDF in the browser. No private keys or passwords are ever sent over the network. The signing takes place in the browser only. The API is very simple:

signed-pdf = PDFSIGN.signpdf(pdf, p12-cert, p12-cert-password);

An example site is located in src/html. In this example, one can set the certificate (e.g., support/mycert-1-alt.p12), set the password "1234", and add a PDF file. The PDF will be signed with the certificate and the Adobe Reader will show that the PDF is signed but not trusted (its a self signed certificate). The button 'Create a PDF and output base64' takes a base64 encode file and outputs a base64 document in the browser, which immediately displays the PDF.

PDFSign uses two external libraries: forge and PDF.js.

Forge

The signing part is done with forge. This library had to be adapted as a PDF requires a detached pkcs7 signature as described here. Forge can handle pkcs7, however, always adds the content as well. The patch adds the feature to sign detached, similar as done here.

PDF.js

The PDF parsing is done with PDF.js. This library had also to be adapted as for writing PDF, offsets needed to be stored as well. This library was also stripped down to the parsing part, as the displaying part is not needed. Unfortunately, this was not only done on a file basis, but inside some files, displaying and parsing was mixed and had to be removed.

License

This software is released under the MIT license.

pdfsign.js's People

Contributors

tbocek avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.