trsafill.c - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
trsafill.c (754B)
---
1 #include <u.h>
2 #include <libc.h>
3 #include <auth.h>
4 #include <mp.h>
5 #include <libsec.h>
6 #include "rsa2any.h"
7
8 void
9 usage(void)
10 {
11 fprint(2, "usage: auth/rsafill [file]\n");
12 exits("usage");
13 }
14
15 void
16 main(int argc, char **argv)
17 {
18 RSApriv *key;
19 Attr *a;
20 char *s;
21
22 fmtinstall('A', _attrfmt);
23 fmtinstall('B', mpfmt);
24 quotefmtinstall();
25
26 ARGBEGIN{
27 default:
28 usage();
29 }ARGEND
30
31 if(argc > 1)
32 usage();
33
34 if((key = getkey(argc, argv, 1, &a)) == nil)
35 sysfatal("%r");
36
37 s = smprint("key %A size=%d ek=%lB !dk=%lB n=%lB !p=%lB !q=%lB !kp=%lB !kq=%lB !c2=%lB\n",
38 a,
39 mpsignif(key->pub.n), key->pub.ek,
40 key->dk, key->pub.n, key->p, key->q,
41 key->kp, key->kq, key->c2);
42 if(s == nil)
43 sysfatal("smprint: %r");
44 write(1, s, strlen(s));
45 exits(nil);
46 }