bash script for converting OpenSSH keys to Tectia format and vice versa.
#!/bin/bash
# Usage instructions
menu="
Make your choice:
1. Convert OpenSSH key to Tectia format
2. Convert Tectia key to OpenSSH format
3. Exit"
while :
do
printf "%s\n: " "$menu"
read choice
case $choice in
"1")
echo "Converting OpenSSH key to Tectia format"
echo "Enter the full path to the input key file:"
read input_path
if [ -f "$input_path" ]; then
ssh-keygen -e -f "$input_path" > "${input_path}.tectia"
echo "Tectia format key is saved as: ${input_path}.tectia"
else
echo "Input file does not exist."
fi
;;
"2")
echo "Converting Tectia key to OpenSSH format"
echo "Enter the full path to the input key file:"
read input_path
if [ -f "$input_path" ]; then
ssh-keygen -i -f "$input_path" > "${input_path}.openssh"
echo "OpenSSH format key is saved as: ${input_path}.openssh"
else
echo "Input file does not exist."
fi
;;
"3")
echo "Goodbye"
exit 0
;;
*)
echo "Wrong Choice"
;;
esac
done
Leave a Reply