8 _, name, plen, qlen, seed = argv
13 seed = C.rmd160().hash(name).done()
15 seed = M.base64_decode(seed)
16 rng = C.rmd160_mgfrand(seed)
18 dhi, ff = C.DHInfo.genlimlee(plen, qlen, rng = rng)
20 kf = C.KeyFile(environ.get('TMPDIR', '/tmp') + 'keyring', C.KOPEN_WRITE)
21 id = C.ReadBuffer(seed).getu32()
22 k = kf.newkey(id, 'dh-param')
23 k.data = C.KeyDataStructured({'p': C.KeyDataMP(dhi.p, 'shared'),
24 'q': C.KeyDataMP(dhi.r, 'shared'),
25 'g': C.KeyDataMP(dhi.g, 'shared')})
26 k.attr['factor'] = ', '.join([str(f) for f in ff])
27 k.attr['genseed'] = M.base64_encode(seed)
28 k.attr['seedalg'] = 'rmd160-mgf'
31 buf = C.ReadBuffer(buf)
36 fprhex = '-'.join(['%x' % w for w in words(h.done())])
38 print '# --- %s ---' % name
40 print '# keyid = %x' % id
41 print '# seed = %s' % M.base64_encode(seed)
42 print '# fingerprint = %s' % fprhex
44 print 'group %s' % name
48 for f in ff: print '#:factor %s' % f