aboutsummaryrefslogtreecommitdiff
path: root/rpkid/left-right-schema.rnc
blob: b46adeb5c503058519a4a27b9c3af7a6b70fe336 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# $Id$
#
# RelaxNG schema for RPKI left-right protocol.
#
# Copyright (C) 2012--2014  Dragon Research Labs ("DRL")
# Portions copyright (C) 2009--2011  Internet Systems Consortium ("ISC")
# Portions copyright (C) 2007--2008  American Registry for Internet Numbers ("ARIN")
# 
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notices and this permission notice appear in all copies.
# 
# THE SOFTWARE IS PROVIDED "AS IS" AND DRL, ISC, AND ARIN DISCLAIM ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL DRL,
# ISC, OR ARIN BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

default namespace = "http://www.hactrn.net/uris/rpki/left-right-spec/"

# Top level PDU

start = element msg {
  attribute version { xsd:positiveInteger { maxInclusive="1" } },
  ( (attribute type { "query" }, query_elt*) |
    (attribute type { "reply" }, reply_elt*) )
}

# PDUs allowed in a query
query_elt |= self_query
query_elt |= bsc_query
query_elt |= parent_query
query_elt |= child_query
query_elt |= repository_query
query_elt |= list_roa_requests_query
query_elt |= list_ghostbuster_requests_query
query_elt |= list_ee_certificate_requests_query
query_elt |= list_resources_query
query_elt |= list_published_objects_query
query_elt |= list_received_resources_query

# PDUs allowed in a reply
reply_elt |= self_reply
reply_elt |= bsc_reply
reply_elt |= parent_reply
reply_elt |= child_reply
reply_elt |= repository_reply
reply_elt |= list_resources_reply
reply_elt |= list_roa_requests_reply
reply_elt |= list_ghostbuster_requests_reply
reply_elt |= list_ee_certificate_requests_reply
reply_elt |= list_published_objects_reply
reply_elt |= list_received_resources_reply
reply_elt |= report_error_reply

# Tag attributes for bulk operations
tag = attribute tag { xsd:token {maxLength="1024" } }?

# Combinations of action and type attributes used in later definitions.
# The same patterns repeat in most of the elements in this protocol.
ctl_create  = attribute action { "create"  }, tag
ctl_set     = attribute action { "set"     }, tag
ctl_get     = attribute action { "get"     }, tag
ctl_list    = attribute action { "list"    }, tag
ctl_destroy = attribute action { "destroy" }, tag

# Base64 encoded DER stuff
base64 = xsd:base64Binary { maxLength="512000" }

# Base definition for all fields that are really just SQL primary indices
#sql_id = xsd:nonNegativeInteger

# ...except that fields containing SQL primary indicies don't belong
# in this protocol, so they're turninging into handles.
# Length restriction is a MySQL implementation issue.
# Handles are case-insensitive (because SQL is, among other reasons).
object_handle = xsd:string { maxLength="255" pattern="[\-_A-Za-z0-9]+" }

# URIs
uri = xsd:anyURI { maxLength="4096" }

# Name fields imported from up-down protocol
up_down_name = xsd:token { maxLength="1024" }

# Resource lists
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]*" }

# <self/> element

self_bool = (attribute rekey { "yes" }?,
             attribute reissue { "yes" }?,
             attribute revoke { "yes" }?,
             attribute run_now { "yes" }?,
             attribute publish_world_now { "yes" }?,
             attribute revoke_forgotten { "yes" }?,
             attribute clear_replay_protection { "yes" }?)

self_payload = (attribute use_hsm { "yes" | "no" }?,
                attribute crl_interval { xsd:positiveInteger }?,
                attribute regen_margin { xsd:positiveInteger }?,
                element bpki_cert { base64 }?,
                element bpki_glue { base64 }?)

self_handle = attribute self_handle { object_handle }

self_query |= element self { ctl_create,  self_handle, self_bool, self_payload }
self_reply |= element self { ctl_create,  self_handle }
self_query |= element self { ctl_set,     self_handle, self_bool, self_payload }
self_reply |= element self { ctl_set,     self_handle }
self_query |= element self { ctl_get,     self_handle }
self_reply |= element self { ctl_get,     self_handle, self_payload }
self_query |= element self { ctl_list }
self_reply |= element self { ctl_list,    self_handle, self_payload }
self_query |= element self { ctl_destroy, self_handle }
self_reply |= element self { ctl_destroy, self_handle }

# <bsc/> element.  Key parameters hardwired for now.

bsc_bool = ((attribute generate_keypair { "yes" },
             attribute key_type { "rsa" }?,
             attribute hash_alg { "sha256" }?,
             attribute key_length { "2048" }?)?)

bsc_handle = attribute bsc_handle { object_handle }

bsc_payload = (element signing_cert { base64 }?,
               element signing_cert_crl { base64 }?)

bsc_readonly = element pkcs10_request { base64 }?

bsc_query |= element bsc { ctl_create,  self_handle, bsc_handle, bsc_bool, bsc_payload }
bsc_reply |= element bsc { ctl_create,  self_handle, bsc_handle, bsc_readonly }
bsc_query |= element bsc { ctl_set,     self_handle, bsc_handle, bsc_bool, bsc_payload }
bsc_reply |= element bsc { ctl_set,     self_handle, bsc_handle, bsc_readonly }
bsc_query |= element bsc { ctl_get,     self_handle, bsc_handle }
bsc_reply |= element bsc { ctl_get,     self_handle, bsc_handle, bsc_payload, bsc_readonly }
bsc_query |= element bsc { ctl_list,    self_handle }
bsc_reply |= element bsc { ctl_list,    self_handle, bsc_handle, bsc_payload, bsc_readonly }
bsc_query |= element bsc { ctl_destroy, self_handle, bsc_handle }
bsc_reply |= element bsc { ctl_destroy, self_handle, bsc_handle }

# <parent/> element

parent_handle = attribute parent_handle { object_handle }

parent_bool = (attribute rekey { "yes" }?,
               attribute reissue { "yes" }?,
               attribute revoke { "yes" }?,
               attribute revoke_forgotten { "yes" }?,
             attribute clear_replay_protection { "yes" }?)

parent_payload = (attribute peer_contact_uri { uri }?,
                  attribute sia_base { uri }?,
                  bsc_handle?,
                  repository_handle?,
                  attribute sender_name { up_down_name }?,
                  attribute recipient_name { up_down_name }?,
                  element bpki_cms_cert { base64 }?,
                  element bpki_cms_glue { base64 }?)

parent_query |= element parent { ctl_create,  self_handle, parent_handle, parent_bool, parent_payload }
parent_reply |= element parent { ctl_create,  self_handle, parent_handle }
parent_query |= element parent { ctl_set,     self_handle, parent_handle, parent_bool, parent_payload }
parent_reply |= element parent { ctl_set,     self_handle, parent_handle }
parent_query |= element parent { ctl_get,     self_handle, parent_handle }
parent_reply |= element parent { ctl_get,     self_handle, parent_handle, parent_payload }
parent_query |= element parent { ctl_list,    self_handle }
parent_reply |= element parent { ctl_list,    self_handle, parent_handle, parent_payload }
parent_query |= element parent { ctl_destroy, self_handle, parent_handle }
parent_reply |= element parent { ctl_destroy, self_handle, parent_handle }

# <child/> element

child_handle = attribute child_handle { object_handle }

child_bool = (attribute reissue { "yes" }?,
              attribute clear_replay_protection { "yes" }?)

child_payload = (bsc_handle?,
                 element bpki_cert { base64 }?,
                 element bpki_glue { base64 }?)

child_query |= element child { ctl_create,  self_handle, child_handle, child_bool, child_payload }
child_reply |= element child { ctl_create,  self_handle, child_handle }
child_query |= element child { ctl_set,     self_handle, child_handle, child_bool, child_payload }
child_reply |= element child { ctl_set,     self_handle, child_handle }
child_query |= element child { ctl_get,     self_handle, child_handle }
child_reply |= element child { ctl_get,     self_handle, child_handle, child_payload }
child_query |= element child { ctl_list,    self_handle }
child_reply |= element child { ctl_list,    self_handle, child_handle, child_payload }
child_query |= element child { ctl_destroy, self_handle, child_handle }
child_reply |= element child { ctl_destroy, self_handle, child_handle }

# <repository/> element

repository_handle = attribute repository_handle { object_handle }

repository_bool = attribute clear_replay_protection { "yes" }?

repository_payload = (attribute peer_contact_uri { uri }?,
                      bsc_handle?,
                      element bpki_cert { base64 }?,
                      element bpki_glue { base64 }?)

repository_query |= element repository { ctl_create,  self_handle, repository_handle, repository_bool, repository_payload }
repository_reply |= element repository { ctl_create,  self_handle, repository_handle }
repository_query |= element repository { ctl_set,     self_handle, repository_handle, repository_bool, repository_payload }
repository_reply |= element repository { ctl_set,     self_handle, repository_handle }
repository_query |= element repository { ctl_get,     self_handle, repository_handle }
repository_reply |= element repository { ctl_get,     self_handle, repository_handle, repository_payload }
repository_query |= element repository { ctl_list,    self_handle }
repository_reply |= element repository { ctl_list,    self_handle, repository_handle, repository_payload }
repository_query |= element repository { ctl_destroy, self_handle, repository_handle }
repository_reply |= element repository { ctl_destroy, self_handle, repository_handle }

# <list_resources/> element

list_resources_query = element list_resources {
  tag, self_handle, child_handle
}

list_resources_reply = element list_resources {
  tag, self_handle, child_handle,
  attribute valid_until { xsd:dateTime { pattern=".*Z" } },
  attribute asn { asn_list }?,
  attribute ipv4 { ipv4_list }?,
  attribute ipv6 { ipv6_list }?
}

# <list_roa_requests/> element

list_roa_requests_query = element list_roa_requests {
  tag, self_handle
}

list_roa_requests_reply = element list_roa_requests {
  tag, self_handle,
  attribute asn { xsd:nonNegativeInteger },
  attribute ipv4 { ipv4_list }?,
  attribute ipv6 { ipv6_list }?
}

# <list_ghostbuster_requests/> element

list_ghostbuster_requests_query = element list_ghostbuster_requests {
  tag, self_handle, parent_handle
}

list_ghostbuster_requests_reply = element list_ghostbuster_requests {
  tag, self_handle, parent_handle,
  xsd:string
}

# <list_ee_certificate_requests/> element

list_ee_certificate_requests_query = element list_ee_certificate_requests {
  tag, self_handle
}

list_ee_certificate_requests_reply = element list_ee_certificate_requests {
  tag, self_handle,
  attribute gski { xsd:token { minLength="27" maxLength="27" } },
  attribute valid_until { xsd:dateTime { pattern=".*Z" } },
  attribute asn  { asn_list }?,
  attribute ipv4 { ipv4_list }?,
  attribute ipv6 { ipv6_list }?,
  attribute cn  { xsd:string { maxLength="64"     pattern="[\-0-9A-Za-z_ ]+" } }?,
  attribute sn  { xsd:string { maxLength="64"     pattern="[0-9A-Fa-f]+"     } }?,
  attribute eku { xsd:string { maxLength="512000" pattern="[.,0-9]+"         } }?,
  element pkcs10 { base64 }
}

# <list_published_objects/> element

list_published_objects_query = element list_published_objects {
  tag, self_handle
}

list_published_objects_reply = element list_published_objects {
  tag, self_handle,
  attribute uri { uri },
  attribute child_handle { object_handle }?,
  base64
}

# <list_received_resources/> element

list_received_resources_query = element list_received_resources {
  tag, self_handle
}

list_received_resources_reply = element list_received_resources {
  tag, self_handle, parent_handle,
  attribute notBefore { xsd:dateTime { pattern=".*Z" } },
  attribute notAfter { xsd:dateTime { pattern=".*Z" } },
  attribute uri { uri },
  attribute sia_uri { uri },
  attribute aia_uri { uri },
  attribute asn { asn_list }?,
  attribute ipv4 { ipv4_list }?,
  attribute ipv6 { ipv6_list }?
}

# <report_error/> element

error = xsd:token { maxLength="1024" }

report_error_reply = element report_error {
  tag, self_handle?,
  attribute error_code { error },
  xsd:string { maxLength="512000" }?
}

# Local Variables:
# indent-tabs-mode: nil
# comment-start: "# "
# comment-start-skip: "#[ \t]*"
# End: