Add scripts from mblaze/contrib
Directly from tag v6.0, e0733f187b34b21fa8335b9914c29a28fa2e856d.
This commit is contained in:
parent
69e00b6f58
commit
eb605487e5
5 changed files with 111 additions and 2 deletions
28
mblaze/contrib/mencrypt
Executable file
28
mblaze/contrib/mencrypt
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
# mencrypt PLAINMSG - generate a PGP/MIME signed and encrypted message
|
||||
|
||||
[ -f "$1" ] || exit 1
|
||||
|
||||
IFS='
|
||||
'
|
||||
FLAGS=$(maddr -a -h from:to:cc:bcc: "$1" |sort -u |sed 's/^/--recipient=/')
|
||||
|
||||
FROM=$(maddr -a -h from "$1" | sed 1q)
|
||||
[ "$FROM" ] && key="--default-key=$FROM"
|
||||
|
||||
TMPD=$(mktemp -d -t mencrypt.XXXXXX)
|
||||
trap "rm -rf '$TMPD'" INT TERM EXIT
|
||||
|
||||
awk '/^$/,0' "$1" |
|
||||
mmime |
|
||||
gpg2 "$key" --armor --encrypt --sign $FLAGS -o "$TMPD/msg.asc" ||
|
||||
exit $?
|
||||
|
||||
printf 'Version: 1\n' >"$TMPD/version"
|
||||
|
||||
{
|
||||
sed '/^$/q' "$1"
|
||||
printf '#application/pgp-encrypted %s/version\n' "$TMPD"
|
||||
printf '#application/octet-stream %s/msg.asc\n' "$TMPD"
|
||||
} |
|
||||
mmime -t 'multipart/encrypted; protocol="application/pgp-encrypted"'
|
Loading…
Add table
Add a link
Reference in a new issue