Blame tests/ec-check-privkey.softhsm
|
Packit |
6b81fa |
#!/bin/sh
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
# Copyright (C) 2015 Nikos Mavrogiannopoulos
|
|
Packit |
6b81fa |
# Copyright (C) 2019 Anderson Toshiyuki Sasaki
|
|
Packit |
6b81fa |
# Copyright (C) 2019 Red Hat, Inc.
|
|
Packit |
6b81fa |
#
|
|
Packit |
6b81fa |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
6b81fa |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
6b81fa |
# the Free Software Foundation, either version 3 of the License, or
|
|
Packit |
6b81fa |
# (at your option) any later version.
|
|
Packit |
6b81fa |
#
|
|
Packit |
6b81fa |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
6b81fa |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6b81fa |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
6b81fa |
# GNU General Public License for more details.
|
|
Packit |
6b81fa |
#
|
|
Packit |
6b81fa |
# You should have received a copy of the GNU General Public License
|
|
Packit |
6b81fa |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
outdir="output.$$"
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
# Load common test functions
|
|
Packit |
6b81fa |
. ${srcdir}/ec-no-pubkey.sh
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
sed -e "s|@MODULE_PATH@|${MODULE}|g" -e "s|@ENGINE_PATH@|../src/.libs/pkcs11.so|g" <"${srcdir}/engines.cnf.in" >"${outdir}/engines.cnf"
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
export OPENSSL_ENGINES="../src/.libs/"
|
|
Packit |
6b81fa |
PRIVATE_KEY="pkcs11:token=libp11-test;id=%01%02%03%04;object=server-key;type=private;pin-value=1234"
|
|
Packit |
6b81fa |
CERTIFICATE="${outdir}/ec-cert.pem"
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
./check-privkey ${CERTIFICATE} ${PRIVATE_KEY} ${MODULE} "${outdir}/engines.cnf"
|
|
Packit |
6b81fa |
if test $? != 0;then
|
|
Packit |
6b81fa |
echo "The private key loading couln't get the public key from the certificate"
|
|
Packit |
6b81fa |
exit 1;
|
|
Packit |
6b81fa |
fi
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
rm -rf "$outdir"
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
exit 0
|