            [org.bouncycastle.jcajce.provider.asymmetric.ec KeyPairGeneratorSpi$ECDSA
             BCECPrivateKey BCECPublicKey]
            [org.bouncycastle.util.encoders Hex]
+           [java.io FileInputStream]
            [java.util Arrays]
+           [javax.crypto Cipher SecretKeyFactory]
            [javax.crypto.spec SecretKeySpec]
-           [javax.crypto SecretKeyFactory]
-           [java.security KeyFactory KeyPairGenerator SecureRandom Security MessageDigest]
+           [java.security Key KeyStore KeyFactory KeyPairGenerator SecureRandom
+            Security MessageDigest Signature]
            [java.security.spec ECPoint ECParameterSpec ECPublicKeySpec ECPrivateKeySpec])
   (:refer-clojure :exclude [hash]))
 


;; Add provider!
(Security/addProvider (BouncyCastleProvider.))

;;;generate_key
(defn generate-key

        (Key) An instance of the Key class corresponding to the ski"
  [msg {:keys [algorithm]}]
  (let [md (MessageDigest/getInstance (name algorithm))]
    (->> (if (string? msg)
           (.getBytes ^String msg)
           msg)
         (.digest md)
         (Hex/toHexString))))
;;(hash test-msg {:algorithm :sha384})

(defonce cipher-mode-map {:encrypt Cipher/ENCRYPT_MODE
                          :decrypt Cipher/DECRYPT_MODE})

(defn %encrypt-or-decrypt
  ;; https://docs.oracle.com/javase/8/docs/api/javax/crypto/Cipher.html
  [k text {:keys [algorithm cipher-mode]}]
  (let [tname (name algorithm)
        tk (SecretKeySpec. k tname)
        cipher (doto (Cipher/getInstance tname)
                 (.init ^java.lang.Integer (cipher-mode-map cipher-mode) tk))]
    (.doFinal cipher
              (if (string? text)
                (.getBytes ^String text)
                text))))

;;;encrypt
(defn encrypt
