aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--myrpki/myrpki.py5
-rw-r--r--myrpki/myrpki.rnc44
2 files changed, 47 insertions, 2 deletions
diff --git a/myrpki/myrpki.py b/myrpki/myrpki.py
index d499a5c0..b16f88ea 100644
--- a/myrpki/myrpki.py
+++ b/myrpki/myrpki.py
@@ -95,7 +95,8 @@ def csv_open(filename, delimiter = "\t", dialect = None):
return csv.reader(open(filename, "rb"), dialect = dialect, delimiter = delimiter)
def PEMElement(e, tag, filename):
- SubElement(e, tag).text = "".join(open(filename).readlines()[1:-1])
+ SubElement(e, tag).text = "".join(p.strip()
+ for p in open(filename).readlines()[1:-1])
def bpki_ca(e):
@@ -169,7 +170,7 @@ for handle, pn in csv_open(prefixes_csv_file):
for handle, asn in csv_open(asns_csv_file):
kids.add(handle = handle, asn = asn)
-e = Element("myrpki", handle = my_handle)
+e = Element("myrpki", version = "1", handle = my_handle)
roas.xml(e)
kids.xml(e)
bpki_ca(e)
diff --git a/myrpki/myrpki.rnc b/myrpki/myrpki.rnc
new file mode 100644
index 00000000..e82db37f
--- /dev/null
+++ b/myrpki/myrpki.rnc
@@ -0,0 +1,44 @@
+# $Id$
+#
+# RelaxNG Schema for MyRPKI XML messages
+#
+# libxml2 (including xmllint) only groks the XML syntax of RelaxNG, so
+# run the compact syntax through trang to get XML syntax.
+
+default namespace = "http://www.hactrn.net/uris/rpki/myrpki/"
+
+base64 = xsd:base64Binary { maxLength="512000" }
+object_handle = xsd:string { maxLength="255" pattern="[\-_A-Za-z0-9]*" }
+uri = xsd:anyURI { maxLength="4096" }
+asn_list = xsd:string { maxLength="512000" pattern="[\-,0-9]*" }
+ipv4_list = xsd:string { maxLength="512000" pattern="[\-,0-9/.]*" }
+ipv6_list = xsd:string { maxLength="512000" pattern="[\-,0-9/:a-fA-F]*" }
+
+start = element myrpki {
+ attribute version { xsd:positiveInteger { maxInclusive="1" } },
+ attribute handle { object_handle },
+ roa_request*,
+ child*,
+ bpki_ca_certificate?,
+ bpki_ee_certificate?
+}
+
+roa_request = element roa_request {
+ attribute asn { xsd:positiveInteger },
+ attribute prefixes { ipv4_list }
+}
+
+child = element child {
+ attribute handle { object_handle },
+ attribute valid_until { xsd:dateTime { pattern=".*Z" } },
+ attribute asns { asn_list }?,
+ attribute prefixes { ipv4_list }?
+}
+
+bpki_ca_certificate = element bpki_ca_certificate { base64 }
+
+bpki_ee_certificate = element bpki_ee_certificate { base64 }
+
+# Local Variables:
+# indent-tabs-mode: nil
+# End: