diff --git a/README.md b/README.md index c20557a..77be6cf 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,6 @@ A Clojure library for JSON Web Token(JWT) [draft-ietf-oauth-json-web-token-19](h ## License -Copyright © 2014 [uochan](http://twitter.com/uochan) +Copyright © 2015 [uochan](http://twitter.com/uochan) Distributed under the Eclipse Public License, the same as Clojure. diff --git a/project.clj b/project.clj index 279c004..3a8f3c0 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject clj-jwt "0.0.11" +(defproject clj-jwt "0.0.12" :description "Clojure library for JSON Web Token(JWT)" :url "https://github.com/liquidz/clj-jwt" :license {:name "Eclipse Public License" @@ -8,7 +8,7 @@ [org.clojure/data.codec "0.1.0"] [org.bouncycastle/bcprov-jdk15 "1.46"] [crypto-equality "1.0.0"] - [clj-time "0.8.0"]] + [clj-time "0.9.0"]] :profiles {:dev {:dependencies [[midje "1.6.3" :exclusions [org.clojure/clojure]]]}} :plugins [[lein-midje "3.1.3"]]) diff --git a/src/clj_jwt/key.clj b/src/clj_jwt/key.clj index 3a2dd59..ce49b0b 100644 --- a/src/clj_jwt/key.clj +++ b/src/clj_jwt/key.clj @@ -38,7 +38,7 @@ (defn public-key-from-string [key-str & [pass-phrase]] (with-open [r (StringReader. key-str)] - (let [res (pem->key r pass-phrase)] + (when-let [res (pem->key r pass-phrase)] (if (public-key? res) res (.getPublic res))))) diff --git a/test/clj_jwt/key_test.clj b/test/clj_jwt/key_test.clj index 04282eb..3eaa1f9 100644 --- a/test/clj_jwt/key_test.clj +++ b/test/clj_jwt/key_test.clj @@ -45,7 +45,9 @@ (fact "rsa encrypted key with wrong pass phrase from string" (-> "test/files/rsa/3des.key" slurp (public-key-from-string "wrong pass phrase") type) => (throws org.bouncycastle.openssl.EncryptionException)) - ) + + (fact "invalid key string" + (public-key-from-string "foobar") => nil)) (facts "ecdsa public key" (fact "ecdsa public key"