MCPcopy Create free account
hub / github.com/smallstep/cli / WithX5CFile

Function WithX5CFile

token/options.go:231–244  ·  view source on GitHub ↗

WithX5CFile returns a Options that sets the header x5c claims.

(certFile string, key interface{})

Source from the content-addressed store, hash-verified

229
230// WithX5CFile returns a Options that sets the header x5c claims.
231func 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
247func WithX5CCerts(certs []*x509.Certificate, key interface{}) Options {

Callers

nothing calls this directly

Calls 1

SetHeaderMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…