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