title: Signing a PDF using a X.509 SmartCard certificate with iText in Java
body: <p>I have a SmartCard (governement eID) from which I can extract a signature (Non-repudiation) certificate after inserting a pin, using the SmartCard specific API and drivers, which can return a byte[] for each certificate that the card holds. After researching I've found that this is a X.509 certificate and in Java you can get an object out of it using the following code:</p>
  
  <pre><code>InputStream in = new ByteArrayInputStream(certByteArray);
  CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
  X509Certificate cert = (X509Certificate)certFactory.generateCertificate(in);
  </code></pre>
  
  <p>My questions:</p>
  
  <ul>
  <li>Is it possible to sign a document using a X.509 certificate? I've read and experimented a lot about this subject (I have a program that manipulates and sign's a PDF with iText, using a PKCS#12 ) but the only references I see regarding X.509 are about encryption, even in <a href="http://itextpdf.com/book/digitalsignatures20130304.pdf" rel="nofollow">Bruno Lowagie's white paper</a>.</li>
  <li>If so, how can it be done using the BouncyCastle crypto provider?</li>
  </ul>