tls

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 24 Imported by: 5 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AuthVersionOID = asn1.ObjectIdentifier{2, 23, 133, 2, 6}

	ErrCertificate       = errors.New("certificate error")
	ErrInvalidSerialFlag = fmt.Errorf("%w: invalid value in serial flag. expected integer", ErrCertificate)
)

Functions

func LoadAndQueryCertificateForAccount

func LoadAndQueryCertificateForAccount(ctx context.Context, cctx client.Context, fin io.Reader) (tls.Certificate, error)

LoadAndQueryCertificateForAccount wraps LoadAndQueryPEMForAccount and tls.X509KeyPair

func ValidatePeerCertificates

func ValidatePeerCertificates(
	ctx context.Context,
	cquery CertificateQuerier,
	certs []*x509.Certificate,
	usage []x509.ExtKeyUsage,
) (sdk.Address, *x509.Certificate, error)

Types

type CertificateInvalidError

type CertificateInvalidError struct {
	Cert   *x509.Certificate
	Reason InvalidReason
}

func (CertificateInvalidError) Error

func (e CertificateInvalidError) Error() string

type CertificateQuerier

type CertificateQuerier interface {
	GetAccountCertificate(context.Context, sdk.Address, *big.Int) (*x509.Certificate, crypto.PublicKey, error)
}

type InvalidReason

type InvalidReason int
const (
	EmptyPeerCertificate InvalidReason = iota
	TooManyPeerCertificates
	InvalidCN
	InvalidSN
	Expired
	Decode
	X509Parse
	Verify
	OnChainCertsNotAvailable
)

type KeyPairManager

type KeyPairManager interface {
	KeyExists() (bool, error)
	Generate(notBefore, notAfter time.Time, domains []string) error

	// Read the PEM blocks, containing the cert, private key, & public key
	Read(fin ...io.Reader) ([]byte, []byte, []byte, error)

	ReadX509KeyPair(fin ...io.Reader) (*x509.Certificate, tls.Certificate, error)
}

func NewKeyPairManager

func NewKeyPairManager(cctx sdkclient.Context, fromAddress sdk.AccAddress) (KeyPairManager, error)

Jump to

Keyboard shortcuts

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