pki

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package pki contains Status of a timestamping response defined in RFC 3161.

Package pki contains Status of a timestamping response defined in RFC 3161.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownFailureInfo = errors.New("unknown PKIFailureInfo")

ErrUnknownFailureInfo is used when PKIFailureInfo is not supported or does not exists

View Source
var ErrUnknownStatus = errors.New("unknown PKIStatus")

ErrUnknownStatus is used when PKIStatus is not supported

Functions

This section is empty.

Types

type FailureInfo

type FailureInfo int

FailureInfo is PKIFailureInfo defined in RFC 3161 2.4.2.

const (
	FailureInfoBadAlg              FailureInfo = 0  // unrecognized or unsupported Algorithm Identifier
	FailureInfoBadRequest          FailureInfo = 2  // transaction not permitted or supported
	FailureInfoBadDataFormat       FailureInfo = 5  // the data submitted has the wrong format
	FailureInfoTimeNotAvailable    FailureInfo = 14 // the TSA's time source is not available
	FailureInfoUnacceptedPolicy    FailureInfo = 15 // the requested TSA policy is not supported by the TSA.
	FailureInfoUnacceptedExtension FailureInfo = 16 // the requested extension is not supported by the TSA.
	FailureInfoAddInfoNotAvailable FailureInfo = 17 // the additional information requested could not be understood or is not available
	FailureInfoSystemFailure       FailureInfo = 25 // the request cannot be handled due to system failure
)

func (FailureInfo) Error

func (fi FailureInfo) Error() error

Error converts a FailureInfo to an error

type FailureInfoError

type FailureInfoError struct {
	// Detail is the joined internal error
	Detail error
}

FailureInfoError is error of FailureInfo with a joined internal error

func (*FailureInfoError) Error

func (e *FailureInfoError) Error() string

Error prints out the internal error e.Detail split by '; '

func (*FailureInfoError) Unwrap

func (e *FailureInfoError) Unwrap() error

Unwrap returns the internal error

type Status

type Status int

Status is PKIStatus defined in RFC 3161 2.4.2.

const (
	StatusGranted                Status = 0 // you got exactly what you asked for
	StatusGrantedWithMods        Status = 1 // you got something like what you asked for
	StatusRejection              Status = 2 // you don't get it, more information elsewhere in the message
	StatusWaiting                Status = 3 // the request body part has not yet been processed, expect to hear more later
	StatusRevocationWarning      Status = 4 // this message contains a warning that a revocation is imminent
	StatusRevocationNotification Status = 5 // notification that a revocation has occurred
)

func (Status) String

func (s Status) String() string

String converts Status to string

type StatusInfo

type StatusInfo struct {
	Status       Status
	StatusString []string       `asn1:"optional,utf8"`
	FailInfo     asn1.BitString `asn1:"optional"`
}

StatusInfo contains status codes and failure information for PKI messages.

PKIStatusInfo ::= SEQUENCE {
 status          PKIStatus,
 statusString    PKIFreeText     OPTIONAL,
 failInfo        PKIFailureInfo  OPTIONAL }

PKIStatus        ::= INTEGER
PKIFreeText      ::= SEQUENCE SIZE (1..MAX) OF UTF8String
PKIFailureInfo   ::= BIT STRING

Reference: RFC 3161 2.4.2

func (StatusInfo) Err

func (si StatusInfo) Err() error

Err return nil when si Status is StatusGranted or StatusGrantedWithMods

Otherwise, Err returns an error with FailInfo if any.

Jump to

Keyboard shortcuts

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