firmas #7

Open
fauno wants to merge 9 commits from firmas into master
Showing only changes of commit b6c02292e2 - Show all commits

View file

@ -12,3 +12,20 @@ generate_private_key () {
ssh-keygen -t ecdsa -f "$private_key" -N "" -m PEM
}
# Firmar el archivo usando la llave privada.
#
# Uso: sign_file archivo.json
# Devuelve: archivo.json.sign
sign_file () {
local _file="$1"
test ! -f "$_file" && return 1
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"
}