xref: /minix3/crypto/external/bsd/openssl/dist/test/testgen (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc#!/bin/sh
2*ebfedea0SLionel Sambuc
3*ebfedea0SLionel SambucT=testcert
4*ebfedea0SLionel SambucKEY=512
5*ebfedea0SLionel SambucCA=../certs/testca.pem
6*ebfedea0SLionel Sambuc
7*ebfedea0SLionel Sambuc/bin/rm -f $T.1 $T.2 $T.key
8*ebfedea0SLionel Sambuc
9*ebfedea0SLionel Sambucif test "$OSTYPE" = msdosdjgpp; then
10*ebfedea0SLionel Sambuc    PATH=../apps\;$PATH;
11*ebfedea0SLionel Sambucelse
12*ebfedea0SLionel Sambuc    PATH=../apps:$PATH;
13*ebfedea0SLionel Sambucfi
14*ebfedea0SLionel Sambucexport PATH
15*ebfedea0SLionel Sambuc
16*ebfedea0SLionel Sambucecho "generating certificate request"
17*ebfedea0SLionel Sambuc
18*ebfedea0SLionel Sambucecho "string to make the random number generator think it has entropy" >> ./.rnd
19*ebfedea0SLionel Sambuc
20*ebfedea0SLionel Sambucif ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
21*ebfedea0SLionel Sambuc  req_new='-newkey dsa:../apps/dsa512.pem'
22*ebfedea0SLionel Sambucelse
23*ebfedea0SLionel Sambuc  req_new='-new'
24*ebfedea0SLionel Sambuc  echo "There should be a 2 sequences of .'s and some +'s."
25*ebfedea0SLionel Sambuc  echo "There should not be more that at most 80 per line"
26*ebfedea0SLionel Sambucfi
27*ebfedea0SLionel Sambuc
28*ebfedea0SLionel Sambucecho "This could take some time."
29*ebfedea0SLionel Sambuc
30*ebfedea0SLionel Sambucrm -f testkey.pem testreq.pem
31*ebfedea0SLionel Sambuc
32*ebfedea0SLionel Sambuc../util/shlib_wrap.sh ../apps/openssl req -config test.cnf $req_new -out testreq.pem
33*ebfedea0SLionel Sambucif [ $? != 0 ]; then
34*ebfedea0SLionel Sambucecho problems creating request
35*ebfedea0SLionel Sambucexit 1
36*ebfedea0SLionel Sambucfi
37*ebfedea0SLionel Sambuc
38*ebfedea0SLionel Sambuc../util/shlib_wrap.sh ../apps/openssl req -config test.cnf -verify -in testreq.pem -noout
39*ebfedea0SLionel Sambucif [ $? != 0 ]; then
40*ebfedea0SLionel Sambucecho signature on req is wrong
41*ebfedea0SLionel Sambucexit 1
42*ebfedea0SLionel Sambucfi
43*ebfedea0SLionel Sambuc
44*ebfedea0SLionel Sambucexit 0
45