test_engine.sh

来自「读写Smart卡加解密接口的程序」· Shell 代码 · 共 60 行

SH
60
字号
#!/bin/bash# command line parameter overrides engine to test, opensc or pkcs11# Organization name embedded below (e.g, MTPPI) must match ca key for ca signing to workENGINE=pkcs11if [[ -ne $1 ]] ;then ENGINE=$1;fi;if [[ $ENGINE == "pkcs11" ]];then POSTCMD="-pre MODULE_PATH:../pkcs11/.libs/opensc-pkcs11.so" ;echo;fi;# self-signed certificate has a locking problem, don't try yet....openssl << EOTengine dynamic -vvvv -pre SO_PATH:.libs/engine_${ENGINE}.so -pre ID:${ENGINE} -pre NO_VCHECK:1 -pre LIST_ADD:1 -pre LOAD ${POSTCMD}req -engine ${ENGINE} -new -x509 -key 45 -keyform engine -out /tmp/selfcert.crt -textUSMarylandBethesdaMTPPIOrganizational UnitCommon Nameemail@example.comEOTif [[ $? -ne 0 ]] ;then echo "Error generating self-signed cert"  exit 1;fi;#generate certificate request# note that the test_engine.openssl has values for certificate info. # company name needs to match ca certificate used to sign (below).openssl << EOTengine dynamic -vvvv -pre SO_PATH:.libs/engine_${ENGINE}.so -pre ID:${ENGINE} -pre NO_VCHECK:1 -pre LIST_ADD:1 -pre LOAD ${POSTCMD}req -engine ${ENGINE} -md5 -new -key 45 -keyform engine -out /tmp/cert.md5.crq -textUSMarylandBethesdaMTPPIOrganizational UnitCommon Nameemail@example.comEOTif [[ $? -ne 0 ]] ;then echo "Error generating cert request"  exit 1;fi;# sign certificate, assumes ca configuredopenssl ca -in /tmp/cert.md5.crq -out /tmp/test.crt || (echo "Error signing certificate" && exit 1)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?