// Validate last timestamp on the current date.
SignatureValidator.validate(lastSignature, reader, rootCertificates);
// Get OCSP responses and CRLs from DSS to validate old signatures.
PdfDictionary dictionary = reader.getCatalog().getAsDict(PdfName.DSS);
if (dictionary == null) {
throw new NoDSSException(messages.getString(
"Document_has_no_DSS_(Document_Security_Store)."));
}
PdfArray ocspArray = dictionary.getAsArray(PdfName.OCSPS);
ArrayList<BasicOCSPResp> ocsps = new ArrayList<BasicOCSPResp>();
if (ocspArray != null) {
for (int i = 0; i < ocspArray.size(); i++) {
PRStream stream = (PRStream) ocspArray.getAsStream(i);
OCSPResp response = new OCSPResp(PdfReader.getStreamBytes(stream));
BasicOCSPResp basicResponse = (BasicOCSPResp) response.getResponseObject();
ocsps.add(basicResponse);
}
}
PdfArray crlArray = dictionary.getAsArray(PdfName.CRLS);
ArrayList<X509CRL> crls = new ArrayList<X509CRL>();
if (crlArray != null) {
for (int i = 0; i < crlArray.size(); i++) {
PRStream stream = (PRStream) crlArray.getAsStream(i);
X509CRL crl = (X509CRL) factory.generateCRL(new ByteArrayInputStream(PdfReader.getStreamBytes(stream)));