summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2024-01-08 16:55:02 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2024-01-08 16:55:02 +0100
commit1ac50abb2b04b08e8fbcf00070a1d588ea8fbc60 (patch)
tree016fe80a8653d95f58ae180b930d481e3c40d2df
parenta068fc126dd5e76bd41c3cf50a2376427514d612 (diff)
Store the openssl keys in an uri-encoded form0.0.4
-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)))))))