blob: cb618edee3e3c56a9c395637c4a1931ec6bcd6ca (
plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <u.h>
#include <libc.h>
#include <mp.h>
#include <libsec.h>
void
usage(void)
{
fprint(2, "usage: auth/dsagen [-t 'attr=value attr=value ...']\n");
exits("usage");
}
void
main(int argc, char **argv)
{
char *s;
char *tag;
DSApriv *key;
tag = nil;
key = nil;
fmtinstall('B', mpfmt);
ARGBEGIN{
case 't':
tag = EARGF(usage());
break;
default:
usage();
}ARGEND
if(argc != 0)
usage();
key = dsagen(nil);
s = smprint("key proto=dsa %s%sp=%lB q=%lB alpha=%lB key=%lB !secret=%lB\n",
tag ? tag : "", tag ? " " : "",
key->pub.p, key->pub.q, key->pub.alpha, key->pub.key,
key->secret);
if(s == nil)
sysfatal("smprint: %r");
if(write(1, s, strlen(s)) != strlen(s))
sysfatal("write: %r");
exits(nil);
}
|