readium / readium-sdk

A C++ ePub renderer SDK
BSD 3-Clause "New" or "Revised" License
385 stars 164 forks source link

Content Module fallback (EPUB encrypted with unknown DRM scheme) #275

Open danielweck opened 7 years ago

danielweck commented 7 years ago

See: https://github.com/readium/readium-sdk/issues/274#issuecomment-276353073

The current fallback is to attempt to load the EPUB without Content Module, but this will probably lead to fatal crashes because of libxml trying to load scrambled XML data. So, in order to degrade gracefully, one option is to check that META-INF/encryption.xml does not contain any encrypted resources (other than obfuscated fonts).

rkwright commented 7 years ago

The most likely case where this might occur is if a user attempts to open an encrypted book they got from the iBooks store. Here is an example of an encryption element from a Disney book obtained from the iBooks store.

<e:EncryptedData>
    <e:EncryptionMethod Algorithm="http://itunes.apple.com/dataenc"/>
    <d:KeyInfo>
      <d:KeyName>1</d:KeyName>
    </d:KeyInfo>
    <e:CipherData>
        <e:CipherReference URI="OEBPS/toc.xhtml"/>
    </e:CipherData>
</e:EncryptedData>