summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guile/email-key-rotation/dkim.scm20
1 files changed, 12 insertions, 8 deletions
diff --git a/guile/email-key-rotation/dkim.scm b/guile/email-key-rotation/dkim.scm
index 7cc879d..69c1a74 100644
--- a/guile/email-key-rotation/dkim.scm
+++ b/guile/email-key-rotation/dkim.scm
@@ -48,24 +48,26 @@
(lambda ()
(sxml-match
sxml
+ ;; Guile removes newlines in attributes, so we preserve them by
+ ;; saving the keys as uri-encoded strings.
((https://planete-kraus.eu/ns/email-key-rotation:key
(@ (current-selector ,current-selector)
- (current-private-key ,current-private-key)
- (expired-private-key ,expired-private-key))
+ (current-private-key ,current-private-key-encoded)
+ (expired-private-key ,expired-private-key-encoded))
(https://planete-kraus.eu/ns/email-key-rotation:next-selector
(@ (name ,next-selectors))) ...)
(make-key (string->symbol current-selector)
(map string->symbol next-selectors)
- current-private-key
- expired-private-key))
+ (uri-decode current-private-key-encoded)
+ (uri-decode expired-private-key-encoded)))
((https://planete-kraus.eu/ns/email-key-rotation:key
(@ (current-selector ,current-selector)
- (current-private-key ,current-private-key))
+ (current-private-key ,current-private-key-encoded))
(https://planete-kraus.eu/ns/email-key-rotation:next-selector
(@ (name ,next-selectors))) ...)
(make-key (string->symbol current-selector)
(map string->symbol next-selectors)
- current-private-key
+ (uri-decode current-private-key-encoded)
#f))))))
(define (key->sxml key)
@@ -88,9 +90,11 @@
`(next-selector (@ (name ,(symbol->string s)))))
next-selectors)))
`(key (@ (current-selector ,current-selector)
- (current-private-key ,current-private-key)
+ (current-private-key
+ ,(uri-encode current-private-key))
,@(if expired-private-key
- `((expired-private-key ,expired-private-key))
+ `((expired-private-key
+ ,(uri-encode expired-private-key)))
'()))
,@next-selectors)))))))