aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/manifest.py
blob: 8581f3a0bdb4819c900e0424880e6d3bf360e40d (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
"""
Signed manifests.  This is just the ASN.1 encoder, the rest is in
rpki.x509 with the rest of the DER_object code.

Note that rpki.x509.SignedManifest implements the signed manifest;
the structures here are just the payload of the CMS eContent field.

$Id$

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 notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND ARIN DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS.  IN NO EVENT SHALL 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.
"""

from POW._der import *

class FileAndHash(Sequence):
  def __init__(self, optional=0, default=''):
    self.file = IA5String()
    self.hash = AltBitString()
    contents = [ self.file, self.hash ]
    Sequence.__init__(self, contents, optional, default)

class FilesAndHashes(SequenceOf):
  def __init__(self, optional=0, default=''):
    SequenceOf.__init__(self, FileAndHash, optional, default)

class Manifest(Sequence):
  def __init__(self, optional=0, default=''):
    self.version        = Integer()      
    self.explicitVersion = Explicit(CLASS_CONTEXT, FORM_CONSTRUCTED, 0, self.version, 0, 'oAMCAQA=')
    self.manifestNumber = Integer()
    self.thisUpdate     = GeneralizedTime()
    self.nextUpdate     = GeneralizedTime()
    self.fileHashAlg    = Oid()
    self.fileList       = FilesAndHashes()

    contents = [ self.explicitVersion,
                 self.manifestNumber,
                 self.thisUpdate,
                 self.nextUpdate,
                 self.fileHashAlg,
                 self.fileList ]
    Sequence.__init__(self, contents, optional, default)
e> <attribute name="type"> <value>query</value> </attribute> <zeroOrMore> <ref name="query_elt"/> </zeroOrMore> </element> </start> <start combine="choice"> <element name="msg"> <attribute name="version"> <ref name="version"/> </attribute> <attribute name="type"> <value>reply</value> </attribute> <zeroOrMore> <ref name="reply_elt"/> </zeroOrMore> </element> </start> <!-- PDUs allowed in queries and replies. --> <define name="query_elt"> <choice> <ref name="publish_query"/> <ref name="withdraw_query"/> <ref name="list_query"/> </choice> </define> <define name="reply_elt"> <choice> <ref name="publish_reply"/> <ref name="withdraw_reply"/> <ref name="list_reply"/> <ref name="report_error_reply"/> </choice> </define> <!-- Tag attributes for bulk operations. --> <define name="tag"> <attribute name="tag"> <data type="token"> <param name="maxLength">1024</param> </data> </attribute> </define> <!-- Base64 encoded DER stuff. --> <define name="base64"> <data type="base64Binary"/> </define> <!-- Publication URIs. --> <define name="uri"> <attribute name="uri"> <data type="anyURI"> <param name="maxLength">4096</param> </data> </attribute> </define> <!-- Digest of objects being withdrawn --> <define name="hash"> <attribute name="hash"> <data type="string"> <param name="pattern">[0-9a-fA-F]+</param> </data> </attribute> </define> <!-- Error codes. --> <define name="error"> <data type="token"> <param name="maxLength">1024</param> </data> </define> <!-- <publish/> element --> <define name="publish_query"> <element name="publish"> <optional> <ref name="tag"/> </optional> <ref name="uri"/> <optional> <ref name="hash"/> </optional> <ref name="base64"/> </element> </define> <define name="publish_reply"> <element name="publish"> <optional> <ref name="tag"/> </optional> <ref name="uri"/> </element> </define> <!-- <withdraw/> element --> <define name="withdraw_query"> <element name="withdraw"> <optional> <ref name="tag"/> </optional> <ref name="uri"/> <ref name="hash"/> </element> </define> <define name="withdraw_reply"> <element name="withdraw"> <optional> <ref name="tag"/> </optional> <ref name="uri"/> </element> </define> <!-- <list/> element --> <define name="list_query"> <element name="list"> <optional> <ref name="tag"/> </optional> </element> </define> <define name="list_reply"> <element name="list"> <optional> <ref name="tag"/> </optional> <ref name="uri"/> <ref name="hash"/> </element> </define> <!-- <report_error/> element --> <define name="report_error_reply"> <element name="report_error"> <optional> <ref name="tag"/> </optional> <attribute name="error_code"> <ref name="error"/> </attribute> <optional> <data type="string"> <param name="maxLength">512000</param> </data> </optional> </element> </define> </grammar> <!-- Local Variables: indent-tabs-mode: nil comment-start: "# " comment-start-skip: "#[ \t]*" End: -->