signtool

package
v0.0.0-...-ab92e14 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: GPL-3.0 Imports: 7 Imported by: 17

Documentation

Overview

Package signtool offers tooling to sign assertions.

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdout = os.Stdout
)

Functions

func GenerateKey

func GenerateKey(keypairMgr KeypairManager, keyName string) error

GenerateKey generates a private RSA key using the provided keypairMgr.

func Sign

func Sign(opts *Options, keypairMgr asserts.KeypairManager) ([]byte, error)

Sign produces the text of a signed assertion as specified by opts.

Types

type KeypairManager

type KeypairManager interface {
	asserts.KeypairManager

	GetByName(keyNname string) (asserts.PrivateKey, error)
	Export(keyName string) ([]byte, error)
	List() ([]asserts.ExternalKeyInfo, error)
	DeleteByName(keyName string) error
}

KeypairManager is an interface for common methods of ExternalKeypairManager and GPGPKeypairManager.

func GetKeypairManager

func GetKeypairManager() (KeypairManager, error)

GetKeypairManager returns a KeypairManager - either the standrd gpg-based or external one if set via SNAPD_EXT_KEYMGR environment variable.

type Options

type Options struct {
	// KeyID specifies the key id of the key to use
	KeyID string

	// AccountKey optionally holds the account-key for the key to use,
	// used for cross-checking
	AccountKey *asserts.AccountKey

	// Statement is used as input to construct the assertion
	// it's a mapping encoded as JSON
	// of the header fields of the assertion
	// plus an optional pseudo-header "body" to specify
	// the body of the assertion
	Statement []byte

	// Complement specifies complementary headers to what is in
	// Statement, for use by tools that fill-in/compute some of
	// the headers. Headers appearing both in Statement and
	// Complement are an error, except for "type" that needs
	// instead to match if present. Pseudo-header "body" can also
	// be specified here.
	Complement map[string]interface{}
}

Options specifies the complete input for signing an assertion.

Jump to

Keyboard shortcuts

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