-
Notifications
You must be signed in to change notification settings - Fork 402
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
Add the Compression element #928
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
42 changes: 30 additions & 12 deletions
42
src/main/resources/com/adobe/epubcheck/schema/30/ocf-encryption-30.rnc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
default namespace = "urn:oasis:names:tc:opendocument:xmlns:container" | ||
start = element encryption { | ||
grammar { | ||
include "mod/security/Lenient-Encryption11-ghc.rnc" { | ||
start = xenc_EncryptedData | xenc_EncryptedKey | ||
} | ||
xenc_EncryptionMethodOtherParams |= | ||
attribute Algorithm { xsd:anyURI "http://www.idpf.org/2008/embedding" } | ||
xenc_EncryptionAlgorithms |= | ||
xsd:anyURI "http://www.idpf.org/2008/embedding" | ||
}+ | ||
} | ||
default namespace = "urn:oasis:names:tc:opendocument:xmlns:container" | ||
namespace epub_xenc_compress = "http://www.idpf.org/2016/encryption#compression" | ||
namespace xenc = "http://www.w3.org/2001/04/xmlenc#" | ||
|
||
start = | ||
element encryption { | ||
grammar { | ||
include "mod/security/Lenient-Encryption11-ghc.rnc" { | ||
start = xenc_EncryptedData | xenc_EncryptedKey | ||
xenc_EncryptionPropertyType = | ||
mixed { | ||
attribute Target { xsd:anyURI }?, | ||
attribute Id { xenc_IdType }?, | ||
attribute xml:* { text }*, | ||
xenc_EncryptionPropertyContent | ||
} | ||
xenc_anyForeignElement = | ||
element * - (xenc:* | epub_xenc_compress:*) { | ||
mixed { security_anyAttribute*, security_anyElement* } | ||
} | ||
} | ||
xenc_EncryptionMethodOtherParams |= attribute Algorithm { xsd:anyURI "http://www.idpf.org/2008/embedding" } | ||
xenc_EncryptionAlgorithms |= xsd:anyURI "http://www.idpf.org/2008/embedding" | ||
xenc_EncryptionPropertyContent = (epub_xenc_Compression & xenc_anyForeignElement*) | xenc_anyForeignElement+ | ||
epub_xenc_Compression = element epub_xenc_compress:Compression { epub_xenc_CompressionType } | ||
epub_xenc_CompressionType = | ||
attribute Method { "0" | "8" }, | ||
attribute OriginalLength { xsd:nonNegativeInteger } | ||
}+ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/test/resources/30/expanded/invalid/ocf-compression/EPUB/content_001.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body epub:type="bodymatter"> | ||
<h1>Loomings</h1> | ||
<p>Call me Ishmael.</p> | ||
</body> | ||
</html> |
19 changes: 19 additions & 0 deletions
19
src/test/resources/30/expanded/invalid/ocf-compression/EPUB/nav.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Minimal Nav</title> | ||
</head> | ||
<body> | ||
<nav epub:type="toc"> | ||
<ol> | ||
<li><a href="content_001.xhtml">content 001</a></li> | ||
</ol> | ||
</nav> | ||
<nav epub:type="landmarks"> | ||
<ol> | ||
<li><a href="content_001.xhtml" epub:type="bodymatter">Start Reading</a></li> | ||
</ol> | ||
</nav> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
src/test/resources/30/expanded/invalid/ocf-compression/EPUB/package.opf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="q"> | ||
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"> | ||
<dc:title id="title">Minimal EPUB 3.0</dc:title> | ||
<dc:language>en</dc:language> | ||
<dc:identifier id="q">NOID</dc:identifier> | ||
<meta property="dcterms:modified">2017-06-14T00:00:01Z</meta> | ||
</metadata> | ||
<manifest> | ||
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/> | ||
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/> | ||
</manifest> | ||
<spine> | ||
<itemref idref="content_001" /> | ||
</spine> | ||
</package> |
6 changes: 6 additions & 0 deletions
6
src/test/resources/30/expanded/invalid/ocf-compression/META-INF/container.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> | ||
<rootfiles> | ||
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/> | ||
</rootfiles> | ||
</container> |
23 changes: 23 additions & 0 deletions
23
src/test/resources/30/expanded/invalid/ocf-compression/META-INF/encryption.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<encryption xmlns="urn:oasis:names:tc:opendocument:xmlns:container" xmlns:enc="http://www.w3.org/2001/04/xmlenc#" | ||
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> | ||
<enc:EncryptedKey Id="EK"> | ||
<enc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/> | ||
<ds:KeyInfo> | ||
<ds:KeyName>John Smith</ds:KeyName> | ||
</ds:KeyInfo> | ||
<enc:CipherData> | ||
<enc:CipherValue>d2hhdCBkaWQgeW91IHRoaW5rIHlvdSdkIGZpbmQ/</enc:CipherValue> | ||
</enc:CipherData> | ||
</enc:EncryptedKey> | ||
<enc:EncryptedData Id="ED1"> | ||
<enc:CipherData> | ||
<enc:CipherReference URI="OEPBS/video.mp4"/> | ||
</enc:CipherData> | ||
<enc:EncryptionProperties> | ||
<enc:EncryptionProperty xmlns:ns="http://www.idpf.org/2016/encryption#compression"> | ||
<ns:Compression Method="3" OriginalLength=""/> | ||
</enc:EncryptionProperty> | ||
</enc:EncryptionProperties> | ||
</enc:EncryptedData> | ||
</encryption> |
1 change: 1 addition & 0 deletions
1
src/test/resources/30/expanded/invalid/ocf-compression/mimetype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
application/epub+zip |
11 changes: 11 additions & 0 deletions
11
src/test/resources/30/expanded/valid/ocf-compression/EPUB/content_001.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body epub:type="bodymatter"> | ||
<h1>Loomings</h1> | ||
<p>Call me Ishmael.</p> | ||
</body> | ||
</html> |
19 changes: 19 additions & 0 deletions
19
src/test/resources/30/expanded/valid/ocf-compression/EPUB/nav.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Minimal Nav</title> | ||
</head> | ||
<body> | ||
<nav epub:type="toc"> | ||
<ol> | ||
<li><a href="content_001.xhtml">content 001</a></li> | ||
</ol> | ||
</nav> | ||
<nav epub:type="landmarks"> | ||
<ol> | ||
<li><a href="content_001.xhtml" epub:type="bodymatter">Start Reading</a></li> | ||
</ol> | ||
</nav> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
src/test/resources/30/expanded/valid/ocf-compression/EPUB/package.opf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="q"> | ||
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"> | ||
<dc:title id="title">Minimal EPUB 3.0</dc:title> | ||
<dc:language>en</dc:language> | ||
<dc:identifier id="q">NOID</dc:identifier> | ||
<meta property="dcterms:modified">2017-06-14T00:00:01Z</meta> | ||
</metadata> | ||
<manifest> | ||
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/> | ||
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/> | ||
</manifest> | ||
<spine> | ||
<itemref idref="content_001" /> | ||
</spine> | ||
</package> |
6 changes: 6 additions & 0 deletions
6
src/test/resources/30/expanded/valid/ocf-compression/META-INF/container.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> | ||
<rootfiles> | ||
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/> | ||
</rootfiles> | ||
</container> |
23 changes: 23 additions & 0 deletions
23
src/test/resources/30/expanded/valid/ocf-compression/META-INF/encryption.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<encryption xmlns="urn:oasis:names:tc:opendocument:xmlns:container" xmlns:enc="http://www.w3.org/2001/04/xmlenc#" | ||
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> | ||
<enc:EncryptedKey Id="EK"> | ||
<enc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/> | ||
<ds:KeyInfo> | ||
<ds:KeyName>John Smith</ds:KeyName> | ||
</ds:KeyInfo> | ||
<enc:CipherData> | ||
<enc:CipherValue>d2hhdCBkaWQgeW91IHRoaW5rIHlvdSdkIGZpbmQ/</enc:CipherValue> | ||
</enc:CipherData> | ||
</enc:EncryptedKey> | ||
<enc:EncryptedData Id="ED1"> | ||
<enc:CipherData> | ||
<enc:CipherReference URI="OEPBS/video.mp4"/> | ||
</enc:CipherData> | ||
<enc:EncryptionProperties> | ||
<enc:EncryptionProperty xmlns:ns="http://www.idpf.org/2016/encryption#compression"> | ||
<ns:Compression Method="8" OriginalLength="3500000"/> | ||
</enc:EncryptionProperty> | ||
</enc:EncryptionProperties> | ||
</enc:EncryptedData> | ||
</encryption> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
application/epub+zip |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can possibly throw an NPE since we didn't assert at this point that there are at least two errors…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, does epubcheck always retreive schemas?