asp.net - Digitally sign a PDF on the server -
i have project generate pdfs on server using asp.net (c #). need customer able digitally sign these pdf. saw, documents must signed @ client side, using applet, in server have no access private key of certificate, said above, pdfs generated on server , keep them there.
so, need digitally sign pdfs on server, taking client's certificate.
thanks
since not possible or anyway safe extract , send client's private key, sign pdfs on server need establish "session" client , let them calculate signature.
the steps should like:
1- client sends public certificate embedded in signed pdf
2- server generates pdf, embeds certificate , calculates hash (eg: sha1)
3- server sends hash client applet
4- applet calculates digital signature private key
5- applet sends signature server
6- server embeds digital signature , closes pdf.
to itext have use preclose method after ambedding certificate, able alculate sha1 hash on final document. after pre-closing pdf have calculate hash of pdf , send client. careful: while preclosed have keep document in memory, example in server session.
to generate pdf, embed certificates , prepaare document can use itextsharp, c# port of itext library. calculate hash , create pkcs7 envelopes can use .net crypto api.
hope helps.
Comments
Post a Comment