...
In `DRM/DRM.swift` the new brand and scheme for Adobe DRM (added code is bold):
Code Block | ||
---|---|---|
| ||
public struct DRM { public let brand: Brand public let scheme: Scheme /// The license will be filled when passed back to the DRM module. public var license: DRMLicense? public enum Brand: String { case lcp case adobe } public enum Scheme: String { case lcp = "http://readium.org/2014/01/lcp" case adobe = "http://ns.adobe.com/adept" } public init(brand: Brand) { self.brand = brand switch brand { case .lcp: scheme = .lcp case .adobe: scheme = .adobe } } } |
...
In `Parser/EPUB/EPUBParser.swift` return Adobe DRM (added code is bold):
Code Block | ||
---|---|---|
| ||
private static func scanForDRM(in container: Container) -> DRM? { /// LCP. // Check if a LCP license file is present in the container. if ((try? container.data(relativePath: EPUBConstant.lcplFilePath)) != nil) { return DRM(brand: .lcp) } return DRM(brand: .adobe) // return nil } |
...
In `Parser/EPUB/EPUBEncryptionParser.swift` added Adobe encryption scheme (added code in bold):
Code Block | ||
---|---|---|
| ||
func parseEncryptions() -> [String: Encryption] { guard let document = document else { return [:] } var encryptions: [String: Encryption] = [:] // Loop through <EncryptedData> elements.. for encryptedDataElement in document.xpath("./enc:EncryptedData") { guard let algorithm = encryptedDataElement.firstChild(xpath: "enc:EncryptionMethod")?.attr("Algorithm var resourceURI = encryptedDataElement.firstChild(xpath:"enc:CipherData/enc:CipherReference")?.attr("URI")?.removingPercentEncoding else { continue } resourceURI = normalize(base: "/", href: resourceURI) var encryption = Encryption(algorithm: algorithm) // LCP. Tag LCP protected resources. let keyInfoURI = encryptedDataElement.firstChild(xpath: "ds:KeyInfo/ds:RetrievalMethod")?.attr("URI") if keyInfoURI == "license.lcpl#/encryption/content_key", drm?.brand == DRM.Brand.lcp { encryption.scheme = drm?.scheme.rawValue } // LCP END. if drm?.brand == .adobe { encryption.scheme = drm?.scheme.rawValue } . . . |
func parseEncryptions() -> [String: Encryption] {
...