Generate 2022 keys automatically
This commit is contained in:
parent
7189f4b227
commit
427906a6f3
@ -228,22 +228,12 @@ install_select(){
|
|||||||
|
|
||||||
install_prepare_password(){
|
install_prepare_password(){
|
||||||
if is_2022_cipher "${shadowsockscipher}"; then
|
if is_2022_cipher "${shadowsockscipher}"; then
|
||||||
local key_size default_key
|
local key_size
|
||||||
key_size=$(get_2022_key_size "${shadowsockscipher}")
|
key_size=$(get_2022_key_size "${shadowsockscipher}")
|
||||||
default_key=$(generate_2022_key "${key_size}")
|
shadowsockspwd=$(generate_2022_key "${key_size}")
|
||||||
while true
|
|
||||||
do
|
|
||||||
echo "Please enter base64 key for ${shadowsockscipher}"
|
|
||||||
read -r -p "(Default key: ${default_key}):" shadowsockspwd
|
|
||||||
[ -z "${shadowsockspwd}" ] && shadowsockspwd="${default_key}"
|
|
||||||
if is_valid_2022_key "${shadowsockspwd}" "${key_size}"; then
|
|
||||||
echo
|
echo
|
||||||
echo "password = ${shadowsockspwd}"
|
echo "password = ${shadowsockspwd}"
|
||||||
echo
|
echo
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo -e "[${red}Error${plain}] ${shadowsockscipher} requires a base64 key decoded to ${key_size} bytes"
|
|
||||||
done
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user