Skip to content
Snippets Groups Projects

sellar.bat para sellar desde ms-windows

Open Rafael Bidegain requested to merge rbidegain/contrib:undefined into master
1 file
+ 51
0
Compare changes
  • Side-by-side
  • Inline
sellar.bat 0 → 100644
+ 51
0
@echo off
rem sellar.bat
rem sella un archivo en la BFA
rem Autor: Rafael Bidegain rbidegain@loteriadelaciudad.gob.ar
rem 04 de mayo de 2021
rem Licencia GPLv2-only
rem Este script fue dessarrollado observando tsa2.sh de Robert Martin-Legene
rem
rem controlo la llamada al verificar.bat tenga un parametro
if [%1]==[] (
echo falta el archivo para sellar
echo sellar file.xml
goto fin
)
rem controlo el parametro corresponda a un archivo que existe
IF NOT EXIST %1 (
echo no existe el archivo [%1] para sellar
goto fin
)
rem elimino el archivo sha.txt usado en otra oportunidad
IF EXIST sha.txt (
del sha.txt
)
rem obtengo el hash sha256 del archivo y lo guardo en sha.txt
bin\sha256sum %1 | bin\awk "{print $1}" > sha.txt
rem seteo la variable SHA con el hash sha256 del archivo
set /p SHA=<sha.txt
rem controlo la variable SHA
if [%SHA%]==[] (
echo fallo al generar el hash sha256.
goto fin
)
rem creo el archivo sellar.json
echo {"hashes":["%SHA%"]} > sellar.json
rem sello el archivo enviando el hash sha256
bin\curl --header "Content-Type: application/json" --data @sellar.json https://tsa2.buenosaires.gob.ar/stamp
rem envío un salto de linea a la consola
echo.
:fin
\ No newline at end of file
Loading