readium / SDKLauncher-iOS

A small iOS application to serve as a launcher/testbed for the Readium SDK.
BSD 3-Clause "New" or "Revised" License
71 stars 47 forks source link

Where does Readium read roc.xhtml or nav.xhtml file? #13

Closed lehoang15 closed 9 years ago

lehoang15 commented 10 years ago

Hi, I'm practicing with Readium SDK, and during my researching, here's something bother me. Where will Readium read navigation item?

For example, I want to protect my ePub, I encrypt all xhtml files and before Readium load those files, I decrypt it before it loaded. I could decrypt those xhtml files when I need to load some page from spine items of table of content.

The problem is when Readium need to load the epub file, it seems like it need to load the toc.xhtml first, but I don't know where it load the file so I can't decrypt it and I always get the error: "xhtml/toc.xhtml:1: parser error : Start tag expected, '<' not found" and this one: "libc++abi.dylib: terminating with uncaught exception of type ePub3::epub_spec_error: Publications MUST contain exactly one navigation document."

I know that those errors above is because the toc.xhtml is encrypt, so that's why I need to know where Readium load or point to toc.xhtml. Please help.

danielweck commented 9 years ago

I would suggest to take a look at the "content filter chain" mechanism which is used to implement decryption of individual files in the EPUB archive, including for the purpose of font de-obfuscation (not just DRM / LCP).

https://github.com/readium/readium-sdk/tree/develop/ePub3/ePub

Note that there are upcoming changes in the underlying API, to support streaming of encrypted video/audio media by byte-range blocks, rather than as whole file resources. Watch this space.