result

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package result provides general objects that are used across revocation

Package result provides general objects that are used across revocation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertRevocationResult

type CertRevocationResult struct {
	// Result of revocation for a specific certificate in the chain.
	Result Result

	// ServerResults is an array of results for each server associated with the
	// certificate.
	//
	// When RevocationMethod is MethodOCSP, the length will be
	// either 1 or the number of OCSPServers for the certificate.
	// If the length is 1, then a valid status was retrieved. Only
	// this server result is contained. Any errors for other servers are
	// discarded in favor of this valid response.
	// Otherwise, every server specified had some error that prevented the
	// status from being retrieved. These are all contained here for evaluation.
	//
	// When RevocationMethod is MethodCRL, the length will be the number of
	// CRL distribution points' URIs checked. If the result is Revoked, or
	// there is an error, the length will be 1.
	//
	// When RevocationMethod is MethodOCSPFallbackCRL, the length
	// will be the sum of the previous two cases. The CRL result will be
	// appended after the OCSP results.
	ServerResults []*ServerResult

	// RevocationMethod is the method used to check the revocation status of the
	// certificate, including RevocationMethodUnknown, RevocationMethodOCSP,
	// RevocationMethodCRL and RevocationMethodOCSPFallbackCRL
	RevocationMethod RevocationMethod
}

CertRevocationResult encapsulates the result for a single certificate in the chain as well as the results from individual servers associated with this certificate

type InvalidChainError

type InvalidChainError struct {
	Err error
}

InvalidChainError is returned when the certificate chain does not meet the requirements for a valid certificate chain

func (InvalidChainError) Error

func (e InvalidChainError) Error() string

type Result

type Result int

Result is a type of enumerated value to help characterize revocation result. It can be OK, Unknown, NonRevokable, or Revoked

const (
	// ResultUnknown is a Result that indicates that some error other than a
	// revocation was encountered during the revocation check.
	ResultUnknown Result = iota

	// ResultOK is a Result that indicates that the revocation check resulted in
	// no important errors.
	ResultOK

	// ResultNonRevokable is a Result that indicates that the certificate cannot
	// be checked for revocation. This may be due to the absence of OCSP servers
	// or CRL distribution points, or because the certificate is a root
	// certificate.
	ResultNonRevokable

	// ResultRevoked is a Result that indicates that at least one certificate was
	// revoked when performing a revocation check on the certificate chain.
	ResultRevoked
)

func (Result) String

func (r Result) String() string

String provides a conversion from a Result to a string

type RevocationMethod added in v1.2.0

type RevocationMethod int

RevocationMethod defines the method used to check the revocation status of a certificate.

const (
	// RevocationMethodUnknown is used for root certificates or when the method
	// used to check the revocation status of a certificate is unknown.
	RevocationMethodUnknown RevocationMethod = iota

	// RevocationMethodOCSP represents OCSP as the method used to check the
	// revocation status of a certificate.
	RevocationMethodOCSP

	// RevocationMethodCRL represents CRL as the method used to check the
	// revocation status of a certificate.
	RevocationMethodCRL

	// RevocationMethodOCSPFallbackCRL represents OCSP check with unknown error
	// fallback to CRL as the method used to check the revocation status of a
	// certificate.
	RevocationMethodOCSPFallbackCRL
)

func (RevocationMethod) String added in v1.2.0

func (m RevocationMethod) String() string

String provides a conversion from a Method to a string

type ServerResult

type ServerResult struct {
	// Result of revocation for this server (Unknown if there is an error which
	// prevents the retrieval of a valid status)
	Result Result

	// Server is the URI associated with this result. If no server is associated
	// with the result (e.g. it is a root certificate or no OCSPServers are
	// specified), then this will be an empty string ("")
	Server string

	// Error is set if there is an error associated with the revocation check
	// to this server
	Error error

	// RevocationMethod is the method used to check the revocation status of the
	// certificate, including RevocationMethodUnknown, RevocationMethodOCSP,
	// RevocationMethodCRL
	RevocationMethod RevocationMethod
}

ServerResult encapsulates the OCSP result for a single server or the CRL result for a single CRL URI for a certificate in the chain

func NewServerResult

func NewServerResult(result Result, server string, err error) *ServerResult

NewServerResult creates a ServerResult object from its individual parts: a Result, a string for the server, and an error

Jump to

Keyboard shortcuts

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