security

package
v0.0.0-...-4b4fa20 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePublicKey

func ParsePublicKey(keyBytes []byte) (*ecdsa.PublicKey, error)

ParsePublicKey parses a public key from bytes

func ParsePublicKeyHex

func ParsePublicKeyHex(keyHex string) (*ecdsa.PublicKey, error)

ParsePublicKeyHex parses a public key from a hex string

Types

type SecurityManager

type SecurityManager struct {
	UseTLS bool
	// contains filtered or unexported fields
}

SecurityManager manages security aspects like TLS and signatures

func NewSecurityManager

func NewSecurityManager(nodeID string, certDir string, useTLS bool) (*SecurityManager, error)

NewSecurityManager creates a new SecurityManager

func (*SecurityManager) GetPublicKeyBytes

func (sm *SecurityManager) GetPublicKeyBytes() ([]byte, error)

GetPublicKeyBytes returns the public key as bytes

func (*SecurityManager) GetPublicKeyHex

func (sm *SecurityManager) GetPublicKeyHex() (string, error)

GetPublicKeyHex returns the public key as a hex string

func (*SecurityManager) GetTLSConfig

func (sm *SecurityManager) GetTLSConfig() *tls.Config

GetTLSConfig returns the TLS configuration

func (*SecurityManager) SignData

func (sm *SecurityManager) SignData(data []byte) ([]byte, error)

SignData signs data with the private key

func (*SecurityManager) VerifySignature

func (sm *SecurityManager) VerifySignature(data []byte, signature []byte, publicKey *ecdsa.PublicKey) bool

VerifySignature verifies a signature with a public key

Jump to

Keyboard shortcuts

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