key.1 dsig.1 cookie.1 catcrypt.1 catsign.1 hashsum.1 mkphrase.1 \
keyring.5 pixie.1
+## --- Prime group keyring ---
+
+pkgdata_DATA = pgroups.kr
+
+$(srcdir)/pgroups.kr: ptab.in mkpgroups
+ cd $(srcdir) && rm -f pgroups.kr && ./mkpgroups <ptab.in
+
## --- Other handy definitions ---
EXTRA_DIST = \
Makefile.m4 genmodes gengctab $(man_MANS) xpixie \
group-test.c rsa-test.c \
ectab.in ec-gentab.awk \
- ptab.in p-gentab.awk \
+ ptab.in p-gentab.awk mkpgroups pgroups.kr \
bintab.in bin-gentab.awk \
README.cipher README.hash README.random README.mp \
debian/rules debian/copyright debian/control debian/changelog \
TESTS = serpent-check bittest testprogs
CLEANFILES = \
- *.t$(EXEEXT) *.to \
+ *.t$(EXEEXT) *.to *.kr.old \
mptypes.h primetab.c primetab.h ectab.c ptab.c bintab.c \
addsuffix(`gen_tables', `-tab.h')
MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.am \
$(srcdir)/getdate.c getdate.c \
+ $(srcdir)/pgroups.kr \
$(MODES) modes-stamp $(srcdir)/modes-stamp
##----- That's all, folks ---------------------------------------------------
--- /dev/null
+#! /usr/bin/python
+
+import catacomb as C
+import mLib as M
+from sys import stdin
+
+kf = C.KeyFile('pgroups.kr', C.KOPEN_WRITE)
+
+for line in stdin:
+ line = line.strip()
+ if line == '' or (line.startswith('#') and not line.startswith('#:')):
+ continue
+ F = line.split()
+ if F[0] == 'group':
+ name = F[1]
+ if not name.startswith('catacomb'):
+ continue
+ def snarf(what):
+ F = stdin.next().split()
+ assert F[0] == what
+ return F[1]
+ p = C.MP(snarf('p'))
+ q = C.MP(snarf('q'))
+ g = C.MP(snarf('g'))
+ ff = []
+ while True:
+ F = stdin.next().split()
+ if not F or F[0] != '#:factor':
+ break
+ ff.append(C.MP(F[1]))
+ seed = C.rmd160().hash(name).done()
+ k = kf.newkey(C.ReadBuffer(seed).getu32(), 'dh-param')
+ k.tag = name
+ k.data = C.KeyDataStructured({
+ 'p': C.KeyDataMP(p, 'shared'),
+ 'q': C.KeyDataMP(q, 'shared'),
+ 'g': C.KeyDataMP(g, 'shared')
+ })
+ k.attr['factor'] = ', '.join([f.tostring() for f in ff])
+ k.attr['genseed'] = M.base64_encode(seed)
+ k.attr['seedalg'] = 'rmd160-mgf'
+kf.save()