1
$\begingroup$

I'm writing a program to sign files using X.509 certificates and .NET framework classes. My users can sign the same file more than once without any problem (like a revision process). So, a file may contain one or more signatures.

I'm using the CMSSigner class and I don't encrypt the file. I just sign it.

But now a user asked me the following: "By mistake I signed a file and I would like to take off my signature from that file. Can I do this?"

I see no problem when the file has only that one user's signature (only one X509 certificate within). But I'm not sure if I can unsign the file if it has many signatures there. The routine that I use to strip a signature from a file picks the original data and, in that case, I lose all of its signatures.

So, using .NET classes (X509Certificate2), can I just delete the user's signature from that file, without loss the other certificates there?

Thanks for any help.

$\endgroup$
  • $\begingroup$ Off topic, but: Have you considered using regular source code version control (e.g. Git) alongside your custom signing process? $\endgroup$ – StackzOfZtuff Jul 19 '16 at 6:31
  • $\begingroup$ @StackzOfZtuff, my code is the recommended code by Microsoft and is functioning perfectly. And I need to keep the default-signature layout (PKCS#7) in these files once they need be validated in other softwares. $\endgroup$ – David BS Jul 19 '16 at 14:03
  • $\begingroup$ Have you tried? As long as you keep to the given CMS structure and don't wrap one CMS structure within the other you should be able to removed SignedInfo structures. $\endgroup$ – Maarten Bodewes Jul 19 '16 at 16:25
  • $\begingroup$ This is more an implementation question for StackOverflow I guess. That you can remove signatures from CMS seems clear from the standard. $\endgroup$ – Maarten Bodewes Jul 19 '16 at 17:41
  • 1
    $\begingroup$ Does a signature also cover other people's signatures (if they have signed before you)? $\endgroup$ – SEJPM Jul 20 '16 at 11:32
0
$\begingroup$

Cryptographically speaking, a digital signature provides the property of non-repudiation -- the signer cannot deny signing once signed. So, you either have to keep the unsigned version if you can't strip the signature from the document, or sign another document invalidating the previous signature if the previous document has been released.

$\endgroup$
  • $\begingroup$ That being said, digital signatures are permanent. $\endgroup$ – DannyNiu Jul 20 '16 at 8:14
  • $\begingroup$ the process is done this way: 1) Alice signs the file. 2) Bob can revise the "opened version" of that file but cannot change a letter there. Once he decides to sign/agree with its contents, it signs the "closed/signed version" and his signature is appended to the file. I understood your point-of-view but, technically, can I remove a CMS/Signer-Class signature from a file without broke it? $\endgroup$ – David BS Jul 20 '16 at 23:35
  • $\begingroup$ To be honest, I've never used that CMS/Signer-Class you mentioned, and may be you can provide me with a link to the API and I can have a look at. $\endgroup$ – DannyNiu Jul 21 '16 at 5:08
  • $\begingroup$ But, if the signature is appended, then it can be removed LIFO (last-in-first-out). What you'll need to know, is the format and structure of the signature. $\endgroup$ – DannyNiu Jul 21 '16 at 5:08
  • $\begingroup$ The link is above - in question - and you're right: I can't remove older or aleatoric signatures in file without broke it. Only the last one can be removed and my software must ensure that the deletion is performed only by the signature owner. Thank you! $\endgroup$ – David BS Jul 21 '16 at 13:47

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.