change function
This commit is contained in:
parent
07adb23d24
commit
020bcafd10
1 changed files with 23 additions and 7 deletions
30
functions.sh
30
functions.sh
|
@ -741,17 +741,33 @@ fi
|
||||||
#EOF
|
#EOF
|
||||||
|
|
||||||
token-extract-pubkey() {
|
token-extract-pubkey() {
|
||||||
case $1 in
|
if pkcs11-tool --module $PKCS11_MODULE --list-token-slots >&2 ;then
|
||||||
--id|-d|--label|-a)
|
|
||||||
ssh-keygen -i -m pkcs8 -f <(pkcs11-tool --module $PKCS11_MODULE -r --type pubkey $1 $2 |openssl rsa -pubin -inform DER )
|
ssh-keygen -i -m pkcs8 -f <(pkcs11-tool --module $PKCS11_MODULE -r --type pubkey $1 $2 |openssl rsa -pubin -inform DER )
|
||||||
;;
|
if [ $? -gt 0 ] ; then
|
||||||
|
token-list-objects
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Please insert token. Exit"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
# case $1 in
|
||||||
|
# --id|-d|--label|-a)
|
||||||
|
# ssh-keygen -i -m pkcs8 -f <(pkcs11-tool --module $PKCS11_MODULE -r --type pubkey $1 $2 |openssl rsa -pubin -inform DER )
|
||||||
|
# ;;
|
||||||
|
# --login|-l)
|
||||||
|
# ssh-keygen -i -m pkcs8 -f <(pkcs11-tool --module $PKCS11_MODULE --login -r --type pubkey $1 $2 |openssl rsa -pubin -inform DER )
|
||||||
|
# ;;
|
||||||
|
# esac
|
||||||
|
}
|
||||||
|
|
||||||
|
token-list-objects() {
|
||||||
|
case $1 in
|
||||||
--login|-l)
|
--login|-l)
|
||||||
ssh-keygen -i -m pkcs8 -f <(pkcs11-tool --module $PKCS11_MODULE --login -r --type pubkey $1 $2 |openssl rsa -pubin -inform DER )
|
pkcs11-tool --module $PKCS11_MODULE --login --list-objects
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Please specify id or label as used in pkcs11-tool"
|
pkcs11-tool --module $PKCS11_MODULE --list-objects
|
||||||
man pkcs11-tool
|
|
||||||
return 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue