crypto

package
v0.0.0-...-43d69c3 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePEM

func DecodePEM(pemData []byte) (*x509.Certificate, error)

DecodePEM is a helper function to extract first PEM block

func GRPCDialOption

func GRPCDialOption(dialer *QUICDialer) grpc.DialOption

GRPCDialOption returns gRPC dial options for QUIC transport

func GRPCServerOption

func GRPCServerOption(listener *QUICListener) grpc.ServerOption

GRPCServerOption returns gRPC server options for QUIC transport

func GetCertificateFingerprint

func GetCertificateFingerprint(certFile string) (string, error)

GetCertificateFingerprint calculates SHA256 fingerprint of a certificate Note: This is now optional since we're using one-way TLS

func GetTLSVersion

func GetTLSVersion(version string) uint16

GetTLSVersion converts string to tls.Version constant

func LoadClientTLSConfig

func LoadClientTLSConfig(serverName string, insecureSkipVerify bool) (*tls.Config, error)

LoadClientTLSConfig loads client TLS configuration for QUIC (one-way TLS) Uses system root CAs to verify server certificate (e.g., Let's Encrypt) If insecureSkipVerify is true, skips certificate verification (for debugging only)

func LoadServerTLSConfig

func LoadServerTLSConfig(certFile, keyFile string) (*tls.Config, error)

LoadServerTLSConfig loads server TLS configuration for QUIC (one-way TLS)

func NewQUICClientCredentials

func NewQUICClientCredentials(serverName string, insecureSkipVerify bool) (credentials.TransportCredentials, error)

NewQUICClientCredentials creates gRPC credentials using QUIC transport

func NewQUICServerCredentials

func NewQUICServerCredentials(certFile, keyFile string) (credentials.TransportCredentials, error)

NewQUICServerCredentials creates gRPC credentials using QUIC transport

func ValidateCertificate

func ValidateCertificate(certFile string) error

ValidateCertificate checks if a certificate is valid and not expired

func VerifyCertificateChain

func VerifyCertificateChain(certFile, caFile string) error

VerifyCertificateChain is kept for backward compatibility but not used in one-way TLS In one-way TLS, client uses system root CAs to verify server certificate

Types

type QUICDialer

type QUICDialer struct {
	// contains filtered or unexported fields
}

QUICDialer implements gRPC dialer for QUIC

func NewQUICDialer

func NewQUICDialer(tlsConfig *tls.Config) *QUICDialer

NewQUICDialer creates a new QUIC dialer

func (*QUICDialer) DialContext

func (d *QUICDialer) DialContext(ctx context.Context, addr string) (net.Conn, error)

DialContext dials a QUIC connection

type QUICListener

type QUICListener struct {
	// contains filtered or unexported fields
}

QUICListener implements net.Listener for QUIC connections

func NewQUICListener

func NewQUICListener(addr string, tlsConfig *tls.Config) (*QUICListener, error)

NewQUICListener creates a new QUIC listener

func (*QUICListener) Accept

func (l *QUICListener) Accept() (net.Conn, error)

Accept waits for and returns the next connection to the listener

func (*QUICListener) Addr

func (l *QUICListener) Addr() net.Addr

Addr returns the listener's network address

func (*QUICListener) Close

func (l *QUICListener) Close() error

Close closes the listener

Jump to

Keyboard shortcuts

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