title: Adding a Digital signature to a PDF with iTextSharp
body: <p><strong>Background</strong></p>
  
  <p>I have been using iTextSharp for a short while now. I have created a pdf document with two signable PdfFormFields. If I open the pdf document I can manually sign each field manually. I want this to be done through iTextSharp.</p>
  
  <p>I am currently retrieving the certificate from the X509Store. Up until this point, I could figure out.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Can someone please show me how I can use this X509Certificate2
   to sign an already existing signature AcroField.</p>
  
  <p><a href="https://i.stack.imgur.com/HVJlM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HVJlM.png" alt="enter image description here"></a></p>
  
  <p><strong>References</strong></p>
  
  <p>The following references were visited and I couldn't find the answer I was looking for.
  <a href="https://stackoverflow.com/questions/21474649/signing-a-pdf-document/21475723#21475723">Signing a pdf document</a></p>
  
  <p>This link got me the closest I believe, but several of the lines used were invalid and I do not know if I can fix it by including some other libraries.
  <a href="https://www.dotnetportal.cz/blogy/15/Null-Reference-Exception/5250/Digitalni-podepisovani-PDF-souboru-v-C-cast-2" rel="noreferrer">https://www.dotnetportal.cz/blogy/15/Null-Reference-Exception/5250/Digitalni-podepisovani-PDF-souboru-v-C-cast-2</a></p>