Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/src/cmd/auth/rsa2csr.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <bio.h>
4
#include <auth.h>
5
#include <mp.h>
6
#include <libsec.h>
7
#include "rsa2any.h"
8
 
9
void
10
usage(void)
11
{
12
	fprint(2, "usage: aux/rsa2csr 'C=US ...CN=xxx' [key]");
13
	exits("usage");
14
}
15
 
16
void
17
main(int argc, char **argv)
18
{
19
	int len;
20
	uchar *cert;
21
	RSApriv *key;
22
 
23
	fmtinstall('B', mpfmt);
24
	fmtinstall('H', encodefmt);
25
 
26
	ARGBEGIN{
27
	default:
28
		usage();
29
	}ARGEND
30
 
31
	if(argc != 1 && argc != 2)
32
		usage();
33
 
34
	if((key = getkey(argc-1, argv+1, 1, nil)) == nil)
35
		sysfatal("%r");
36
 
37
	cert = X509req(key, argv[0], &len);
38
	if(cert == nil)
39
		sysfatal("X509req: %r");
40
 
41
	write(1, cert, len);
42
	exits(0);
43
}