3
$\begingroup$

I'm trying to digitally sign a document which is uploaded by a user. I want the user to sign that document using his digital signing certificate (DSC).

Should I:

  • transfer the file to the user, and have them sign it on their own system, or
  • transfer the user's private key to the server, and sign the file there?

Which way is better, or are there any other, better ways to do this?

$\endgroup$
  • $\begingroup$ What exactly does "DSC" mean in this context? $\endgroup$ – Henrick Hellström Dec 29 '14 at 12:39
  • $\begingroup$ DSC => Digital Signature Certificate (I suppose) $\endgroup$ – hunter Dec 29 '14 at 14:49
  • $\begingroup$ Hi, rtan, and welcome to Crypto Stack Exchange. I tried to edit your question to make it a bit clearer, but I'm not 100% sure I interpreted all of it correctly. Could you please check that I didn't introduce any mistakes, and if you find some, edit the question to fix them? Thanks! $\endgroup$ – Ilmari Karonen Dec 29 '14 at 20:35
  • 1
    $\begingroup$ Also, one specific issue that puzzled me: if the user uploads the document to your server, is there some reason why they can't simply sign it before they upload it? Your server could then verify that the document has been properly signed, using the user's public key. $\endgroup$ – Ilmari Karonen Dec 29 '14 at 20:37
  • $\begingroup$ The document being uploaded is plain text converted to pdf, which is then signed by user. $\endgroup$ – rtan Dec 30 '14 at 11:00
5
$\begingroup$

It is logically impossible to transfer a private key. The key will continue to be a signature key, but it will cease to be "private" the minute it is transferred. A signature key that isn't private isn't a private key. If you want the document to be signed by the user (in any semantically coherent sense), this operation has to take place on a device exclusively controlled by the user.

This doesn't mean that it is logically impossible to delegate digital signing to a third party, it just means it has to be done slightly differently. If (in real life) you appoint someone to act as your proxy, you don't authorize that person to sign documents using your signature. Instead, you sign a letter of appointment that authorizes your proxy to sign documents on your behalf. The proxy will then use its own signature.

$\endgroup$
  • $\begingroup$ I have used Java XMLSignatureFactory to sign XML files using applet where file and signature both are with user. I need the pdf file to be signed by user, but file is at server. $\endgroup$ – rtan Dec 30 '14 at 11:47
  • $\begingroup$ Transfer the preliminary pdf to the client, let the client sign it and upload it back to the server. Alternatively, let the server sign it with a key corresponding to a certificate that belongs to the service rather than the user. $\endgroup$ – Henrick Hellström Dec 30 '14 at 14:57
3
$\begingroup$

A digital signature requires the person/entity doing the signing to be the ONLY one with access to the private key. So by transferring the document AND the key to your server it basically invalidates the whole process as you can now forge the signature of the user.

The process works as follows: The private key transforms the original in a unique way. The public key can undo this transformation. So when I sign something with my private key and send it out, the public key can only undo what my private key does and not what your private key does, and that verifies that it was indeed me that signed it and sent it out and not someone else pretending to be me. Now of course, if my private key becomes compromised (say I get a virus, or some such that steals this information), then it is no longer guaranteeing that I am the one sending these documents.

On to your particular question:

If the user alone is to sign the document and they are the only one who is trustworthy to do so, then you have to send them the file and have them sign it and send it back. However, if the server in your system is going to be a trustworthy authority for the rest of the system, and you are trying to simply show that a document came from the user account it says it did, then you can generate a private key on the server for each user, and then sign each document with it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.