Skip to content

Commit

Permalink
Fixed certificates/not-before to return correct date funcool#64
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianEdwards85 committed Sep 24, 2019
1 parent 65ba5f2 commit dc537b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/buddy/core/certificates.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
(defn not-before
"Returns the first date this certificate is valid."
[cert]
(.getNotAfter cert))
(.getNotBefore cert))

(defn valid-on-date?
"Returns true if certificate is valid date. Defaults to today"
Expand Down
2 changes: 1 addition & 1 deletion test/buddy/core/certificates_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
(certificates/certificate "test/_files/cert.rsa.pem")))))))
(deftest date-handling
(let [expired (certificates/certificate "test/_files/expired-rsa.crt")]
(is (= #inst "2016-12-02T16:18:40.000-00:00" (certificates/not-before expired)))
(is (= #inst "2016-12-01T16:18:40.000-00:00" (certificates/not-before expired)))
(is (= #inst "2016-12-02T16:18:40.000-00:00" (certificates/not-after expired)))
(is (not (certificates/valid-on-date? expired)))
(is (certificates/valid-on-date? expired #inst "2016-12-02T16:18:40.000-00:00"))
Expand Down

0 comments on commit dc537b9

Please sign in to comment.