     (bc-ed-public-key)))
 
 (defn- verify-public-key!
-  [priv pub]
+  [^BCEdDSAPrivateKey priv ^BCEdDSAPublicKey pub]
   ;; Check for incorrect public key
   (let [pub-buf (.getEncoded pub)
         pub2-buf (-> (.getPublicKey priv) (.getEncoded))]

                                           Ed448PrivateKeyParameters Ed448PublicKeyParameters
                                           AsymmetricKeyParameter)
           (org.bouncycastle.jcajce.provider.asymmetric.edec BCEdDSAPrivateKey BCEdDSAPublicKey)
           (java.util Arrays)))

(defn- construct
  [cls params]
  ; HACK: These constructors are not public
  (let [cons (vec (.getDeclaredConstructors cls))
        ctor (first (filter #(and
                               (= 1 (.getParameterCount %))
                               (= AsymmetricKeyParameter (aget (.getParameterTypes %) 0)))
                      cons))]
    (when-not (some? ctor)
      (throw (UnsupportedOperationException. "Can not get key constructor")))

    (.newInstance ctor (to-array [params]))))

(defn pkcs8-key
  [^bytes encoded len]
  (let [offset (if (and (= len 57)
                     (not= 73 (count encoded)))
                 17 16)]
    (Arrays/copyOfRange encoded offset ^Integer (+ offset len))))

(defn x509-key
  [^bytes encoded len]
  (Arrays/copyOfRange encoded 12 ^Integer (+ 12 len)))

(defn bc-ed-private-key
  [params]
