class TimeStampSignatureWithKeystore implements TimeStampSignature {

    @Override
    public TimeStampResponse sign(TimeStampRequest request)
        throws OperatorCreationException, TSPException, CertificateEncodingException {
        final DigestCalculator digestCalculator =
            digestCalculatorProvider.get(new AlgorithmIdentifier(request.getMessageImprintAlgOID()));
        final String tspAlgorithm = computeTspAlgorithm(key, VitamConfiguration.getDefaultTimestampDigestType());

        final SignerInfoGenerator signerInfoGen =
            new JcaSimpleSignerInfoGeneratorBuilder().build(tspAlgorithm, key, (X509Certificate) certificateChain[0]);

        final ASN1ObjectIdentifier tsaPolicy = new ASN1ObjectIdentifier(tspPolicy);

        final TimeStampTokenGenerator tokenGen =
            new TimeStampTokenGenerator(signerInfoGen, digestCalculator, tsaPolicy);

        tokenGen.addCertificates(new JcaCertStore(Arrays.asList(certificateChain)));

        final TimeStampResponseGenerator timeStampResponseGenerator =
            new TimeStampResponseGenerator(tokenGen, TSPAlgorithms.ALLOWED);

        final Date currentDate = LocalDateUtil.getDate(LocalDateUtil.now());

        return timeStampResponseGenerator.generate(request, BigInteger.ONE, currentDate);
    }

    public  TimeStampSignatureWithKeystore(File pkcs12Path, char[] keystorePassword);

}