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

namespace check: encryption.xml EncryptionProperty > ns:Compression (ns = http://www.idpf.org/2016/encryption#compression) #24

Closed
danielweck opened this issue Apr 1, 2016 · 7 comments

Comments

@danielweck
Copy link
Member

Let's open this issue to track whether or not the LCP server implementation is using the correct namespace for encryption.xml's custom element EncryptionProperty > ns:Compression, which currently is http://idpf.org/ocf/encryption#compression (reminder: this is where the attributes Method and OriginalLength are used to cover the optional deflate+compress+store case)

The IDPF specification currently does not normatively define this namespace, so we need a fallback strategy. I suggest a readium.org namespace, similar to that used for LCP. This would impact the source code:
https://github.com/readium/readium-lcp-server/blob/feature/compress-before-encryption/xmlenc/encryption.go#L120

type EncryptionProperty struct {
    Compression Compression `xml:"http://idpf.org/ocf/encryption#compression Compression"`
}

...and of course Readium's own implementation:
https://github.com/readium/readium-sdk/blob/develop/ePub3/ePub/encryption.cpp#L27

#define ReadiumURI "http://readium.org/2015/01/lcp#extendedProperty"

(as you can see, there's already an inconsistency!)

Full EPUB issue:
w3c/epub-specs#646 (comment)

@danielweck
Copy link
Member Author

danielweck commented Apr 1, 2016

I opened an issue in the ReadiumSDK repository:
readium/readium-sdk#230

@danielweck
Copy link
Member Author

Regarding the Compression XML element namespace, @mattgarrish says that it's either http://www.idpf.org/2016/encryption#compression (to follow existing conventions) or http://www.idpf.org/ns/encryption#compression (new non-dated URI convention)
See w3c/epub-specs#646 (comment)

@danielweck
Copy link
Member Author

danielweck commented Apr 20, 2016

@danielweck
Copy link
Member Author

Related issue (thanks @drmnside @thkim2015) w3c/epub-specs#697

@danielweck danielweck changed the title namespace check: encryption.xml EncryptionProperty > ns:Compression (ns = http://idpf.org/ocf/encryption#compression) namespace check: encryption.xml EncryptionProperty > ns:Compression (ns = http://www.idpf.org/2016/encryption#compression) Apr 20, 2016
@danielweck
Copy link
Member Author

Updated source code reference:
https://github.com/readium/readium-lcp-server/blob/master/xmlenc/encryption.go#L130

type Compression struct {
    Method         int    `xml:"Method,attr"`
    OriginalLength uint64 `xml:"OriginalLength,attr"`
}

type EncryptionProperty struct {
    Compression Compression `xml:"http://idpf.org/ns/encryption#compression Compression"`
}

type EncryptionProperties struct {
    Properties []EncryptionProperty `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionProperty"`
}

type Data struct {
    encryptedType
    Properties *EncryptionProperties `xml:"http://www.w3.org/2001/04/xmlenc# EncryptionProperties,omitempty"`
}

@danielweck
Copy link
Member Author

The IDPF-endorsed XML namespace is http://www.idpf.org/2016/encryption#compression
See: http://rawgit.com/IDPF/epub-revision/master/build/31/spec/epub-ocf.html#sec-enc-compression

@jpbougie could you please update:
https://github.com/readium/readium-lcp-server/blob/master/xmlenc/encryption.go#L130

type EncryptionProperty struct {
    Compression Compression `xml:"http://idpf.org/ns/encryption#compression Compression"`
}

Many thanks!

@jpbougie
Copy link
Contributor

Fixed with 91cd5b1

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

No branches or pull requests

2 participants