Add initial value format schema 45/37045/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 12 Mar 2015 16:34:53 +0000 (17:34 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 18 Mar 2015 10:53:50 +0000 (11:53 +0100)
[Issue#] N/A
[Feature/Bug] N/A
[Problem] Initial value format needs to be defined
[Cause] N/A
[Solution] Schema and example added

[Verification] Validate example with: xmllint -schema initial_values.xsd example.xml

Change-Id: I5c8979c971e73b07e959e2fdf5d32ee3f9dabf91

doc/example.xml [new file with mode: 0644]
doc/initial_values.xsd [new file with mode: 0644]

diff --git a/doc/example.xml b/doc/example.xml
new file mode 100644 (file)
index 0000000..e3071b4
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<InitialValues version="0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="initial_values.xsd ">
+  <Key name="key1" owner="label1" password="123" encoding="PEM">
+    -----BEGIN PUBLIC KEY-----
+    MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2b1bXDa+S8/MGWnMkru4
+    T4tUddtZNi0NVjQn9RFH1NMa220GsRhRO56F77FlSVFKfSfVZKIiWg6C+DVCkcLf
+    zXJ/Z0pvwOQYBAqVMFjV6efQGN0JzJ1Unu7pPRiZl7RKGEI+cyzzrcDyrLLrQ2W7
+    0ZySkNEOv6Frx9JgC5NExuYY4lk2fQQa38JXiZkfyzif2em0px7mXbyf5LjccsKq
+    v1e+XLtMsL0ZefRcqsP++NzQAI8fKX7WBT+qK0HJDLiHrKOTWYzx6CwJ66LD/vvf
+    j55xtsKDLVDbsotvf8/m6VLMab+vqKk11TP4tq6yo0mwyTADvgl1zowQEO9I1W6o
+    zQIDAQAB
+    -----END PUBLIC KEY-----
+  </Key>
+  <Cert extractable="true" name="cert1" owner="label1" encoding="DER">
+    MIIEgDCCA2igAwIBAgIIcjtBYJGQtOAwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE
+    BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl
+    cm5ldCBBdXRob3JpdHkgRzIwHhcNMTQwNTIyMTEyOTQyWhcNMTQwODIwMDAwMDAw
+    WjBtMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN
+    TW91bnRhaW4gVmlldzETMBEGA1UECgwKR29vZ2xlIEluYzEcMBoGA1UEAwwTYWNj
+    rHva8A==
+  </Cert>
+  <Data name="data1" owner="label2" encoding="ASCII">
+    My secret data
+  </Data>
+  <AesCbcKey name="aes1" owner="label2" encoding="Base64" iv="9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB">
+    MIIEgDCCA2igAwIBAgIIcjtBYJGQtOAwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE
+  </AesCbcKey>
+  <AesGcmKey name="aes2" owner="label2" encoding="Base64" iv="9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB" additionalData="9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB9vZ2xlIEluYzEcMB" tagLength="128">
+    MIIEgDCCA2igAwIBAgIIcjtBYJGQtOAwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE
+  </AesGcmKey>
+  <AesCtrKey name="aes3" owner="label2" encoding="PEM">
+    -----BEGIN PRIVATE KEY-----
+    MIIEgDCCA2igAwIBAgIIcjtBYJGQtOAwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE
+    -----END PRIVATE KEY-----
+  </AesCtrKey>
+</InitialValues>
\ No newline at end of file
diff --git a/doc/initial_values.xsd b/doc/initial_values.xsd
new file mode 100644 (file)
index 0000000..7e063cf
--- /dev/null
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+       <xsd:element name="InitialValues" type="InitialValuesType"></xsd:element>
+
+       <xsd:complexType name="ValueType">
+               <xsd:simpleContent>
+                       <xsd:extension base="xsd:string">
+                               <xsd:attribute name="name" use="required">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:minLength value="1"></xsd:minLength>
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                               <xsd:attribute name="owner" use="required">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:minLength value="1"></xsd:minLength>
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                               <xsd:attribute name="password" use="optional"
+                                       type="xsd:string">
+                               </xsd:attribute>
+                               <xsd:attribute name="extractable" use="optional"
+                                       default="false">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:boolean"></xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+
+                       </xsd:extension>
+               </xsd:simpleContent>
+       </xsd:complexType>
+
+       <xsd:complexType name="InitialValuesType">
+               <xsd:sequence>
+                       <xsd:choice maxOccurs="unbounded" minOccurs="1">
+                               <xsd:element name="AesCtrKey" type="AesCtrKeyType"
+                                       maxOccurs="1" minOccurs="1">
+                               </xsd:element>
+                               <xsd:element name="AesCbcKey" type="AesCbcKeyType"
+                                       maxOccurs="1" minOccurs="1">
+                               </xsd:element>
+                               <xsd:element name="AesGcmKey" type="AesGcmKeyType"
+                                       maxOccurs="1" minOccurs="1">
+                               </xsd:element>
+                               <xsd:element name="AesCfbKey" type="AesCfbKeyType"
+                                       maxOccurs="1" minOccurs="1">
+                               </xsd:element>
+                               <xsd:element name="Data" type="DataType"
+                                       maxOccurs="1" minOccurs="1">
+                               </xsd:element>
+                               <xsd:element name="Key" type="KeyCertType"
+                                       maxOccurs="1" minOccurs="1">
+                               </xsd:element>
+                               <xsd:element name="Cert" type="KeyCertType"
+                                       maxOccurs="1" minOccurs="1">
+                               </xsd:element>
+                       </xsd:choice>
+               </xsd:sequence>
+               <xsd:attribute name="version" type="xsd:int" use="required"></xsd:attribute>
+       </xsd:complexType>
+
+       <xsd:complexType name="AesCtrKeyType">
+               <xsd:simpleContent>
+                       <xsd:extension base="ValueType">
+                               <xsd:attribute name="encoding" use="required">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:enumeration value="Base64"></xsd:enumeration>
+                                                       <xsd:enumeration value="PEM"></xsd:enumeration>
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                       </xsd:extension>
+               </xsd:simpleContent>
+       </xsd:complexType>
+
+       <xsd:complexType name="AesCbcKeyType">
+               <xsd:simpleContent>
+                       <xsd:extension base="ValueType">
+                               <xsd:attribute name="encoding" use="required">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:enumeration value="Base64"></xsd:enumeration>
+                                                       <xsd:enumeration value="PEM"></xsd:enumeration>
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                               <xsd:attribute name="iv" type="xsd:base64Binary" use="required"></xsd:attribute>
+                       </xsd:extension>
+               </xsd:simpleContent>
+       </xsd:complexType>
+
+       <xsd:complexType name="AesGcmKeyType">
+               <xsd:simpleContent>
+                       <xsd:extension base="ValueType">
+                               <xsd:attribute name="encoding" use="required">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:enumeration value="Base64"></xsd:enumeration>
+                                                       <xsd:enumeration value="PEM"></xsd:enumeration>
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                               <xsd:attribute name="iv" type="xsd:base64Binary"
+                                       use="required">
+                               </xsd:attribute>
+                               <xsd:attribute name="additionalData"
+                                       type="xsd:string">
+                               </xsd:attribute>
+                               <xsd:attribute name="tagLength" type="xsd:int"></xsd:attribute>
+                       </xsd:extension>
+               </xsd:simpleContent>
+       </xsd:complexType>
+
+       <xsd:complexType name="AesCfbKeyType">
+               <xsd:simpleContent>
+                       <xsd:extension base="ValueType">
+                               <xsd:attribute name="encoding" use="required">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:enumeration value="Base64"></xsd:enumeration>
+                                                       <xsd:enumeration value="PEM"></xsd:enumeration>
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                               <xsd:attribute name="iv" type="xsd:base64Binary" use="required"></xsd:attribute>
+                       </xsd:extension>
+               </xsd:simpleContent>
+       </xsd:complexType>
+
+       <xsd:complexType name="KeyCertType">
+               <xsd:simpleContent>
+                       <xsd:extension base="ValueType">
+                               <xsd:attribute name="encoding">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:enumeration value="PEM"></xsd:enumeration>
+                                                       <xsd:enumeration value="DER"></xsd:enumeration>
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                       </xsd:extension>
+               </xsd:simpleContent>
+       </xsd:complexType>
+
+       <xsd:complexType name="DataType">
+               <xsd:simpleContent>
+                       <xsd:extension base="ValueType">
+                               <xsd:attribute name="encoding">
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:enumeration value="ASCII"></xsd:enumeration>
+                                                       <xsd:enumeration value="Base64"></xsd:enumeration>
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                       </xsd:extension>
+               </xsd:simpleContent>
+       </xsd:complexType>
+</xsd:schema>
\ No newline at end of file