List of usage examples for org.bouncycastle.asn1.tsp TimeStampReq TimeStampReq
public TimeStampReq(MessageImprint messageImprint, ASN1ObjectIdentifier tsaPolicy, ASN1Integer nonce,
ASN1Boolean certReq, Extensions extensions)
From source file:com.guardtime.asn1.TimestampRequest.java
License:Apache License
/** * Composes a new {@code TimeStampReq} structure containing the given * hash value and no optional fields.// w ww . j a v a2s. c o m * * @param algOid * identifier of the hash algorithm that was used to hash the * data. * @param hashedMessage * hash value of the data to be timestamped. * @return a new timestamp request. */ public static TimestampRequest compose(String algOid, byte[] hashedMessage) { if (algOid == null) { throw new IllegalArgumentException("invalid hash algorithm: null"); } else if (hashedMessage == null) { throw new IllegalArgumentException("invalid hashed message: null"); } AlgorithmIdentifier algId = new AlgorithmIdentifier(new ASN1ObjectIdentifier(algOid)); MessageImprint mi = new MessageImprint(algId, hashedMessage); TimeStampReq req = new TimeStampReq(mi, null, null, null, null); return new TimestampRequest(req); }