pcrypto

package
v0.0.0-...-fb108f3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPublicEd25519ToCurve25519

func ConvertPublicEd25519ToCurve25519(ed25519Key string) (wgtypes.Key, error)

func ExecuteCommand

func ExecuteCommand(cmd string, client *ssh.Client) (string, error)

ExecuteCommand opens a session using the provided client and executes the provided command

func NewConnection

func NewConnection(host string, user string, auth ssh.AuthMethod, maxRetries int) (*ssh.Client, error)

Types

type Key

type Key struct {
	Priv ed25519.PrivateKey
	Pub  ed25519.PublicKey
}

Key is an SSH key

func GetLocalKey

func GetLocalKey(workdir string) (*Key, error)

func (Key) AuthorizedKey

func (k Key) AuthorizedKey() string

AuthorizedKey return the public key in a format that can be written directly to the ~/.ssh/authorized_keys file

func (Key) EncodePrivateKeytoPEM

func (k Key) EncodePrivateKeytoPEM() string

func (Key) GetID

func (k Key) GetID() string

func (Key) Private

func (k Key) Private() []byte

func (Key) PrivateWG

func (k Key) PrivateWG() wgtypes.Key

func (Key) Public

func (k Key) Public() []byte

func (Key) PublicKey

func (k Key) PublicKey() string

func (Key) PublicString

func (k Key) PublicString() string

func (Key) PublicWG

func (k Key) PublicWG() wgtypes.Key

func (Key) SSHAuth

func (k Key) SSHAuth() ssh.AuthMethod

SSHAuth returns an ssh.AuthMethod that can be used to configure an ssh client

func (Key) Seed

func (k Key) Seed() []byte

func (Key) Sign

func (k Key) Sign(commit string) (string, error)

func (Key) Verify

func (k Key) Verify(commit string, signature string, publicKey string) error

type Manager

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

Manager keeps track of all the keys

func CreateManager

func CreateManager(db *db.DB) *Manager

CreateManager returns a Manager, which implements the core.ProviderManager interface

func (*Manager) GenerateKey

func (sm *Manager) GenerateKey() (*Key, error)

GenerateKey generates a SSH key pair

func (*Manager) GetKeyByPub

func (sm *Manager) GetKeyByPub(pubKey string) (Key, error)

GetKeyByPub returns a key that has the provided pubkey (base64 encoded)

func (*Manager) NewAuthFromKeyFile

func (sm *Manager) NewAuthFromKeyFile(keyPath string) (ssh.AuthMethod, error)

NewAuthFromKeyFile takes a file path and returns an ssh authentication

func (*Manager) NewKeyFromSeed

func (sm *Manager) NewKeyFromSeed(seedStr string) (*Key, error)

NewKeyFromSeed takes an ed25519 key seed and return a Key

type Tunnel

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

Tunnel represents and SSH tunnel to a remote host

func NewTunnel

func NewTunnel(sshHost string, sshUser string, sshAuth ssh.AuthMethod, tunnelTarget string) *Tunnel

NewTunnel creates and returns an SSHTunnel

func (*Tunnel) Close

func (t *Tunnel) Close() error

Close terminates the SSH tunnel

func (*Tunnel) Start

func (t *Tunnel) Start() (int, error)

Start initiates the ssh tunnel

Jump to

Keyboard shortcuts

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