// Check if the last signature is a timestamp.
String lastSignature = signatures.get(signatures.size() - 1);
PdfPKCS7 pkcs7 = fields.verifySignature(lastSignature);
if (!pkcs7.isTsp()) {
throw new NoTimestampException(messages.getString(
"Document_has_no_document_level_timestamp."));
}
// Get the expiration date of the last timestamp.
Calendar expiration = Calendar.getInstance();