Compare commits
No commits in common. "fa32b2bf37eef4c894ef8abd623d3e67ab74a47d" and "b6c02292e2c384c915ac116dfe884fc2e626e9a8" have entirely different histories.
fa32b2bf37
...
b6c02292e2
1 changed files with 8 additions and 4 deletions
12
functions
12
functions
|
@ -10,18 +10,22 @@ get_stack () {
|
|||
generate_private_key () {
|
||||
test -f "$private_key" && return 1
|
||||
|
||||
ssh-keygen -t ecdsa -f "$private_key" -N "" -C "$@"
|
||||
ssh-keygen -t ecdsa -f "$private_key" -N "" -m PEM
|
||||
}
|
||||
|
||||
# Firmar el archivo usando la llave privada.
|
||||
#
|
||||
# Uso: sign_file archivo.json
|
||||
# Devuelve: La firma
|
||||
# Devuelve: archivo.json.sign
|
||||
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
|
||||
|
||||
cat "${_file}.sig" | grep -v SIGNATURE | tr -d "\n"
|
||||
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"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue