Search in sources :

Example 6 with TimeStampResp

use of com.github.zhenwei.pkix.util.asn1.tsp.TimeStampResp 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

TimeStampResp (org.bouncycastle.asn1.tsp.TimeStampResp)5 ContentInfo (org.bouncycastle.asn1.cms.ContentInfo)4 ASN1InputStream (org.bouncycastle.asn1.ASN1InputStream)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 URL (java.net.URL)2 URLConnection (java.net.URLConnection)2 Enumeration (java.util.Enumeration)2 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)2 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)2 DEROctetString (org.bouncycastle.asn1.DEROctetString)2 PKIStatusInfo (org.bouncycastle.asn1.cmp.PKIStatusInfo)2 TimeStampReq (org.bouncycastle.asn1.tsp.TimeStampReq)2 ASN1EncodableVector (com.github.zhenwei.core.asn1.ASN1EncodableVector)1 PKIStatusInfo (com.github.zhenwei.pkix.util.asn1.cmp.PKIStatusInfo)1 TimeStampResp (com.github.zhenwei.pkix.util.asn1.tsp.TimeStampResp)1 IOException (java.io.IOException)1