3

I want to sign a PDF with a certificate in a certificate store.

I am using iTextSharp and iSafePDF for singing PDFs, it works OK when I sign using a certificate stored as .p12 file. But I don't know how to use the library for signing with certificates obtained from a certificate store. I have an instance of System.Security.Cryptography.X509Certificate2, but the library uses a different object representation and I was not able to make it work. Can someone help?

j_maly
  • 1,091
  • 1
  • 13
  • 27
  • For signing you always need a private key - not a certificate. The certificate is the public part which - if you could use it for signing then everybody would be able to to so. – Robert Sep 08 '11 at 14:54
  • 2
    I know, I have access to the private key of the certificate as well. I just need to know, how to use iSavePDF (or iTextSharp or any other .NET open source library) to sing the PDF using a certificate obtained from the certification store. – j_maly Sep 12 '11 at 15:39

1 Answers1

5

OK, here is exactly what I was trying to find, the accompanying text is in Czech, but there is not much of it and the code that works is what matters.

Signing PDF using a certificate in the certification store

j_maly
  • 1,091
  • 1
  • 13
  • 27
  • +1 Took me a while to find what I was looking for in that link I ended up using this: http://blog.imp.cz/post/2011/05/30/Digitalni-podepisovani-PDF-souboru-v-C – gen Dec 21 '11 at 14:44
  • I am glad that my article and code served its purpose. The link is OK. I write about PDF signing in two parts, the first part using certificate from pfx file, the second using certificate from user certificate store. – HolaJan Dec 25 '11 at 21:04