private COSObject decryptCOSString(COSObject string) { StandardSecurityHandler ssh = this.document.getStandardSecurityHandler(); try { ssh.decryptString((COSString) string.getDirectBase(), this.keyOfCurrentObject); return string; } catch (IOException | GeneralSecurityException e) { LOGGER.log(Level.WARNING, "Can't decrypt string in object " + this.keyOfCurrentObject); return string; } } }
private COSObject decryptCOSString(COSObject string) { StandardSecurityHandler ssh = this.document.getStandardSecurityHandler(); try { ssh.decryptString((COSString) string.getDirectBase(), this.keyOfCurrentObject); return string; } catch (IOException | GeneralSecurityException e) { LOGGER.log(Level.WARNING, "Can't decrypt string in object " + this.keyOfCurrentObject); return string; } } }
private void parseDocumentFeatures(PDDocument document) { COSDocument cosDocument = document.getDocument(); COSTrailer trailer = cosDocument.getTrailer(); if (trailer != null) { reporter.report(GFFeaturesObjectCreator.createInfoDictFeaturesObject(trailer.getInfo())); } StandardSecurityHandler standardSecurityHandler = cosDocument.getStandardSecurityHandler(); if (standardSecurityHandler != null) { reporter.report(GFFeaturesObjectCreator.createDocSecurityFeaturesObject(standardSecurityHandler.getPdEncryption())); } try { PDCatalog catalog = document.getCatalog(); if (catalog != null) { getCatalogFeatures(catalog); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Problem in parsing document catalog", e); } reporter.report(GFFeaturesObjectCreator.createLowLvlInfoFeaturesObject(cosDocument)); }
try { if (this.document.isEncrypted()) { this.document.getStandardSecurityHandler().decryptStream( (COSStream) obj.getDirectBase(), new COSKey((int) number, (int) generation));