00001 """Signed manifests. This is just the ASN.1 encoder, the rest is in 00002 rpki.x509 with the rest of the DER_object code. 00003 00004 Note that rpki.x509.SignedManifest implements the signed manifest; 00005 the structures here are just the payload of the CMS eContent field. 00006 00007 $Id: manifest.py 1873 2008-06-12 02:49:41Z sra $ 00008 00009 Copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") 00010 00011 Permission to use, copy, modify, and distribute this software for any 00012 purpose with or without fee is hereby granted, provided that the above 00013 copyright notice and this permission notice appear in all copies. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS" AND ARIN DISCLAIMS ALL WARRANTIES WITH 00016 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00017 AND FITNESS. IN NO EVENT SHALL ARIN BE LIABLE FOR ANY SPECIAL, DIRECT, 00018 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00019 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00020 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00021 PERFORMANCE OF THIS SOFTWARE. 00022 """ 00023 00024 from POW._der import * 00025 00026 class FileAndHash(Sequence): 00027 def __init__(self, optional=0, default=''): 00028 self.file = IA5String() 00029 self.hash = AltBitString() 00030 contents = [ self.file, self.hash ] 00031 Sequence.__init__(self, contents, optional, default) 00032 00033 class FilesAndHashes(SequenceOf): 00034 def __init__(self, optional=0, default=''): 00035 SequenceOf.__init__(self, FileAndHash, optional, default) 00036 00037 class Manifest(Sequence): 00038 def __init__(self, optional=0, default=''): 00039 self.version = Integer() 00040 self.explicitVersion = Explicit(CLASS_CONTEXT, FORM_CONSTRUCTED, 0, self.version, 0, 'oAMCAQA=') 00041 self.manifestNumber = Integer() 00042 self.thisUpdate = GeneralizedTime() 00043 self.nextUpdate = GeneralizedTime() 00044 self.fileHashAlg = Oid() 00045 self.fileList = FilesAndHashes() 00046 00047 contents = [ self.explicitVersion, 00048 self.manifestNumber, 00049 self.thisUpdate, 00050 self.nextUpdate, 00051 self.fileHashAlg, 00052 self.fileList ] 00053 Sequence.__init__(self, contents, optional, default)