Class PKCS7ExternalSignatureContainer

    • Field Detail

      • chain

        private final java.security.cert.Certificate[] chain
      • privateKey

        private final java.security.PrivateKey privateKey
      • hashAlgorithm

        private final java.lang.String hashAlgorithm
    • Constructor Detail

      • PKCS7ExternalSignatureContainer

        public PKCS7ExternalSignatureContainer​(java.security.PrivateKey privateKey,
                                               java.security.cert.Certificate[] chain,
                                               java.lang.String hashAlgorithm)
        Creates an instance of PKCS7ExternalSignatureContainer
        Parameters:
        privateKey - The private key to sign with
        chain - The certificate chain
        hashAlgorithm - The hash algorithm to use
    • Method Detail

      • sign

        public byte[] sign​(java.io.InputStream data)
                    throws java.security.GeneralSecurityException
        Produces the container with the signature.
        Specified by:
        sign in interface IExternalSignatureContainer
        Parameters:
        data - the data to sign
        Returns:
        a container with the signature and other objects, like CRL and OCSP. The container will generally be a PKCS7 one.
        Throws:
        java.security.GeneralSecurityException - the general security exception
      • setOcspClient

        public void setOcspClient​(IOcspClient ocspClient)
        Set the OcspClient if you want revocation data collected trough Ocsp to be added to the signature
        Parameters:
        ocspClient - the client to be used
      • setCrlClient

        public void setCrlClient​(ICrlClient crlClient)
        Set the CrlClient if you want revocation data collected trough Crl to be added to the signature
        Parameters:
        crlClient - the client to be used
      • setTsaClient

        public void setTsaClient​(ITSAClient tsaClient)
        Set the TsaClient if you want a TSA timestamp added to the signature
        Parameters:
        tsaClient - the client to use
      • setSignaturePolicy

        public void setSignaturePolicy​(SignaturePolicyInfo signaturePolicy)
        Set the signature policy if you want it to be added to the signature
        Parameters:
        signaturePolicy - the signature to be set.