signature

package
v16.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractSignature

func ExtractSignature(tb testing.TB, ctx context.Context, objectData []byte) (string, string)

ExtractSignature extracts the signature from a commit object for testing purposes

Types

type GpgSigningKey

type GpgSigningKey struct {
	Entity *openpgp.Entity
}

GpgSigningKey is a struct that implements SigningKey interface for GPG keys

func (*GpgSigningKey) CreateSignature

func (sk *GpgSigningKey) CreateSignature(contentToSign []byte) ([]byte, error)

CreateSignature creates a gpg signature

func (*GpgSigningKey) Verify

func (sk *GpgSigningKey) Verify(signature, signedText []byte) error

Verify method verifies whether a signature has been created by this signing key

type SSHSigningKey

type SSHSigningKey struct {
	PrivateKey ssh.Signer
}

SSHSigningKey is a struct that implements SigningKey interface for SSH keys

func (*SSHSigningKey) CreateSignature

func (sk *SSHSigningKey) CreateSignature(contentToSign []byte) ([]byte, error)

CreateSignature creates an SSH signature

func (*SSHSigningKey) Verify

func (sk *SSHSigningKey) Verify(signatureText, signedText []byte) error

Verify method verifies whether a signature has been created by this signing key

type SigningKey

type SigningKey interface {
	CreateSignature([]byte) ([]byte, error)
	Verify([]byte, []byte) error
}

SigningKey is the common interface interface of SSH and GPG signing keys

func ParseSigningKey

func ParseSigningKey(path string) (SigningKey, error)

ParseSigningKey parses a signing key and returns either GPG or SSH key

Jump to

Keyboard shortcuts

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