secure

package
v0.0.0-...-8ad0a2a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CRLsFolder                 = "crls"
	TLSCACertsFolder           = "tlscacerts"
	TLSIntermediateCertsFolder = "tlsintermediatecerts"
	KeyFolder                  = "keystore"
	CertificateFolder          = "signcerts"
)

Variables

This section is empty.

Functions

func GetCertFromPem

func GetCertFromPem(idBytes []byte) (*x509.Certificate, error)

func GetCertificatePath

func GetCertificatePath(certificate string) (string, error)

func GetPrivateKeyPath

func GetPrivateKeyPath(key string) (string, error)

func GetRootCAPath

func GetRootCAPath(dir string) ([]string, error)

func LoadNodeCertificate

func LoadNodeCertificate(keyPath, certPath string) (tls.Certificate, error)

func MarshalECDSASignature

func MarshalECDSASignature(r, s *big.Int) ([]byte, error)

func PathExists

func PathExists(path string) bool

func UnmarshalECDSASignature

func UnmarshalECDSASignature(raw []byte) (*big.Int, *big.Int, error)

Types

type ConnectionConfig

type ConnectionConfig struct {
	UseTLS bool
	Dir    string //tls相关的目录的根目录
}
tls相关的目录的根目录

. ├── crls ├── keystore ├── signcerts ├── tlscacerts └── tlsintermediatecerts

type ECDSASignature

type ECDSASignature struct {
	R, S *big.Int
}

type SecureConfig

type SecureConfig struct {
	//root certificates
	TlsRootCerts [][]byte
	// List of TLS intermediate certificates;
	TlsIntermediateCerts [][]byte
	//revocation lists
	RevocationList [][]byte
}

func GetSecureConfig

func GetSecureConfig(dir string) (*SecureConfig, error)

type SecureConnection

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

func NewSecureConnection

func NewSecureConnection(config *ConnectionConfig) (*SecureConnection, error)

func (*SecureConnection) Dial

func (this *SecureConnection) Dial(dest *enode.Node) (net.Conn, error)

func (*SecureConnection) Listen

func (this *SecureConnection) Listen(network, addr string) (net.Listener, error)

func (*SecureConnection) SaveCRL

func (this *SecureConnection) SaveCRL(dir string, CRLBytes []byte) ([]*big.Int, error)

type SecureManager

type SecureManager struct {

	// list of CA TLS certs we trust ,setupTLSCAs
	TLSRootCerts [][]byte
	// list of intermediate TLS certs we trust,setupTLSCAs
	TLSIntermediateCerts [][]byte
	// list of certificate revocation lists,setupCRLs
	CRL []*pkix.CertificateList
	// contains filtered or unexported fields
}

func (*SecureManager) SaveCRL

func (s *SecureManager) SaveCRL(dir string, CRLBytes []byte) ([]*big.Int, error)

Jump to

Keyboard shortcuts

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