devolver la firma
This commit is contained in:
parent
f41678fb72
commit
fa32b2bf37
1 changed files with 3 additions and 6 deletions
|
@ -16,15 +16,12 @@ generate_private_key () {
|
||||||
# Firmar el archivo usando la llave privada.
|
# Firmar el archivo usando la llave privada.
|
||||||
#
|
#
|
||||||
# Uso: sign_file archivo.json
|
# Uso: sign_file archivo.json
|
||||||
# Devuelve: archivo.json.sign
|
# Devuelve: La firma
|
||||||
sign_file () {
|
sign_file () {
|
||||||
local _file="$1"
|
local _file="$1"
|
||||||
|
|
||||||
test ! -f "$_file" && return 1
|
test ! -f "$_file" && return 1
|
||||||
if test -f "$_file.sig" ; then
|
test -f "$_file.sig" || ssh-keygen -Y sign -f ~/.ssh/id_ed25519 -n file "$_file" 2>&1 >/dev/null
|
||||||
echo "$_file.sig"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
LC_ALL=C ssh-keygen -Y sign -f ~/.ssh/id_ed25519 -n file "$_file" 2>&1| grep Write | cut -d " " -f 4
|
cat "${_file}.sig" | grep -v SIGNATURE | tr -d "\n"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue