Open
Description
xxd is hard to get in distributions like CentOS.
Maybe it's better to include an alternative functionality like this:
hex2string() {
MyRun=true
while $MyRun; do
if [ ! -z "$1" ]; then
MyPart=$1
MyRun=false
else
read MyPart
MyTest=$?
if [ $MyTest -ne 0 ]; then
MyRun=false
fi
fi
I=0
while [ $I -lt ${#MyPart} ];
do
echo -en "\x"${MyPart:$I:2}
let "I += 2"
done
done
}
The usage is for example in the function key_get_modulus():
#sed -e 's/^Modulus=//' < "$OPENSSL_OUT" \
# | xxd -r -p \
# | base64url
sed -e 's/^Modulus=//' < "$OPENSSL_OUT" \
| hex2string \
| base64url