ssh

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SigNamespace = "file"
	KeyType      = "ssh"
)

Variables

This section is empty.

Functions

func NewKeyFromBytes

func NewKeyFromBytes(t *testing.T, keyB []byte) *signerverifier.SSLibKey

NewKeyFromBytes returns an ssh SSLibKey from the passed bytes. It's meant to be used for tests as that's when we directly deal with key bytes.

func NewKeyFromFile

func NewKeyFromFile(path string) (*signerverifier.SSLibKey, error)

NewKeyFromFile imports an ssh SSlibKey from the passed path. The path can point to a public or private, encrypted or plaintext, rsa, ecdsa or ed25519 key file in a format supported by "ssh-keygen". This aligns with the git "user.signingKey" option. https://git-scm.com/docs/git-config#Documentation/git-config.txt-usersigningKey

Types

type Signer

type Signer struct {
	Path string
	*Verifier
}

Signer is a dsse.Signer implementation for SSH keys.

func NewSignerFromFile

func NewSignerFromFile(path string) (*Signer, error)

NewSignerFromFile creates an SSH signer from the passed path.

func (*Signer) Sign

func (s *Signer) Sign(_ context.Context, data []byte) ([]byte, error)

Sign implements the dsse.Signer.Sign interface for SSH keys. It signs using "s.Path" to a public or private, encrypted or plaintext, rsa, ecdsa or ed25519 key file in a format supported by "ssh-keygen". This aligns with the git "user.signingKey" option. https://git-scm.com/docs/git-config#Documentation/git-config.txt-usersigningKey

type Verifier

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

Verifier is a dsse.Verifier implementation for SSH keys.

func NewVerifierFromKey

func NewVerifierFromKey(key *signerverifier.SSLibKey) (*Verifier, error)

NewVerifierFromKey creates a new Verifier from SSlibKey of type ssh.

func (*Verifier) KeyID

func (v *Verifier) KeyID() (string, error)

KeyID implements the dsse.Verifier.KeyID interface for SSH keys. FIXME: consider removing error in interface; a dsse.Verifier needs a keyid

func (*Verifier) MetadataKey

func (v *Verifier) MetadataKey() *signerverifier.SSLibKey

func (*Verifier) Public

func (v *Verifier) Public() crypto.PublicKey

Public implements the dsse.Verifier.Public interface for SSH keys. FIXME: consider removing in interface, "Verify()" is all that's needed

func (*Verifier) Verify

func (v *Verifier) Verify(_ context.Context, data []byte, sig []byte) error

Verify implements the dsse.Verifier.Verify interface for SSH keys.

Jump to

Keyboard shortcuts

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