9 Commits

Author SHA1 Message Date
f
aca3d0fba1 usar la llave privada 2022-03-14 16:23:45 -03:00
f
fa32b2bf37 devolver la firma 2022-03-12 18:53:48 -03:00
f
f41678fb72 firmar con ssh-keygen 2022-03-12 18:51:52 -03:00
f
9fcb2c0c54 aceptar un comentario como parametro de la funcion 2022-03-12 18:51:29 -03:00
f
0bbd07e074 no es necesario exportar como PEM 2022-03-12 18:51:17 -03:00
f
b6c02292e2 firmar un archivo y devolver el nombre del archivo firmado 2022-03-03 16:34:47 -03:00
f
9ad90339ba generar una llave privada 2022-03-03 16:34:32 -03:00
f
37f3f1586e variable para la llave privada 2022-03-03 16:33:12 -03:00
f
d6d240b6b2 no commitear llaves por error 2022-03-03 16:33:03 -03:00
3 changed files with 20 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
./key
./key.pub

View File

@ -6,5 +6,22 @@ get_stack () {
fi
}
# Generar una llave privada ECDSA si no existe
generate_private_key () {
test -f "$private_key" && return 1
ssh-keygen -t ecdsa -f "$private_key" -N "" -C "$@"
}
# Firmar el archivo usando la llave privada.
#
# Uso: sign_file archivo.json
# Devuelve: La firma
sign_file () {
local _file="$1"
test ! -f "$_file" && return 1
test -f "$_file.sig" || ssh-keygen -Y sign -f "$private_key" -n file "$_file" 2>&1 >/dev/null
cat "${_file}.sig" | grep -v SIGNATURE | tr -d "\n"
}

View File

@ -14,3 +14,4 @@ stack=$install_dir/stack
historical=$install_dir/historical
log=$install_dir/errors.log
corrupt=$install_dir/corrupt
private_key=$install_dir/key