diff options
Diffstat (limited to 'tests/testrsa.sh')
-rwxr-xr-x | tests/testrsa.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/testrsa.sh b/tests/testrsa.sh new file mode 100755 index 0000000..cb4e28d --- /dev/null +++ b/tests/testrsa.sh | |||
@@ -0,0 +1,33 @@ | |||
1 | #!/bin/sh | ||
2 | # $OpenBSD: testrsa.sh,v 1.1 2014/08/26 17:50:07 jsing Exp $ | ||
3 | |||
4 | |||
5 | #Test RSA certificate generation of openssl | ||
6 | |||
7 | cmd=../apps/openssl | ||
8 | |||
9 | if [ -z $srcdir ]; then | ||
10 | srcdir=. | ||
11 | fi | ||
12 | |||
13 | # Generate RSA private key | ||
14 | $cmd genrsa -out rsakey.pem | ||
15 | if [ $? != 0 ]; then | ||
16 | exit 1; | ||
17 | fi | ||
18 | |||
19 | |||
20 | # Generate an RSA certificate | ||
21 | $cmd req -config $srcdir/openssl.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem | ||
22 | if [ $? != 0 ]; then | ||
23 | exit 1; | ||
24 | fi | ||
25 | |||
26 | |||
27 | # Now check the certificate | ||
28 | $cmd x509 -text -in rsacert.pem | ||
29 | if [ $? != 0 ]; then | ||
30 | exit 1; | ||
31 | fi | ||
32 | |||
33 | exit 0 | ||