move gpg stuff around

This commit is contained in:
brent s. 2019-12-11 03:40:06 -05:00
parent e08444fae7
commit d96289aa78
6 changed files with 88 additions and 61 deletions

View File

@ -3,7 +3,8 @@
elementFormDefault="qualified" elementFormDefault="qualified"
attributeFormDefault="unqualified"> attributeFormDefault="unqualified">


<xs:include schemaLocation="./linux.xsd"/> <xs:include schemaLocation="./gpg.xsd"/>
<!-- <xs:include schemaLocation="./linux.xsd"/> --><!-- Included by the linux elements XSD. -->
<xs:include schemaLocation="./net.xsd"/> <xs:include schemaLocation="./net.xsd"/>
<xs:include schemaLocation="./std.xsd"/> <xs:include schemaLocation="./std.xsd"/>
<xs:include schemaLocation="./unix.xsd"/> <xs:include schemaLocation="./unix.xsd"/>

64
schema/lib/types/gpg.xsd Normal file
View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:include schemaLocation="./net.xsd"/>
<xs:include schemaLocation="./std.xsd"/>

<xs:complexType name="t_gpg_keys">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="keyID" minOccurs="0" maxOccurs="unbounded" type="t_gpg_key_id"/>
<xs:element name="keyFile" minOccurs="0" maxOccurs="unbounded" type="t_std_uri"/>
</xs:choice>
</xs:complexType>

<xs:simpleType name="t_gpg_key_id">
<xs:restriction base="xs:string">
<xs:pattern value="(auto|default)"/><!-- Program should accept any key IDs it finds (INSECURE) -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{40}\s*"/><!-- Full key ID -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{16}\s*"/><!-- Shorthand key ID -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{8}\s*"/><!-- Legacy shorter shorthand -->
<xs:pattern value="\s*([0-9A-Fa-f ]{4}){5} ?([0-9A-Fa-f ]{4}){4}[0-9A-Fa-f]{4}\s*"/><!-- Fingerprint -->
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_gpg_key_id_search">
<xs:union memberTypes="t_gpg_key_id t_net_email_addr"/>
</xs:simpleType>

<xs:simpleType name="t_gpg_sig">
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_gpg_verify">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="sigs">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="signature" minOccurs="0" maxOccurs="unbounded" type="t_gpg_sig"/>
<xs:element name="signatureFile" minOccurs="0" maxOccurs="unbounded" type="t_std_uri"/>
</xs:choice>
</xs:complexType>
<xs:unique name="uniq_gpg_sig">
<xs:selector xpath="signature"/>
<xs:field xpath="."/>
</xs:unique>
<xs:unique name="uniq_gpg_sigfile">
<xs:selector xpath="signatureFile"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
<xs:element name="keys" minOccurs="1" maxOccurs="1" type="t_gpg_keys">
<xs:unique name="uniq_key_id">
<xs:selector xpath="keyID"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
</xs:choice>
</xs:complexType>

</xs:schema>

View File

@ -47,6 +47,16 @@
<xs:union memberTypes="t_net_qualified_addr_ip4 t_net_qualified_addr_ip6"/> <xs:union memberTypes="t_net_qualified_addr_ip4 t_net_qualified_addr_ip6"/>
</xs:simpleType> </xs:simpleType>


<xs:simpleType name="t_net_email_addr">
<xs:restriction base="xs:string">
<!-- Thanks, my dude: https://stackoverflow.com/a/2147859/733214 -->
<!-- And turns out email local parts are WAY more permissive than I thought:
https://stackoverflow.com/a/2049510/733214 -->
<xs:pattern value="[^@]+@[^\.]+\..+"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_net_http_resource"> <xs:complexType name="t_net_http_resource">
<xs:simpleContent> <xs:simpleContent>
<xs:extension base="t_std_uri"> <xs:extension base="t_std_uri">

View File

@ -61,30 +61,6 @@
<xs:union memberTypes="xs:dateTime xs:positiveInteger"/> <xs:union memberTypes="xs:dateTime xs:positiveInteger"/>
</xs:simpleType> </xs:simpleType>


<xs:complexType name="t_std_gpg_keys">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="keyID" minOccurs="0" maxOccurs="unbounded" type="t_std_gpg_key_id"/>
<xs:element name="keyFile" minOccurs="0" maxOccurs="unbounded" type="t_std_uri"/>
</xs:choice>
</xs:complexType>
<xs:simpleType name="t_std_gpg_key_id">
<xs:restriction base="xs:string">
<xs:pattern value="(auto|default)"/><!-- Program should accept any key IDs it finds (INSECURE) -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{40}\s*"/><!-- Full key ID -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{16}\s*"/><!-- Shorthand key ID -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{8}\s*"/><!-- Legacy shorter shorthand -->
<xs:pattern value="\s*([0-9A-Fa-f ]{4}){5} ?([0-9A-Fa-f ]{4}){4}[0-9A-Fa-f]{4}\s*"/><!-- Fingerprint -->
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_std_gpg_sig">
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_std_nonempty"> <xs:simpleType name="t_std_nonempty">
<xs:restriction base="xs:token"> <xs:restriction base="xs:token">
<xs:minLength value="1"/> <xs:minLength value="1"/>
@ -98,14 +74,6 @@
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>


<xs:complexType name="t_std_verifyfile">
<xs:choice minOccurs="1" maxOccurs="2">
<xs:element name="gpg" minOccurs="0" maxOccurs="1" type="t_std_verify_gpg">
</xs:element>
<xs:element name="hash" minOccurs="0" maxOccurs="1" type="t_std_verify_cksum"/>
</xs:choice>
</xs:complexType>

<xs:complexType name="t_std_verify_cksum"> <xs:complexType name="t_std_verify_cksum">
<xs:sequence> <xs:sequence>
<xs:element name="checksum" minOccurs="0" maxOccurs="unbounded" type="t_std_cksum"/> <xs:element name="checksum" minOccurs="0" maxOccurs="unbounded" type="t_std_cksum"/>
@ -113,31 +81,4 @@
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>


<xs:complexType name="t_std_verify_gpg">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="sigs">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="signature" minOccurs="0" maxOccurs="unbounded" type="t_std_gpg_sig"/>
<xs:element name="signatureFile" minOccurs="0" maxOccurs="unbounded" type="t_std_uri"/>
</xs:choice>
</xs:complexType>
<xs:unique name="uniq_gpg_sig">
<xs:selector xpath="signature"/>
<xs:field xpath="."/>
</xs:unique>
<xs:unique name="uniq_gpg_sigfile">
<xs:selector xpath="signatureFile"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
<xs:element name="keys" minOccurs="1" maxOccurs="1" type="t_std_gpg_keys">
<xs:unique name="uniq_key_id">
<xs:selector xpath="keyID"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
</xs:choice>
</xs:complexType>

</xs:schema> </xs:schema>

View File

@ -3,6 +3,9 @@
elementFormDefault="qualified" elementFormDefault="qualified"
attributeFormDefault="unqualified"> attributeFormDefault="unqualified">


<xs:include schemaLocation="./gpg.xsd"/>
<xs:include schemaLocation="./std.xsd"/>
<xs:simpleType name="t_sys_diskfmt"> <xs:simpleType name="t_sys_diskfmt">
<xs:restriction base="xs:token"> <xs:restriction base="xs:token">
<xs:enumeration value="gpt"/> <xs:enumeration value="gpt"/>
@ -13,4 +16,12 @@
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>


<xs:complexType name="t_sys_verifyfile">
<xs:choice minOccurs="1" maxOccurs="2">
<xs:element name="gpg" minOccurs="0" maxOccurs="1" type="t_gpg_verify">
</xs:element>
<xs:element name="hash" minOccurs="0" maxOccurs="1" type="t_std_verify_cksum"/>
</xs:choice>
</xs:complexType>

</xs:schema> </xs:schema>

View File

@ -17,7 +17,7 @@
<xs:complexType> <xs:complexType>
<xs:all> <xs:all>
<xs:element name="tarball" minOccurs="1" maxOccurs="1" type="t_std_uri"/> <xs:element name="tarball" minOccurs="1" maxOccurs="1" type="t_std_uri"/>
<xs:element name="verify" minOccurs="0" maxOccurs="1" type="t_std_verifyfile"/> <xs:element name="verify" minOccurs="0" maxOccurs="1" type="t_sys_verifyfile"/>
</xs:all> </xs:all>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>