@ ba5c700b731db728fea52ac3080b57fbe2ed37b9 | 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, or a repeal list comes from another program.
ErrForeign = "E-FOREIGN"
// ErrRepealed: a CRL from the program's own chain repeals a depth.
ErrRepealed = "E-REPEALED"
// ErrStaleRepeals: a repeal list is past its nextUpdate, so it can no
// longer be trusted to be complete.
ErrStaleRepeals = "E-STALE-REPEALS"
)
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...)}
}