diff options
author | Rob Austein <sra@hactrn.net> | 2007-10-09 19:25:15 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-10-09 19:25:15 +0000 |
commit | 6a1daf6220fcbe044ed8a4f28e4b5ab618b00ca9 (patch) | |
tree | 9d4ffc1bd9ea2b8d915ecd5f1515632ef0638955 | |
parent | d0ef5e6204d5f357d14e20a8779e74d86bb8cab1 (diff) |
Cleanup
svn path=/scripts/manifests.py; revision=1137
-rw-r--r-- | scripts/manifests.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/scripts/manifests.py b/scripts/manifests.py index 5ea6f924..4991ffa2 100644 --- a/scripts/manifests.py +++ b/scripts/manifests.py @@ -1,27 +1,25 @@ # $Id$ -import rpki.x509, rpki.manifest, time, POW, POW.pkix, glob +import rpki.x509, rpki.manifest, time, POW, POW.pkix, glob, os -def onefile(name): - f = open(name) +def one_cert(filename): + c = rpki.x509.X509(Auto_file = filename) d = POW.Digest(POW.SHA256_DIGEST) - d.update(f.read()) - f.close() - return name.rpartition("/")[2], d.digest() + d.update(c.get_DER()) + return filename.rpartition("/")[2], d.digest() now = time.time() +certs = glob.glob("resource-cert-samples/*.cer") + mani = rpki.manifest.Manifest() mani.set((0, # version 17, # manifestNumber POW.pkix.time2gen(now), # thisUpdate POW.pkix.time2gen(now + 24*60*60), # nextUpdate (2, 16, 840, 1, 101, 3, 4, 2, 1), # id-sha256 - [onefile(i) for i in glob.glob("resource-cert-samples/*.cer")])) - -print mani.get() + [one_cert(i) for i in certs])) -if True: - f = open("manifests.out.der", "w") - f.write(mani.toString()) - f.close() +f = os.popen("dumpasn1 -a - 2>/dev/null", "w") +f.write(mani.toString()) +f.close() |