Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sign a PDF in Android

I have to implement in an Android application a function that allow me to sign a PDF, when i say "sign" I mean the digital signature (First and second name) affixed to the end of the document from the user.

I have access to a Samsung Note 4 (with stylus) then it would not be a problem, "write" on the display.

The question is: there is the possibility to sign a document using some library like itext or I must write a custom function ?

like image 642
Mattia Avatar asked Nov 07 '16 09:11

Mattia


1 Answers

I guess you want to apply an electronic signature on a document using a user's handwriting with a pen. As has said @mkl, 'digital signature' concept is usually applied when using digital certificates and cryptography.

Handwritten electronic signature requirements

People tend to think that the handwritten signature consists of embedding an image, but so that your system has a minimum legal value in case of litigation you will need:

  • R1 - ensure the identity of the signer

  • R2 - Uniquely attach signature and document

  • R3 - protect integrity of document and signature

More or less these are the characteristics of digital signatures.

Handwritten signature on Android

The process on android should be like this:

  • R2) capture the user graph including biometrics(x,y,time,pressure) using a Canvas. Embed image and biometrics data into document using PDFBox or itext (client or server side)

  • R1) included biometric data in previous step allows a potential analysis of signature by an expert

  • R3) I suggest to apply a timestamp over document and signature evidences to protect the integrity and ensure the time of signature. Both itext and PDFBox support it

If you do not need legal value, then apply only the drawing part. The quality of your signature will be determined by the devices characteristics. For example a specific signature tablet can provide also the orientation of the pen

Android links

  • Drawing on Canvas and save image (see example, you can get pressure and time from event)

  • PDFBox, inserting image in pdf

  • PDFBox attach files to pdf

  • PDFBox digital-signature example with timestamp

You will find similar links for itext. Select the most suitable for your use case and whether you want to execute on Android or in the server side

like image 97
pedrofb Avatar answered Sep 19 '22 14:09

pedrofb