Giter VIP home page Giter VIP logo

Comments (6)

delitescere avatar delitescere commented on July 24, 2024

👋

from buddy-sign.

tobytripp avatar tobytripp commented on July 24, 2024

Hi @delitescere !!

from buddy-sign.

tobytripp avatar tobytripp commented on July 24, 2024

I should also note that attempting to unsign an :es384 token throws an NPE.

(let [ec-public  (buddy.core.keys/str->public-key
                  (clojure.string/join
                   "\n"
                   ["-----BEGIN PUBLIC KEY-----"
                    "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEfiP8WH3QiHehqYXzm2h4baL54gYJjLH+"
                    "sC9BUGkEfjGW0LDKX7icnh/R4bnqCbScc3SJ8T1vBdLlYztRc/kbcA=="
                    "-----END PUBLIC KEY-----"
                    ]))
      ec-private (buddy.core.keys/str->private-key
                  (clojure.string/join
                   "\n"
                   ["-----BEGIN EC PRIVATE KEY-----"
                    "MHQCAQEEIK38KQmolKaD45OudmYpbxsdKqJMSr7wu/kUIO7OuF1soAcGBSuBBAAK"
                    "oUQDQgAEfiP8WH3QiHehqYXzm2h4baL54gYJjLH+sC9BUGkEfjGW0LDKX7icnh/R"
                    "4bnqCbScc3SJ8T1vBdLlYztRc/kbcA=="
                    "-----END EC PRIVATE KEY-----"]))
      token (jwt/sign {:fails false} ec-private {:alg :es256})]
  (jwt/unsign token ec-public {:alg :es256}))
  ;; => {:fails false}
(let [ec-public (buddy.core.keys/str->public-key
                 (clojure.string/join
                  "\n"
                  ["-----BEGIN PUBLIC KEY-----"
                   "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEYU9499jQV8QTG+Md1mCdG7PYsxLa/xOV"
                   "MwPK4QoxDe0JQFR1nWRnXEzYRdH7+QMuv8reU8v9pY6HKDxh4w8lXarJfdy5IXDq"
                   "l73/T2495CsEPC96CdH6cmU3f8iohycg"
                   "-----END PUBLIC KEY-----"
                   ]))
      ec-private   (buddy.core.keys/str->private-key
                    (clojure.string/join
                     "\n"
                     ["-----BEGIN EC PRIVATE KEY-----"
                      "MIGkAgEBBDBPpbF89wj4nrvum1voWPU5cKJEh93efSjGjxbPQJYs1H9PcS1gm9YI"
                      "EW7WOnfLqzqgBwYFK4EEACKhZANiAARhT3j32NBXxBMb4x3WYJ0bs9izEtr/E5Uz"
                      "A8rhCjEN7QlAVHWdZGdcTNhF0fv5Ay6/yt5Ty/2ljocoPGHjDyVdqsl93LkhcOqX"
                      "vf9Pbj3kKwQ8L3oJ0fpyZTd/yKiHJyA="
                      "-----END EC PRIVATE KEY-----"
                      ])) 
      token     (jwt/sign {:fails true} ec-private {:alg :es384})]
  (jwt/unsign token ec-public {:alg :es384}))

Unhandled java.lang.NullPointerException
(No message)

              jws.clj:   83  buddy.sign.jws/calculate-signature
              jws.clj:   77  buddy.sign.jws/calculate-signature
              jws.clj:  121  buddy.sign.jws/sign
              jws.clj:  114  buddy.sign.jws/sign

from buddy-sign.

delitescere avatar delitescere commented on July 24, 2024

This would apply to all the alg types (HS, RS, PS, ES). /me suggests a PR ;-)

from buddy-sign.

niwinz avatar niwinz commented on July 24, 2024

es384 is optional in spec and this is not implemented because i did not needed it. Obviously a PR is welcome if you need it and you have time to implement that. :D

from buddy-sign.

tobytripp avatar tobytripp commented on July 24, 2024

Sounds good. Will get to work on it when I'm back from vacation!

from buddy-sign.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.