WithRootCA returns an Options function that calculates the SHA256 of the given root certificate to be used in the token claims. If this method it's not used the default root certificate in the $STEPPATH secrets directory will be used.
(path string)
| 43 | // not used the default root certificate in the $STEPPATH secrets directory will |
| 44 | // be used. |
| 45 | func WithRootCA(path string) Options { |
| 46 | return func(c *Claims) error { |
| 47 | cert, err := pemutil.ReadCertificate(path) |
| 48 | if err != nil { |
| 49 | return err |
| 50 | } |
| 51 | sum := sha256.Sum256(cert.Raw) |
| 52 | c.Set(RootSHAClaim, hex.EncodeToString(sum[:])) |
| 53 | return nil |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // WithSHA returns an Options function that sets the SHA claim to the given |
| 58 | // value. |
searching dependent graphs…