@ 7eeb8a0214368f4491f26f4cf37bd7bf6dc67cd3 | history
package ratify
import "fmt"
// Ratification error codes. Every ratification failure exits with code 2.
const (
// ErrMalformed: the file is not a readable certificate chain.
ErrMalformed = "E-MALFORMED"
// ErrChain: the certificates do not form one valid path from the
// anchor down.
ErrChain = "E-CHAIN"
// ErrTampered: a signature does not match the bytes it covers.
ErrTampered = "E-TAMPERED"
// ErrNotInForce: the check time is before the program takes effect.
ErrNotInForce = "E-NOT-IN-FORCE"
// ErrLapsed: the check time is after the program expired.
ErrLapsed = "E-LAPSED"
// ErrForeign: the program is ratified by a key other than the pinned
// one.
ErrForeign = "E-FOREIGN"
)
type Error struct {
Code string
Msg string
}
func (e *Error) Error() string { return e.Code + ": " + e.Msg }
func errorf(code, format string, args ...any) *Error {
return &Error{Code: code, Msg: fmt.Sprintf(format, args...)}
}