aboutsummaryrefslogtreecommitdiff
path: root/scripts/manifests.py
blob: 5ea6f92445a6b8682024cb2ac5abc1fcc4e38e24 (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
# $Id$

import rpki.x509, rpki.manifest, time, POW, POW.pkix, glob

def onefile(name):
  f = open(name)
  d = POW.Digest(POW.SHA256_DIGEST)
  d.update(f.read())
  f.close()
  return name.rpartition("/")[2], d.digest()

now = time.time()

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()

if True:
  f = open("manifests.out.der", "w")
  f.write(mani.toString())
  f.close()