Mercurial > hg > paul
view bin/decrypt @ 4:1641fdbc1809 default tip
sic
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Tue, 18 Aug 2026 15:39:39 +0100 |
| parents | 2aa53823fb21 |
| children |
line wrap: on
line source
#!/bin/bash # usage: decrypt [-p passwd] [-m method] keyFile xmlFile # If no passwd, will prompt # method defaults to pkcs12 method=pkcs12 while [ "x$1" != "x${1##-}" ] do case "$1" in -p) passwd="$2"; shift; shift ;; -m) method=$2; shift; shift ;; *) echo bad switch "$1" -- usage: decrypt [-p passwd] [-m method] keyFile xmlFile; exit 1 ;; esac done if [ $# -gt 0 ] then keyfile="$1" shift else echo keyFile required -- usage: decrypt [-p passwd] [-m method] keyFile xmlFile; exit 1 fi if [ $# -gt 0 ] then xmlfile="$1" else xmlfile=/tmp/dec$$ cat > $xmlfile cl="t" fi pwd=${passwd:-`read -s -p "Password for $keyfile: " pw && echo $pw`} kf="`cygpath -w \"$keyfile\"`" xf="`cygpath -w \"$xmlfile\"`" /c/Program\ Files/xmlsec/xmlsec decrypt --$method "$kf" --pwd "$pwd" "$xf" if [ "$cl" ] then rm -f "$xmlfile" fi
