         key-size (count k-byte-array)]
     (if (= curve-size key-size)
       (let [middle (int (/ key-size 2))
-            kf (KeyFactory/getInstance (name algorithm) BouncyCastleProvider/PROVIDER_NAME)
+            kf (KeyFactory/getInstance (name algorithm) security-provider)
             spec (ECPublicKeySpec. (ECPoint. (java.math.BigInteger. 1 (Arrays/copyOfRange k-byte-array (int 0) middle))
                                              (java.math.BigInteger. 1 (Arrays/copyOfRange k-byte-array middle key-size)))
                                    (ECNamedCurveSpec. curve-name curve (.getG parameter-spec) (.getN parameter-spec)

        “ephemeral”.
  Returns
        Result (Key): The key object"
  [{:keys [algorithm curve ephemeral]}]
  (let [generator (-> algorithm
                      name
                      (KeyPairGenerator/getInstance BouncyCastleProvider/PROVIDER_NAME))
        param-specs (-> curve name ECNamedCurveTable/getParameterSpec)]
    (.initialize generator param-specs (SecureRandom.))
    (.generateKeyPair generator)))

        (bool): verification successful or not"
  [pub-key signature ^bytes digest {:keys [algorithm]}]
  (doto (Signature/getInstance (name algorithm))
    (.initVerify pub-key) ;; Reflection warning! - pub-key type is unknown :(
    (.update digest)
    (.verify signature)))

