Search in sources :

Example 6 with TimeStampReq

use of com.github.zhenwei.pkix.util.asn1.tsp.TimeStampReq in project gdmatrix by gdmatrix.

the class CMSUtils method createTimeStamp.

public static ContentInfo createTimeStamp(String serviceURI, byte[] message) throws Exception {
    String nonce = String.valueOf((int) (Math.random() * 1000000));
    // es crea la peticio a la TSA
    TimeStampReq timeStampRequest = createTimeStampRequest(// message
    message, // nonce
    nonce, // requireCert
    true, // extensions
    null, // digestAlgorithm identifier
    "1.3.14.3.2.26", // timestampPolicy
    "0.4.0.2023.1.1");
    // s'envia la peticio creada
    TimeStampResp timeStampResponse = sendTimestampRequest(timeStampRequest, serviceURI);
    ContentInfo contentInfo = timeStampResponse.getTimeStampToken();
    return contentInfo;
}
Also used : TimeStampReq(org.bouncycastle.asn1.tsp.TimeStampReq) ContentInfo(org.bouncycastle.asn1.cms.ContentInfo) ASN1OctetString(org.bouncycastle.asn1.ASN1OctetString) DEROctetString(org.bouncycastle.asn1.DEROctetString) TimeStampResp(org.bouncycastle.asn1.tsp.TimeStampResp)

Aggregations

TimeStampReq (org.bouncycastle.asn1.tsp.TimeStampReq)4 ASN1Integer (com.github.zhenwei.core.asn1.ASN1Integer)2 Extensions (com.github.zhenwei.core.asn1.x509.Extensions)2 MessageImprint (com.github.zhenwei.pkix.util.asn1.tsp.MessageImprint)2 TimeStampReq (com.github.zhenwei.pkix.util.asn1.tsp.TimeStampReq)2 MessageDigest (java.security.MessageDigest)2 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)2 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)2 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)2 DEROctetString (org.bouncycastle.asn1.DEROctetString)2 ContentInfo (org.bouncycastle.asn1.cms.ContentInfo)2 TimeStampResp (org.bouncycastle.asn1.tsp.TimeStampResp)2 AlgorithmIdentifier (org.bouncycastle.asn1.x509.AlgorithmIdentifier)2 ASN1ObjectIdentifier (com.github.zhenwei.core.asn1.ASN1ObjectIdentifier)1 AlgorithmIdentifier (com.github.zhenwei.core.asn1.x509.AlgorithmIdentifier)1