helper

package
v0.0.0-...-1816657 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: MPL-2.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	// contains filtered or unexported fields
}

DefaultConfig is a Config populated with a set of curated default values intended for library test usage of this package.

Functions

func GetIssuer

func GetIssuer(cert *x509.Certificate) (*x509.Certificate, error)

func GetIssuerFile

func GetIssuerFile(f string) (*x509.Certificate, error)

func PrettyResponse

func PrettyResponse(resp *ocsp.Response) string

func RegisterFlags

func RegisterFlags()

RegisterFlags registers command-line flags that affect OCSP checking.

func Req

func Req(cert *x509.Certificate, config Config) (*ocsp.Response, error)

Req makes an OCSP request using the given config for the given in-memory certificate, and returns the response.

func ReqDER

func ReqDER(der []byte, config Config) (*ocsp.Response, error)

ReqDER makes an OCSP request using the given config for the given DER-encoded certificate, and returns the response.

func ReqFile

func ReqFile(fileName string, config Config) (*ocsp.Response, error)

ReqFile makes an OCSP request using the given config for the PEM-encoded certificate in fileName, and returns the response.

func ReqSerial

func ReqSerial(serialNumber *big.Int, config Config) (*ocsp.Response, error)

ReqSerial makes an OCSP request using the given config for a certificate only identified by serial number. It requires that the Config have issuerFile set.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config contains fields which control various behaviors of the checker's behavior.

func ConfigFromFlags

func ConfigFromFlags() (Config, error)

ConfigFromFlags returns a Config whose values are populated from any command line flags passed by the user, or default values if not passed. However, it replaces io.Discard with os.Stdout so that CLI usages of this package will produce output on stdout by default.

func (Config) WithExpectReason

func (template Config) WithExpectReason(reason int) Config

WithExpectReason returns a new Config with the given expectReason, and all other fields the same as the receiver.

func (Config) WithExpectStatus

func (template Config) WithExpectStatus(status int) Config

WithExpectStatus returns a new Config with the given expectStatus, and all other fields the same as the receiver.

func (Config) WithOutput

func (template Config) WithOutput(w io.Writer) Config

WithOutput returns a new Config with the given output, and all other fields the same as the receiver.

type StatusCodeError

type StatusCodeError struct {
	Code int
	Body []byte
}

func (StatusCodeError) Error

func (e StatusCodeError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL