dot

packages and services management
Log | Files | Refs | README

commit 43102aa60c64bafbbbcd634a7e0429ec876f1147
parent 4e4283beb82b7790698fef9f39bd1dfa3fb2ea7b
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sat,  1 Dec 2018 23:44:19 +0100

bin: attempt at encrypting mail with mblaze and gpg

Diffstat:
Abin/gpg-wkd | 6++++++
Mbin/mail-draft | 4++--
Abin/mail-gpg | 32++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/bin/gpg-wkd b/bin/gpg-wkd @@ -0,0 +1,6 @@ +#!/usr/bin/env execlineb + +forbacktickx -n x { + pipeline { gpg -k --with-wkd } + sed -rn "/^uid / { s/.*<([^>]*)>/\\1/; N; s/\\n//; s/^ *//; p; }" +} diff --git a/bin/mail-draft b/bin/mail-draft @@ -18,6 +18,6 @@ ifelse { test ${x} = e } { foreground { ${EDITOR} ${draft} } exit 101 } ifelse { test ${x} = s } { mail-send ${draft} } ifelse { test ${x} = c } { echo mail not sent, draft kept } ifelse { test ${x} = d } { rm -i ${draft} } -ifelse { test ${x} = gs } { if { echo not implemented } exit 101 } -ifelse { test ${x} = ge } { if { echo not implemented } exit 101 } +ifelse { test ${x} = gs } { mail-gpg -s ${draft} } +ifelse { test ${x} = ge } { mail-gpg -e ${draft} } exit 101 diff --git a/bin/mail-gpg b/bin/mail-gpg @@ -0,0 +1,32 @@ +#!/usr/bin/env execlineb +elgetpositionals -P 2 +elgetopt "es" + +define flags $1 +define draft $2 + +backtick -n x { + pipeline { mhdr -d -M -A -h from:to:cc:bcc: ${draft} } + sort -u +} +importas -s recipients x + +if { +} + +fdmove -c 3 1 +if { echo "Version: 1" } + +fdmove -c 4 1 +if { pipeline { sed "1,/^$/ d" } gpg ${flags}a -r${recipients} } + +if { + redirfd -w 1 ${draft}.mime + pipeline { + if { sed "/^$/ { p; q; }" ${draft} } + if { echo "#application/pgp-encrypted /dev/fd/3" } + if { echo "#application/octet-stream /dev/fd/4" } + } + mmime -t "multipart/encrypted; protocol=\"application/pgp-encrypted\"" +} +mv ${draft}.mime ${draft}