summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2020-06-06 10:39:19 -0400
committerRyan Kavanagh <rak@rak.ac>2020-06-07 11:39:58 -0400
commit25d100abb097adb623c8f0ef4613b178a59cb9dd (patch)
tree9320bc2ada0d45db21d30f6fde897aaf48b4eed2
parentClarify statuses and add preliminary transaction support (diff)
Tentative of connect for tlsutils
-rw-r--r--gemini/tlsUtils.ml16
-rw-r--r--gemini/tlsUtils.mli1
2 files changed, 17 insertions, 0 deletions
diff --git a/gemini/tlsUtils.ml b/gemini/tlsUtils.ml
index 0916185..0ea00ab 100644
--- a/gemini/tlsUtils.ml
+++ b/gemini/tlsUtils.ml
@@ -1,6 +1,7 @@
module type TLS_UTILS =
sig
type authenticator = X509_lwt.authenticator Lwt.t
+ type ciphers = Tls.Ciphersuite.ciphersuite list
val null_auth : authenticator
@@ -9,11 +10,16 @@ sig
val self_sign : ?bits:int -> ?days:int
-> X509.Distinguished_name.t
-> (Tls.Config.certchain, string) result
+
+ (*val connect : authenticator:authenticator -> ?peer_name:string ->
+ ?ciphers:ciphers -> string * int
+ -> (Lwt_io.input_channel * Lwt_io.output_channel) Lwt.t *)
end
module TlsUtils : TLS_UTILS =
struct
type authenticator = X509.Authenticator.t Lwt.t
+ type ciphers = Tls.Ciphersuite.ciphersuite list
let null_auth = Lwt.return (fun ~host:_ -> fun _ -> Ok None)
@@ -36,4 +42,14 @@ struct
(`RSA priv) dnames with
| Ok cert -> Ok ([cert], priv)
| Error _ -> Error "Unable to sign")
+
+ (*let connect authenticator ?peer_name ?(ciphers=Tls.Config.Ciphers.default)
+ (host, port) =
+ let peer_name = match peer_name with
+ | Some name -> name
+ | None -> host in
+ Tls_lwt.connect_ext
+ Tls.Config.(client ~peer_name:peer_name ~authenticator
+ ~ciphers ()) (host, port)
+ *)
end
diff --git a/gemini/tlsUtils.mli b/gemini/tlsUtils.mli
index ba89de7..35a674d 100644
--- a/gemini/tlsUtils.mli
+++ b/gemini/tlsUtils.mli
@@ -1,6 +1,7 @@
module type TLS_UTILS =
sig
type authenticator = X509_lwt.authenticator Lwt.t
+ type ciphers = Tls.Ciphersuite.ciphersuite list
val null_auth : authenticator