Mercurial > hg > paul
diff bin/decrypt @ 0:2aa53823fb21
new repo
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Sat, 06 Jun 2026 10:19:04 +0100 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/decrypt Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,36 @@ +#!/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
