提交 cf32ad7f 编写于 作者: D Dr. Stephen Henson

Make TSA tests use the noprompt mode of utilities rather than piping

the result into interative utilities.
上级 ad0e4396
...@@ -11,6 +11,9 @@ RANDFILE = $ENV::HOME/.rnd ...@@ -11,6 +11,9 @@ RANDFILE = $ENV::HOME/.rnd
# Extra OBJECT IDENTIFIER info: # Extra OBJECT IDENTIFIER info:
oid_section = new_oids oid_section = new_oids
TSDNSECT = ts_cert_dn
INDEX = 1
[ new_oids ] [ new_oids ]
# Policies used by the TSA tests. # Policies used by the TSA tests.
...@@ -53,36 +56,27 @@ emailAddress = optional ...@@ -53,36 +56,27 @@ emailAddress = optional
[ req ] [ req ]
default_bits = 1024 default_bits = 1024
default_md = sha1 default_md = sha1
distinguished_name = req_distinguished_name distinguished_name = $ENV::TSDNSECT
encrypt_rsa_key = no encrypt_rsa_key = no
prompt = no
# attributes = req_attributes # attributes = req_attributes
x509_extensions = v3_ca # The extentions to add to the self signed cert x509_extensions = v3_ca # The extentions to add to the self signed cert
string_mask = nombstr string_mask = nombstr
[ req_distinguished_name ] [ ts_ca_dn ]
countryName = Country Name (2 letter code) countryName = HU
countryName_default = HU stateOrProvinceName = Budapest
countryName_min = 2 localityName = Budapest
countryName_max = 2 organizationName = Gov-CA Ltd.
commonName = ca1
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default =
localityName = Locality Name (eg, city)
0.organizationName = Organization Name (eg, company)
0.organizationName_default =
commonName = Common Name (eg, YOUR name) [ ts_cert_dn ]
commonName_max = 64 countryName = HU
stateOrProvinceName = Budapest
[ req_attributes ] localityName = Buda
challengePassword = A challenge password organizationName = Hun-TSA Ltd.
challengePassword_min = 4 commonName = tsa$ENV::INDEX
challengePassword_max = 20
unstructuredName = An optional company name
[ tsa_cert ] [ tsa_cert ]
...@@ -138,7 +132,7 @@ dir = . # TSA root directory ...@@ -138,7 +132,7 @@ dir = . # TSA root directory
serial = $dir/tsa_serial # The current serial number (mandatory) serial = $dir/tsa_serial # The current serial number (mandatory)
signer_cert = $dir/tsa_cert1.pem # The TSA signing certificate signer_cert = $dir/tsa_cert1.pem # The TSA signing certificate
# (optional) # (optional)
certs = $dir/demoCA/cacert.pem# Certificate chain to include in reply certs = $dir/tsaca.pem # Certificate chain to include in reply
# (optional) # (optional)
signer_key = $dir/tsa_key1.pem # The TSA private key (optional) signer_key = $dir/tsa_key1.pem # The TSA private key (optional)
......
...@@ -39,36 +39,29 @@ clean_up_dir () { ...@@ -39,36 +39,29 @@ clean_up_dir () {
create_ca () { create_ca () {
echo "Creating a new CA for the TSA tests..." echo "Creating a new CA for the TSA tests..."
/bin/rm -fr demoCA TSDNSECT=ts_ca_dn
$SH ../../apps/CA.sh -newca <<EOF export TSDNSECT
../../util/shlib_wrap.sh ../../apps/openssl req -new -x509 -nodes \
HU -out tsaca.pem -keyout tsacakey.pem
Budapest
Budapest
Gov-CA Ltd.
ca1
EOF
test $? != 0 && error test $? != 0 && error
} }
create_tsa_cert () { create_tsa_cert () {
INDEX=$1 INDEX=$1
export INDEX
EXT=$2 EXT=$2
../../util/shlib_wrap.sh ../../apps/openssl req -new -out tsa_req${INDEX}.pem -keyout tsa_key${INDEX}.pem <<EOF TSDNSECT=ts_cert_dn
HU export TSDNSECT
Budapest
Buda
Hun-TSA Ltd.
tsa${INDEX}
EOF
test $? != 0 && error
../../util/shlib_wrap.sh ../../apps/openssl ca -in tsa_req${INDEX}.pem -out tsa_cert${INDEX}.pem \ ../../util/shlib_wrap.sh ../../apps/openssl req -new \
-extensions $EXT <<EOF -out tsa_req${INDEX}.pem -keyout tsa_key${INDEX}.pem
y test $? != 0 && error
y echo Using extension $EXT
EOF ../../util/shlib_wrap.sh ../../apps/openssl x509 -req \
-in tsa_req${INDEX}.pem -out tsa_cert${INDEX}.pem \
-CA tsaca.pem -CAkey tsacakey.pem -CAcreateserial \
-extfile $OPENSSL_CONF -extensions $EXT
test $? != 0 && error test $? != 0 && error
} }
...@@ -128,10 +121,10 @@ time_stamp_response_token_test () { ...@@ -128,10 +121,10 @@ time_stamp_response_token_test () {
verify_time_stamp_response () { verify_time_stamp_response () {
../../util/shlib_wrap.sh ../../apps/openssl ts -verify -queryfile $1 -in $2 -CAfile demoCA/cacert.pem \ ../../util/shlib_wrap.sh ../../apps/openssl ts -verify -queryfile $1 -in $2 -CAfile tsaca.pem \
-untrusted tsa_cert1.pem -untrusted tsa_cert1.pem
test $? != 0 && error test $? != 0 && error
../../util/shlib_wrap.sh ../../apps/openssl ts -verify -data $3 -in $2 -CAfile demoCA/cacert.pem \ ../../util/shlib_wrap.sh ../../apps/openssl ts -verify -data $3 -in $2 -CAfile tsaca.pem \
-untrusted tsa_cert1.pem -untrusted tsa_cert1.pem
test $? != 0 && error test $? != 0 && error
} }
...@@ -142,16 +135,16 @@ verify_time_stamp_token () { ...@@ -142,16 +135,16 @@ verify_time_stamp_token () {
../../util/shlib_wrap.sh ../../apps/openssl ts -reply -in $2 -out $2.token -token_out ../../util/shlib_wrap.sh ../../apps/openssl ts -reply -in $2 -out $2.token -token_out
test $? != 0 && error test $? != 0 && error
../../util/shlib_wrap.sh ../../apps/openssl ts -verify -queryfile $1 -in $2.token -token_in \ ../../util/shlib_wrap.sh ../../apps/openssl ts -verify -queryfile $1 -in $2.token -token_in \
-CAfile demoCA/cacert.pem -untrusted tsa_cert1.pem -CAfile tsaca.pem -untrusted tsa_cert1.pem
test $? != 0 && error test $? != 0 && error
../../util/shlib_wrap.sh ../../apps/openssl ts -verify -data $3 -in $2.token -token_in \ ../../util/shlib_wrap.sh ../../apps/openssl ts -verify -data $3 -in $2.token -token_in \
-CAfile demoCA/cacert.pem -untrusted tsa_cert1.pem -CAfile tsaca.pem -untrusted tsa_cert1.pem
test $? != 0 && error test $? != 0 && error
} }
verify_time_stamp_response_fail () { verify_time_stamp_response_fail () {
../../util/shlib_wrap.sh ../../apps/openssl ts -verify -queryfile $1 -in $2 -CAfile demoCA/cacert.pem \ ../../util/shlib_wrap.sh ../../apps/openssl ts -verify -queryfile $1 -in $2 -CAfile tsaca.pem \
-untrusted tsa_cert1.pem -untrusted tsa_cert1.pem
# Checks if the verification failed, as it should have. # Checks if the verification failed, as it should have.
test $? = 0 && error test $? = 0 && error
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册