Last active
August 29, 2015 14:26
-
-
Save senior/e454573cc2cc5b5bfca2 to your computer and use it in GitHub Desktop.
mutually authenticated connection code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (ssl-conn-factory ca-cert-path cert-path key-path) | |
(lambda (uri-host uri-port) | |
(let ((ssl-ctx (ssl-make-client-context 'tls))) | |
(ssl-load-certificate-chain! ssl-ctx cert-path) | |
(ssl-load-private-key! ssl-ctx key-path) | |
(ssl-load-suggested-certificate-authorities! ssl-ctx ca-cert-path) | |
(ssl-load-verify-root-certificates! ssl-ctx ca-cert-path) | |
(ssl-set-verify! ssl-ctx #t) | |
(ssl-connect uri-host | |
uri-port | |
ssl-ctx)))) | |
;;... | |
(make-request uri: uri | |
conn-factory: (ssl-conn-factory (hash-table-ref conn-info 'ca) | |
(hash-table-ref conn-info 'cert) | |
(hash-table-ref conn-info 'key)) | |
method: 'GET) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment