List of usage examples for org.bouncycastle.asn1.tsp MessageImprint MessageImprint
public MessageImprint(AlgorithmIdentifier hashAlgorithm, byte[] hashedMessage)
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.//from w w w . j av a 2s .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); }