WithX5CFile returns a Options that sets the header x5c claims.
(certFile string, key interface{})
| 229 | |
| 230 | // WithX5CFile returns a Options that sets the header x5c claims. |
| 231 | func WithX5CFile(certFile string, key interface{}) Options { |
| 232 | return func(c *Claims) error { |
| 233 | certs, err := pemutil.ReadCertificateBundle(certFile) |
| 234 | if err != nil { |
| 235 | return err |
| 236 | } |
| 237 | certStrs, err := jose.ValidateX5C(certs, key) |
| 238 | if err != nil { |
| 239 | return errors.Wrap(err, "error validating x5c certificate chain and key for use in x5c header") |
| 240 | } |
| 241 | c.SetHeader("x5c", certStrs) |
| 242 | return nil |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | // WithX5CCerts returns a Options that sets the header x5c claims from a cert in memory |
| 247 | func WithX5CCerts(certs []*x509.Certificate, key interface{}) Options { |
nothing calls this directly
no test coverage detected
searching dependent graphs…