Skip to content
Snippets Groups Projects
Commit db6aeb46 authored by Rafael Bidegain's avatar Rafael Bidegain
Browse files

sellar.bat, para sellar desde ms-windows

parent 2ccda06b
No related branches found
No related tags found
No related merge requests found
@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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment