21 lines
498 B
Bash
21 lines
498 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
. /etc/default/decrypt_pkcs
|
||
|
|
||
|
|
||
|
pkcs15-tool -c 2>/dev/null \
|
||
|
| awk '{ if ($1=="ID")
|
||
|
{nline++ ; printf $NF" "}
|
||
|
else if ($1=="Encoded" && $2=="serial")
|
||
|
{print $NF}}' \
|
||
|
| while read id serial ; do
|
||
|
if [ -f "${DECIPHER_MULTI_FOLDER}/${DECIPHER_MULTI_PATTERN}${serial}.enc" ] ; then
|
||
|
export key="${DECIPHER_MULTI_FOLDER}/${DECIPHER_MULTI_PATTERN}${serial}.enc"
|
||
|
export arg="-k ${id}"
|
||
|
echo ${key} ${arg}
|
||
|
exit 0
|
||
|
fi
|
||
|
done
|
||
|
exit 1
|
||
|
|