swift-toolkit
swift-toolkit copied to clipboard
Decryption of license user data (email, name) with user key (not content key)
The current LCP lib API (findValidPassphrase(), createContext(), decrypt()) is very minimal, and as far as I know does not support decrypting buffers that are encrypted with the user key (only those encrypted with the content key). In this Swift implementation, is there support for encrypted user email / name license fields?
Related issue: https://github.com/readium/kotlin-toolkit/issues/205
It's not supported, the User object only mirrors the JSON schema with the list of encrypted fields: https://github.com/readium/r2-lcp-swift/blob/d69f7bd315d40ea29c5f75d80adbc6a0578d1c7e/readium-lcp-swift/License/Model/Components/LCP/User.swift#L24
Good to know.
This is not implemented in r2-lcp-js either, as it is currently technically impossible (this would require C++ code modifications / additions in the public API of the LCP native lib)
This is now available in the C++ LCP lib and its accompanying platform-specific wrappers (iOS/Swift/ObjectiveC and Android/Kotlin/JNI and Electron/NodeJS) as a new API function aptly-named getSupportedLCPProfileURIs that returns a vector/array/list of strings (i.e. LCP profile URIs).
The new LCP lib with its increase API surface area hasn't started shipping yet, but integrators will be in the loop. In fact there will also be a new decryptField function very similar to decrypt but for LCP license email/name/etc. fields which are encrypted with the user key, unlike resources (e.g. HTML/CSS/image files) which are encrypted with the content key.
Thanks for the heads-up Daniel, I'm reopening to track the Integration in the toolkit.