tls

package
v0.0.2-rc4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

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 ctypes.QueryClient, 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 InvalidReason

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

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