/** * *********************************************************************** * * * SignServer: The OpenSource Automated Signing Server * * This software is free * software; you can redistribute it and/or * modify it under the terms of the * GNU Lesser General Public * License as published by the Free Software * Foundation; either * version 2.1 of the License, or any later version. * * * See terms of license at gnu.org. * * ************************************************************************ */ package org.signserver.module.tsa; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.math.BigInteger; import java.security.*; import java.security.cert.*; import java.security.cert.Certificate; import java.text.SimpleDateFormat; import java.util.*; import javax.persistence.EntityManager; import org.apache.log4j.Logger; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.cmp.PKIStatus; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.GeneralName; import org.bouncycastle.asn1.x509.KeyPurposeId; import org.bouncycastle.cert.X509CertificateHolder; import org.bouncycastle.cert.jcajce.JcaCertStore; import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder; import org.bouncycastle.cms.SignerInfoGenerator; import org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder; import org.bouncycastle.operator.ContentSigner; import org.bouncycastle.operator.DigestCalculator; import org.bouncycastle.operator.DigestCalculatorProvider; import org.bouncycastle.operator.OperatorCreationException; import org.bouncycastle.operator.bc.BcDigestCalculatorProvider; import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; import org.signserver.module.tsa.TimeStampResponseGenerator; import org.bouncycastle.tsp.TSPAlgorithms; import org.bouncycastle.tsp.TSPException; import org.bouncycastle.tsp.TimeStampRequest; import org.bouncycastle.tsp.TimeStampResponse; import org.bouncycastle.tsp.TimeStampToken; import org.bouncycastle.tsp.TimeStampTokenGenerator; import org.bouncycastle.util.Selector; import org.bouncycastle.util.Store; import org.ejbca.util.Base64; import org.signserver.common.*; import org.signserver.common.util.*; import org.signserver.server.ITimeSource; import org.signserver.server.WorkerContext; import org.signserver.server.archive.Archivable; import org.signserver.server.archive.DefaultArchivable; import org.signserver.server.cryptotokens.ICryptoToken; import org.signserver.server.log.IWorkerLogger; import org.signserver.server.log.LogMap; import org.signserver.server.signers.BaseSigner; /** * A Signer signing Time-stamp request according to RFC 3161 using the * BouncyCastle TimeStamp API. * * Implements a ISigner and have the following properties: * *
TIMESOURCE | property containing the * classpath to the ITimeSource implementation that should be used. (default * LocalComputerTimeSource) |
ACCEPTEDALGORITHMS | A * ';' separated string containing accepted algorithms, can be null if it * shouldn't be used. (OPTIONAL) |
ACCEPTEDPOLICIES | * A ';' separated string containing accepted policies, can be null if it * shouldn't be used. (OPTIONAL) |
ACCEPTEDEXTENSIONS | *A ';' separated string containing accepted extensions, can be null if it * shouldn't be used. (OPTIONAL) |
DIGESTOID | The * Digenst OID to be used in the timestamp |
DEFAULTTSAPOLICYOID | The default policy ID of the time stamp * authority |
ACCURACYMICROS | Accuraty in micro * seconds, Only decimal number format, only one of the accuracy properties * should be set (OPTIONAL) |
ACCURACYMILLIS | * Accuraty in milli seconds, Only decimal number format, only one of the * accuracy properties should be set (OPTIONAL) |
ACCURACYSECONDS | Accuraty in seconds. Only decimal number * format, only one of the accuracy properties should be set (OPTIONAL) | *
ORDERING | The ordering (OPTIONAL), default false. * |
TSA | General name of the Time Stamp Authority. * |
REQUIREVALIDCHAIN | Set to true to perform an * extra check that the SIGNERCERTCHAIN only contains certificates in the chain * of the signer certificate. (OPTIONAL), default false. |