Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCM #21

Merged
merged 22 commits into from
Jan 4, 2017
Merged

GCM #21

merged 22 commits into from
Jan 4, 2017

Conversation

danielweck
Copy link
Member

compiling implementation of AES GCM (needs testing) as alternative to CBC, for publication resources, and content-key (this last one is arguably not necessary, but the config option is available in the LCP server)

CBC, for publication resources, and content-key (this last one is arguably
not necessary, but the config option is available in the LCP server)
@danielweck
Copy link
Member Author

danielweck commented Dec 13, 2016

Cross posting from the Go server PR:
readium/readium-lcp-server#101 (comment)

There are several AES-256 encryptors (I documented this in the README):

  1. publication resources (EPUB content) => all ebook entries use the same algorithm (either GCM or the default CBC, based on the YAML config of the Go server), and the algorithm URI is discoverable in encryption.xml.
  2. the content key in the LCP license JSON file => the algorithm URI is discoverable (so client processors / decryptors can switch depending on GCM vs. CBC), however the Go server always uses CBC.
  3. the user key "check" in the LCP license JSON file => the algorithm URI is the same as for content key.
  4. the data fields in the LCP license JSON file => the algorithm URI is the same as for content key.

danielweck and others added 19 commits December 20, 2016 09:31
…of 12 bytes,

tag overhead of 16 bytes, and authenticated encryption verification (GHASH
HMAC) without additional data. PROBLEM: not sure how to seek for
audio/video streaming (partial HTTP byte range request). Need to test, but
pretty sure the current block-align algorithm fails, and even if succeeds,
auth verif will fail because MAC_AT_END)
network timeout results in authorized license reading, whereas user
cancellation abandons the attempt to read the encrypted EPUB
utility function (plus, I disabled code that isn't used, using the
existing USE_NET_PROVIDER preprocessor directive)
video/audio streaming, and added key building based on start of data
stream, followed by block-level decryption (not working, I get a 4-byte
overflow which is exactly CryptoPP::AES::BLOCKSIZE / authentication tag
(16 bytes) minus the initialization vector (12 bytes)...not sure why yet.
12-bytes initialization vector). Videos now play the first milliseconds,
but decrypted cypher stream is subsequently totally scrambled.
basic CBC-like initialization vector / key setup (fails)
@danielweck
Copy link
Member Author

Merging now with non-working AES-256-GCM decryption of partial buffers (HTTP byte range requests). CryptoPP does not seem to implement "seeking" in the pipelining API (pump() etc.) which would make it easy to synchronize the IV / key in order to decode blocks of data at random access locations in the cypher text. TODO (will post a separate issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant