     (catch Exception _
       false)))
 
+(defn extension?
+  "Returns true if the given map contains all the fields required to define an
+  extension."
+  [x]
+  (and (map? x)
+       (string? (:oid x))
+       (not (nil? (:critical x)))
+       (not (nil? (:value x)))))
+
 (defn keypair?
   "Returns true if x is a keypair (see `generate-key-pair`)."
   [x]

             (certificate-request? ext-container)
             (instance? List ext-container))
         (string? oid)]
   :post [(map? %)]}
  (-> (ExtensionsUtils/getExtension (javaize ext-container) oid)
      clojureize))


          (instance? Date not-after)
          (valid-x500-name? subject-dn)
          (public-key? subject-pub-key)
          (sequential? extensions)
          (every? extension? extensions)]
    :post [(certificate? %)]}
   (CertificateAuthority/signCertificate
     issuer-dn issuer-priv-key (biginteger serial) not-before not-after subject-dn
