In Method: | outputDss(PdfDictionary, PdfDictionary, PdfArray, PdfArray, PdfArray) |
Code with Finding: |
class LtvVerification {
private void outputDss(PdfDictionary dss, PdfDictionary vrim, PdfArray ocsps, PdfArray crls, PdfArray certs) throws IOException {
PdfDictionary catalog = reader.getCatalog();
writer.markUsed(catalog);
for (PdfName vkey : validated.keySet()) {
PdfArray ocsp = new PdfArray();
PdfArray crl = new PdfArray();
PdfArray cert = new PdfArray();
PdfDictionary vri = new PdfDictionary();
for (byte[] b : validated.get(vkey).crls) {
PdfStream ps = new PdfStream(b);
ps.flateCompress();
PdfIndirectReference iref = writer.addToBody(ps, false).getIndirectReference();
crl.add(iref);
crls.add(iref);
}
for (byte[] b : validated.get(vkey).ocsps) {
PdfStream ps = new PdfStream(b);
ps.flateCompress();
PdfIndirectReference iref = writer.addToBody(ps, false).getIndirectReference();
ocsp.add(iref);
ocsps.add(iref);
}
for (byte[] b : validated.get(vkey).certs) {
PdfStream ps = new PdfStream(b);
ps.flateCompress();
PdfIndirectReference iref = writer.addToBody(ps, false).getIndirectReference();
cert.add(iref);
certs.add(iref);
}
if (ocsp.size() > 0)
vri.put(PdfName.OCSP, writer.addToBody(ocsp, false).getIndirectReference());
if (crl.size() > 0)
vri.put(PdfName.CRL, writer.addToBody(crl, false).getIndirectReference());
if (cert.size() > 0)
vri.put(PdfName.CERT, writer.addToBody(cert, false).getIndirectReference());
vrim.put(vkey, writer.addToBody(vri, false).getIndirectReference());
}
dss.put(PdfName.VRI, writer.addToBody(vrim, false).getIndirectReference());
if (ocsps.size() > 0)
dss.put(PdfName.OCSPS, writer.addToBody(ocsps, false).getIndirectReference());
if (crls.size() > 0)
dss.put(PdfName.CRLS, writer.addToBody(crls, false).getIndirectReference());
if (certs.size() > 0)
dss.put(PdfName.CERTS, writer.addToBody(certs, false).getIndirectReference());
catalog.put(PdfName.DSS, writer.addToBody(dss, false).getIndirectReference());
}
}
|