/** * Checks if the timestamp refers to this document. * @throws java.security.NoSuchAlgorithmException on error * @return true if it checks false otherwise * @since 2.1.6 */ public boolean verifyTimestampImprint() throws NoSuchAlgorithmException { if (timeStampToken == null) return false; MessageImprint imprint = timeStampToken.getTimeStampInfo().toTSTInfo().getMessageImprint(); byte[] md = MessageDigest.getInstance("SHA-1").digest(digest); byte[] imphashed = imprint.getHashedMessage(); boolean res = Arrays.equals(md, imphashed); return res; }
/** * Checks if the timestamp refers to this document. * @throws java.security.NoSuchAlgorithmException on error * @return true if it checks false otherwise * @since 2.1.6 */ public boolean verifyTimestampImprint() throws NoSuchAlgorithmException { if (this.timeStampToken == null) { return false; } final MessageImprint imprint = this.timeStampToken.getTimeStampInfo().toTSTInfo().getMessageImprint(); final byte[] md = MessageDigest.getInstance("SHA-1").digest(this.digest); final byte[] imphashed = imprint.getHashedMessage(); final boolean res = Arrays.equals(md, imphashed); return res; }
/** * Checks if the timestamp refers to this document. * * @throws java.security.NoSuchAlgorithmException * on error * @return true if it checks false otherwise * @since 2.1.6 */ public boolean verifyTimestampImprint() throws NoSuchAlgorithmException { if (timeStampToken == null) return false; MessageImprint imprint = timeStampToken.getTimeStampInfo().toTSTInfo() .getMessageImprint(); byte[] md = MessageDigest.getInstance("SHA-1").digest(digest); byte[] imphashed = imprint.getHashedMessage(); boolean res = Arrays.equals(md, imphashed); return res; }