Compare commits
4 commits
b6c02292e2
...
fa32b2bf37
Author | SHA1 | Date | |
---|---|---|---|
|
fa32b2bf37 | ||
|
f41678fb72 | ||
|
9fcb2c0c54 | ||
|
0bbd07e074 |
1 changed files with 4 additions and 8 deletions
12
functions
12
functions
|
@ -10,22 +10,18 @@ get_stack () {
|
|||
generate_private_key () {
|
||||
test -f "$private_key" && return 1
|
||||
|
||||
ssh-keygen -t ecdsa -f "$private_key" -N "" -m PEM
|
||||
ssh-keygen -t ecdsa -f "$private_key" -N "" -C "$@"
|
||||
}
|
||||
|
||||
# Firmar el archivo usando la llave privada.
|
||||
#
|
||||
# Uso: sign_file archivo.json
|
||||
# Devuelve: archivo.json.sign
|
||||
# Devuelve: La firma
|
||||
sign_file () {
|
||||
local _file="$1"
|
||||
|
||||
test ! -f "$_file" && return 1
|
||||
test -f "$_file.sig" || ssh-keygen -Y sign -f ~/.ssh/id_ed25519 -n file "$_file" 2>&1 >/dev/null
|
||||
|
||||
if ! openssl dgst -sha512 -sign "$private_key" "$_file" | base64 | tr -d "\n" > "$_file.sign" ; then
|
||||
rm -f "$_file.sign"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$_file.sign"
|
||||
cat "${_file}.sig" | grep -v SIGNATURE | tr -d "\n"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue