2 回答

TA貢獻1824條經驗 獲得超8個贊
作者 http://github.com/lestrrat-go/jwx 在這里.
我還沒有合并解析證書的能力,但等待問題報告器的響應,但代碼已經寫 https://github.com/lestrrat-go/jwx/compare/topic/issue-350
一旦該更改進入,就可以執行一些手臂扭曲并解析這些證書(偽代碼):
data := ... read from that URL ...
rawSet := make(map[string]interface{})
if err := json.Unmarshal(data, &rawSet); err != nil {
...
}
// yikes
keys := rawset["keys"].([]interface{})
firstKey := keys[0].(map[string]interface{})
x5c := (firstKey["x5c"].([]interface{}))[0].(string)
// Decode from base64
cert, _ := base64.RawStdEncoding.DecodeString(x5c)
// turn the certificate into JWK (NOT YET MERGED)
key, _ := jwk.ParseKey(cert, jwk.WithPEM(true))
如果您需要將證書解析為 JWK 的功能,請在存儲庫中提交新問題,以便我跟蹤更改。
此外,如果要導入 http://github.com/lestrrat-go/jwx/jwk,則不妨對 JWT 使用 http://github.com/lestrrat-go/jwx/jwt;)
- 2 回答
- 0 關注
- 294 瀏覽
添加回答
舉報