xref: /openbsd-src/regress/usr.bin/openssl/testrsa.sh (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
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
7cd $1
8
9# Generate RSA private key
10openssl genrsa -out rsakey.pem
11if [ $? != 0 ]; then
12        exit 1;
13fi
14
15
16# Generate an RSA certificate
17openssl req -config $2/openssl.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem
18if [ $? != 0 ]; then
19        exit 1;
20fi
21
22
23# Now check the certificate
24openssl x509 -text -in rsacert.pem
25if [ $? != 0 ]; then
26        exit 1;
27fi
28
29exit 0
30