peerauth

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertificatePublicKey

func CertificatePublicKey(cert *x509.Certificate) (*keys.PublicKey, error)

CertificatePublicKey returns the P-256 public key from cert.

func CertificatePublicKeyFromRaw

func CertificatePublicKeyFromRaw(rawCerts [][]byte) ([]byte, error)

CertificatePublicKeyFromRaw returns the P-256 public key from the first TLS certificate in a handshake chain.

func IsTrustedPeer

func IsTrustedPeer(ctx context.Context) bool

IsTrustedPeer reports whether ctx was authenticated during the TLS handshake.

func PeerPublicKey

func PeerPublicKey(ctx context.Context) (*keys.PublicKey, error)

PeerPublicKey returns the public key authenticated by the TLS connection. It returns nil when the request has no TLS client certificate.

Types

type AuthInfo

type AuthInfo struct {
	credentials.TLSInfo
	PublicKey *keys.PublicKey
}

AuthInfo is TLS authentication information for a peer with a supported public key. It is set once during the TLS handshake.

func NewAuthInfo

func NewAuthInfo(info credentials.TLSInfo) (AuthInfo, error)

NewAuthInfo returns authentication information for a TLS peer certificate.

func (AuthInfo) AuthType

func (AuthInfo) AuthType() string

AuthType implements credentials.AuthInfo.

Jump to

Keyboard shortcuts

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