forked from autocrypt/protected-headers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (54 loc) · 1.95 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/make -f
draft = draft-protected-headers
OUTPUT = $(draft).txt $(draft).html $(draft).xml $(draft).pdf
vectors = $(shell ./generate-test-vectors list-vectors)
vectordata = $(foreach x,$(vectors), $(x).eml)
innerdata = $(foreach x, $(shell ./generate-test-vectors list-vectors | grep -vx -e pgpmime-signed -e smime-multipart-signed), $(x).inner) smime-sign+enc.inner.inner smime-sign+enc+legacy-disp.inner.inner
email_body = awk '{ if (body) print $$0 } /^$$/{ body=1 }'
all: $(OUTPUT)
%.xmlv2: %.md
kramdown-rfc2629 < $< > [email protected]
mv [email protected] $@
%.xml: %.xmlv2
xml2rfc --v2v3 -o $@ $<
%.html: %.xml
xml2rfc $< --html
%.pdf: %.xml
xml2rfc $< --pdf
%.txt: %.xml
xml2rfc $< --text
$(draft).md: $(draft).in.md assemble $(vectordata) $(innerdata)
./assemble < $< >[email protected]
mv [email protected] $@
%.eml: generate-test-vectors
./generate-test-vectors $* >[email protected]
mv [email protected] $@
%.inner: %.eml
./extract-inner < $< > [email protected]
mv [email protected] $@
smime-onepart-signed.inner: smime-onepart-signed.eml
$(email_body) < $< | base64 -d | certtool --p7-info --p7-show-data --inraw > [email protected]
fromdos [email protected]
mv [email protected] $@
smime-%.inner: smime-%.eml gpghome
printf -- '-----BEGIN PKCS7-----\n%s-----END PKCS7-----\n' "$$($(email_body) < $< )" | gpgsm --batch --homedir gpghome --output [email protected] --decrypt
fromdos [email protected]
mv [email protected] $@
%.inner.inner: %.inner
$(email_body) < $< | base64 -d | certtool --p7-info --p7-show-data --inraw > [email protected]
fromdos [email protected]
mv [email protected] $@
gpghome: bob.p12
mkdir -p [email protected]
touch [email protected]/passwd
gpgsm --batch --disable-dirmngr --quiet --homedir [email protected] --import --pinentry-mode loopback --passphrase-fd 4 4<[email protected]/passwd bob.p12
mv [email protected] $@
clean:
-rm -rf $(OUTPUT) metadata.min.js *.tmp gpghome
check: draft-protected-headers.txt
echo "checking for overlong lines..."
! egrep '.{73,}' < draft-protected-headers.txt
./test-notmuch
mypy --strict generate-test-vectors
.PHONY: clean all check
.SECONDARY: $(vectordata) draft-protected-headers.md $(innerdata)