Translation:RELAX NG UCF Schema

From IDMLWiki

Jump to: navigation, search

1.6 RELAX NG UCFスキーマ

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <choice xmlns="http://relaxng.org/ns/structure/1.0">
  3.   <element name="container">
  4.     <attribute name="version">
  5.       <value>1.0</value>
  6.     </attribute>
  7.     <attribute name="xmlns">
  8.       <value>urn:oasis:names:tc:opendocument:xmlns:container
  9.       </value>
  10.     </attribute>
  11.     <optional>
  12.       <element name="rootfiles">
  13.         <oneOrMore>
  14.           <element name="rootfile">
  15.             <attribute name="full-path">
  16.               <text/>
  17.             </attribute>
  18.             <attribute name="media-type">
  19.               <text/>
  20.             </attribute>
  21.           </element>
  22.         </oneOrMore>
  23.       </element>
  24.     </optional>
  25.     <optional>
  26.       <element name="relationships">
  27.         <oneOrMore>
  28.           <element name="relationship">
  29.             <attribute name="type">
  30.               <text/>
  31.             </attribute>
  32.             <attribute name="target">
  33.               <text/>
  34.             </attribute>
  35.           </element>
  36.         </oneOrMore>
  37.       </element>
  38.     </optional>
  39.   </element>
  40.   <element name="signatures">
  41.     <attribute name="xmlns">
  42.       <value>urn:oasis:names:tc:opendocument:xmlns:container</value>
  43.     </attribute>
  44.     <oneOrMore>
  45.       <element name="Signature" ns="http://www.w3.org/2001/04/xmldsig#">
  46.         <externalRef
  47.          href="http://www.w3.org/Signature/2002/07/xmldsig-core-schema.rng"/>
  48.       </element>
  49.     </oneOrMore>
  50.   </element>
  51.   <element name="encryption">
  52.     <attribute name="xmlns">
  53.       <value>urn:oasis:names:tc:opendocument:xmlns:container</value>
  54.     </attribute>
  55.     <oneOrMore>
  56.       <choice>
  57.         <element name="EncryptedData"
  58.          ns="http://www.w3.org/2001/04/xmlenc#">
  59.           <externalRef
  60.            href="http://www.w3.org/Encryption/2002/07/xenc-schema.rng"/>
  61.         </element>
  62.         <element name="EncryptedKey"
  63.          ns="http://www.w3.org/2001/04/xmlenc#">
  64.           <externalRef
  65.            href="http://www.w3.org/Encryption/2002/07/xenc-schema.rng"/>
  66.         </element>
  67.       </choice>
  68.     </oneOrMore>
  69.   </element>
  70. </choice>


次の例は、Zipコンテナー内の代替のPDF表現が署名され暗号化されたOEBPSパブリケーションを含むためにこのUCFフォーマットの使用を実証します。


Zipコンテナ内のオーダーリスト:

 mimetype
 META-INF/container.xml
 META-INF/signatures.xml
 META-INF/encryption.xml
 OEBPS/As You Like It.opf
 OEBPS/book.html
 OEBPS/images/cover.png
 PDF/As You Like It.pdf


mimetypeファイル:

 application/epub+zip


META-INF/container.xmlファイル:

  1. <?xml version="1.0"?>
  2. <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
  3.   <rootfiles>
  4.     <rootfile full-path="OEBPS/As You Like It.opf"
  5.               media-type="application/oebps-package+xml" />
  6.     <rootfile full-path="OEBPS/As You Like It.pdf"
  7.               media-type="application/pdf" />
  8.   </rootfiles>
  9. </container>


META-INF/signatures.xmlファイル:

  1. <?xml version="1.0"?>
  2. <signatures xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
  3.   <Signature Id="AsYouLikeItSignature" xmlns="http://www.w3.org/2000/09/xmldsig#">
  4.  
  5.     <!-- SignedInfo is the information that is actually signed. In this case -->
  6.     <!-- the SHA1 algorithm is used to sign the canonical form of the XML -->
  7.     <!-- documents enumerated in the Object element below -->
  8.     <SignedInfo>
  9.       <CanonicalizationMethod
  10.        Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
  11.       <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
  12.       <Reference URI="#AsYouLikeIt">
  13.         <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
  14.         <DigestValue>j6lwx3rvEPO0vKtMup4NbeVu8nk=</DigestValue>
  15.       </Reference>
  16.     </SignedInfo>
  17.     <!-- The signed value of the digest above using the DSA algorithm -->
  18.     <SignatureValue>MC0CFFrVLtRlk=...</SignatureValue>
  19.  
  20.     <!-- The key to use to validate the signature -->
  21.     <KeyInfo>
  22.       <KeyValue>
  23.         <DSAKeyValue>
  24.           <P>...</P><Q>...</Q><G>...</G><Y>...</Y>
  25.         </DSAKeyValue>
  26.       </KeyValue>
  27.     </KeyInfo>
  28.  
  29.     <!-- The list documents to sign. Note that the canonical form of XML -->
  30.     <!-- documents is signed while the binary form of the other documents -->
  31.     <!-- is used -->
  32.     <Object>
  33.       <Manifest Id="AsYouLikeIt">
  34.         <Reference URI="OEBPS/As You Like It.opf">
  35.           <Transforms>
  36.             <Transform Algorithm="http://www.w3.org/TR/2001/REC-xmlc14n-20010315"/>
  37.           </Transforms>
  38.         </Reference>
  39.         <Reference URI="OEBPS/book.html">
  40.           <Transforms>
  41.             <Transform Algorithm="http://www.w3.org/TR/2001/REC-xmlc14n-20010315"/>
  42.           </Transforms>
  43.         </Reference>
  44.         <Reference URI="OEBPS/images/cover.png" />
  45.         <Reference URI="PDF/As You Like It.pdf" />
  46.       </Manifest>
  47.     </Object>
  48.   </Signature>
  49. </signatures>


META-INF/encryption.xmlファイル:

  1. <?xml version="1.0"?>
  2. <encryption
  3.  xmlns="urn:oasis:names:tc:opendocument:xmlns:container"
  4.  xmlns:enc="http://www.w3.org/2001/04/xmlenc#"
  5.  xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
  6.   <-- The RSA encrypted AES-128 symmetric key used to encrypt the data -->
  7.   <enc:EncryptedKey Id="EK">
  8.     <enc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  9.     <ds:KeyInfo>
  10.       <ds:KeyName>John Smith</ds:KeyName>
  11.     </ds:KeyInfo>
  12.     <enc:CipherData>
  13.       <enc:CipherValue>xyzabc...</enc:CipherValue>
  14.     </enc:CipherData>
  15.   </enc:EncryptedKey>
  16.  
  17.   <!-- Each EncryptedData block identifies a single document that has been -->
  18.   <!-- encrypted using the AES-128 algorithm. The data remains stored in it’s -->
  19.   <!-- encrypted form in the original file within the container. -->
  20.   <enc:EncryptedData Id="ED1">
  21.     <enc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#kw-aes128"/>
  22.     <ds:KeyInfo>
  23.       <ds:RetrievalMethod URI="#EK"
  24.        Type="http://www.w3.org/2001/04/xmlenc#EncryptedKey"/>
  25.     </ds:KeyInfo>
  26.     <enc:CipherData>
  27.       <enc:CipherReference URI="OEBPS/book.html"/>
  28.     </enc:CipherData>
  29.   </enc:EncryptedData>
  30.   <enc:EncryptedData Id="ED2">
  31.     <enc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#kw-aes128"/>
  32.     <ds:KeyInfo>
  33.       <ds:RetrievalMethod URI="#EK"
  34.        Type="http://www.w3.org/2001/04/xmlenc#EncryptedKey"/>
  35.     </ds:KeyInfo>
  36.   <enc:CipherData>
  37.     <enc:CipherReference URI="OEBPS/images/cover.png"/>
  38.   </enc:CipherData>
  39.   </enc:EncryptedData>
  40.   <enc:EncryptedData Id="ED3">
  41.     <enc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#kw-aes128"/>
  42.       <enc:KeyInfo>
  43.         <enc:RetrievalMethod URI="#EK"
  44.          Type="http://www.w3.org/2001/04/xmlenc#EncryptedKey"/>
  45.       </enc:KeyInfo>
  46.       <enc:CipherData>
  47.         <enc:CipherReference URI="PDF/As You Like It.pdf"/>
  48.       </enc:CipherData>
  49.     </enc:EncryptedData>
  50.   </encryption>


OEBPS/As You Like It.opfファイル:

  1. <?xml version="1.0"?>
  2. <!DOCTYPE package PUBLIC "+//ISBN 0-9673008-1-9//DTD OEB 1.2 Package//EN"
  3.  "http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd">
  4. <package unique-identifier="Package-ID">
  5.   <metadata>
  6.     <dc-metadata xmlns:dc="http://purl.org/dc/elements/1.0"
  7.                  xmlns:oebpackage="http://openebook.org/namespaces/oebpackage/1.0">
  8.     <dc:Identifier id="Package-ID">ebook:guid-6B2DF0030656ED9D8</dc:Identifier>
  9.       <dc:Title>As You Like It</dc:Title>
  10.       <dc:Creator role="aut">William Shakespeare</dc:Creator>
  11.       <dc:Identifier>0-7410-1455-6</dc:Identifier>
  12.       <dc:Subject></dc:Subject>
  13.       <dc:Type></dc:Type>
  14.     <dc:Date event="publication">3/24/2000</dc:Date>
  15.     <dc:Date event="copyright">1/1/9999</dc:Date>
  16.     <dc:Identifier scheme="ISBN">0-7410-1455-6</dc:Identifier>
  17.       <dc:Publisher>Project Gutenberg</dc:Publisher>
  18.       <dc:Language></dc:Language>
  19.     </dc-metadata>
  20.   </metadata>
  21.   <manifest>
  22.     <item id="4915" href="book.html" media-type="text/x-oeb1-document"/>
  23.     <item id="7184" href="images/cover.png" media-type="image/png" />
  24.   </manifest>
  25.   <spine>
  26.     <itemref idref="4915"/>
  27.   </spine>
  28. </package>


OEBPS/book.htmlファイル:

このファイルは、暗号化されたバイナリでしょう。復号した内容は次のもののように見えるかもしれません:

  1. <?xml version="1.0" ?>
  2. <!DOCTYPE html PUBLIC
  3.  "+//ISBN 0-9673008-1-9//DTD OEB 1.2 Document//EN"
  4.  "http://openebook.org/dtds/oeb-1.2/oebdoc12.dtd">
  5. <html>
  6. <head>
  7.  
  8.   ...
  9.  
  10. </head>
  11. <body>
  12.  
  13.  ...
  14.  
  15. <img src="images/cover.png" alt="Cover image: a picture of the Bard of Avon" />
  16.  
  17.   ...
  18.  
  19. </body>
  20. </html>


OEBPS/images/cover.pngファイル: このファイルの内容はcover.pngファイルの暗号化されたバイナリです。


OEBPS/As You Like It.pdfファイル: このファイルの内容はPDFファイルの暗号化されたバイナリです。

Personal tools