   `:keystore-pw` - a string containing a dynamically generated password for the KeyStore
   `:truststore`  - an instance of KeyStore containing the CA cert."
   [cert private-key ca-cert]
-  {:pre  [cert
-          private-key
-          ca-cert]
+  {:pre  [(not (nil? cert))
+          (not (nil? private-key))
+          (not (nil? ca-cert))]
    :post [(map? %)
           (= #{:keystore :truststore :keystore-pw} (-> % keys set))
           (instance? KeyStore (:keystore %))


  Returns the SSLContext instance."
  [cert private-key ca-cert]
  {:pre  [cert
          private-key
          ca-cert]
   :post [(instance? SSLContext %)]}
  (with-open [cert-reader    (reader cert)
              key-reader     (reader private-key)

  "Given the path to a PEM file (or some other object supported by clojure's `reader`),
  decodes the contents into a collection of `X509Certificate` instances."
  [pem]
  {:pre  [(not (nil? pem))]
   :post [(every? (fn [x] (instance? X509Certificate x)) %)]}
  (with-open [r (reader pem)]
    (CertificateUtils/pemToCerts r)))
