Class PDFSignature


  • public class PDFSignature
    extends java.lang.Object
    • Field Detail

      • TEMP_URI_GENERATOR

        private static final org.apache.xmlgraphics.io.TempResourceURIGenerator TEMP_URI_GENERATOR
      • privateKey

        private java.security.PrivateKey privateKey
      • startOfDocMDP

        private long startOfDocMDP
      • startOfContents

        private long startOfContents
      • tempURI

        private java.net.URI tempURI
    • Method Detail

      • add

        public void add​(PDFPage page)
      • signPDF

        public void signPDF​(java.net.URI uri,
                            java.io.OutputStream os)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getTempOS

        private java.io.OutputStream getTempOS()
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • getTempIS

        private java.io.InputStream getTempIS​(java.net.URI uri)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readPKCS

        private byte[] readPKCS​(java.io.InputStream pdf)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • readKeystore

        private java.security.cert.Certificate[] readKeystore​(java.security.KeyStore keystore,
                                                              char[] password)
                                                       throws java.security.GeneralSecurityException,
                                                              java.io.IOException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
      • sign

        private byte[] sign​(java.io.InputStream content,
                            java.security.cert.Certificate[] certChain)
                     throws java.security.GeneralSecurityException,
                            org.bouncycastle.operator.OperatorException,
                            org.bouncycastle.cms.CMSException,
                            java.io.IOException
        Throws:
        java.security.GeneralSecurityException
        org.bouncycastle.operator.OperatorException
        org.bouncycastle.cms.CMSException
        java.io.IOException