/** * Returns the summary information metadata for the document. * * @return The Summary information for the document or null * if it could not be read for this document. */ public SummaryInformation getSummaryInformation() { return document.getSummaryInformation(); }
/** * Writes out the standard Document Information Properties (HPSF) * @param outFS the POIFSFileSystem to write the properties into * * @throws IOException if an error when writing to the * {@link POIFSFileSystem} occurs */ protected void writeProperties(POIFSFileSystem outFS) throws IOException { writeProperties(outFS, null); } /**
/** * Initializes a cipher object for a given block index for encryption * * @param cipher may be null, otherwise the given instance is reset to the new block index * @param block the block index, e.g. the persist/slide id (hslf) * @return a new cipher object, if cipher was null, otherwise the reinitialized cipher * @throws GeneralSecurityException if the cipher can't be initialized */ public Cipher initCipherForBlock(Cipher cipher, int block) throws GeneralSecurityException { throw new EncryptedDocumentException("this decryptor doesn't support initCipherForBlock"); }
/** * Writes out the updated standard Document Information Properties (HPSF) * into the currently open NPOIFSFileSystem * * @throws IOException if an error when writing to the open * {@link POIFSFileSystem} occurs */ protected void writeProperties() throws IOException { validateInPlaceWritePossible(); writeProperties(directory.getFileSystem(), null); }
public static Decryptor getInstance(EncryptionInfo info) { Decryptor d = info.getDecryptor(); if (d == null) { throw new EncryptedDocumentException("Unsupported version"); } return d; }
private FilePassRecord(FilePassRecord other) { encryptionType = other.encryptionType; try { encryptionInfo = other.encryptionInfo.clone(); } catch (CloneNotSupportedException e) { throw new EncryptedDocumentException(e); } }
public static CipherAlgorithm fromEcmaId(int ecmaId) { for (CipherAlgorithm ca : CipherAlgorithm.values()) { if (ca.ecmaId == ecmaId) return ca; } throw new EncryptedDocumentException("cipher algorithm " + ecmaId + " not found"); }
/** * For a given named property entry, either return it or null if * if it wasn't found * * @param setName The property to read * @return The value of the given property or null if it wasn't found. * * @throws IOException If retrieving properties fails */ @SuppressWarnings("WeakerAccess") protected PropertySet getPropertySet(String setName) throws IOException { return getPropertySet(setName, getEncryptionInfo()); }
/** * Fetch the Document Summary Information of the document * * @return The Document Summary Information or null * if it could not be read for this document. */ public DocumentSummaryInformation getDocumentSummaryInformation() { if(!initialized) { readProperties(); } return dsInf; }
/** * Returns the document information metadata for the document * * @return The Document Summary Information or null * if it could not be read for this document. */ public DocumentSummaryInformation getDocSummaryInformation() { return document.getDocumentSummaryInformation(); } /**
/** * Closes the underlying {@link POIFSFileSystem} from which * the Workbook was read, if any. * * <p>Once this has been called, no further * operations, updates or reads should be performed on the * Workbook. */ @Override public void close() throws IOException { super.close(); }
/** * Return the underlying DirectoryEntry of this document. * * @return the DirectoryEntry that is associated with the POIDocument of this extractor. */ public DirectoryEntry getRoot() { return document.getDirectory(); }
/** * Sets the chunk size of the data stream. * Needs to be set before the data stream is requested. * When not set, the implementation uses method specific default values * * @param chunkSize the chunk size, i.e. the block size with the same encryption key */ public void setChunkSize(int chunkSize) { throw new EncryptedDocumentException("this decryptor doesn't support changing the chunk size"); }
/** * Fetch the Summary Information of the document * * @return The Summary information for the document or null * if it could not be read for this document. */ public SummaryInformation getSummaryInformation() { if(!initialized) { readProperties(); } return sInf; }
/** * Sets the chunk size of the data stream. * Needs to be set before the data stream is requested. * When not set, the implementation uses method specific default values * * @param chunkSize the chunk size, i.e. the block size with the same encryption key */ public void setChunkSize(int chunkSize) { throw new EncryptedDocumentException("this decryptor doesn't support changing the chunk size"); }
public ChunkedCipherOutputStream getDataStream(OutputStream stream, int initialOffset) throws IOException, GeneralSecurityException { throw new EncryptedDocumentException("this decryptor doesn't support writing directly to a stream"); }
@Override protected void createEncryptionInfoEntry(DirectoryNode dir, File tmpFile) { throw new EncryptedDocumentException("createEncryptionInfoEntry not supported"); }
@Override public ChunkedCipherInputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException { throw new EncryptedDocumentException("not supported"); }
@Override protected void createEncryptionInfoEntry(DirectoryNode dir, File tmpFile) { throw new EncryptedDocumentException("createEncryptionInfoEntry not supported"); }
/** * Wraps a stream for decryption<p> * * As we are handling streams and don't know the total length beforehand, * it's the callers duty to care for the length of the entries. * * @param stream the stream to be wrapped * @param initialPos initial/current byte position within the stream * @return decrypted stream */ public InputStream getDataStream(InputStream stream, int size, int initialPos) throws IOException, GeneralSecurityException { throw new EncryptedDocumentException("this decryptor doesn't support reading from a stream"); }