cmd

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(client kms.Client) error

func ExportKey

func ExportKey(client kms.Client, opts *Opts, args []string, sw *StatusWriter, lw *LoggerWriter) error

func ListSecretKeys added in v0.3.0

func ListSecretKeys(client kms.Client, opts *Opts, args []string, sw *StatusWriter, lw *LoggerWriter) error

ListSecretKeys lists KMS signing keys in GPG-compatible format. If args contains a search term, only keys matching by UID, fingerprint, or key ID are shown.

func ResolveKeyId added in v0.3.0

func ResolveKeyId(client kms.Client, user string) (string, error)

ResolveKeyId resolves a user-provided key identifier to a KMS key ARN. If the identifier looks like a KMS identifier (ARN, alias, UUID), it is returned as-is. Otherwise, keys are listed and matched by UID, fingerprint, or key ID.

func Sign

func Sign(client kms.Client, opts *Opts, args []string, sw *StatusWriter, lw *LoggerWriter) error

func Usage

func Usage() string

func VersionString added in v0.3.0

func VersionString() string

Types

type LoggerWriter added in v0.3.0

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

LoggerWriter writes plain text log messages to a file descriptor. GPGME reads these via gpgme_op_getauditlog() for diagnostic output.

func NewLoggerWriter added in v0.3.0

func NewLoggerWriter(fdNum *int) *LoggerWriter

NewLoggerWriter creates a LoggerWriter for the given file descriptor. If fdNum is nil, the writer is inactive and Log is a no-op.

func (*LoggerWriter) Close added in v0.3.0

func (lw *LoggerWriter) Close()

Close closes the logger fd if active.

func (*LoggerWriter) Log added in v0.3.0

func (lw *LoggerWriter) Log(format string, args ...any)

Log writes a plain text log message followed by a newline. It is a no-op if the writer is inactive.

type Opts

type Opts struct {
	DetachedSign           bool    `short:"b" long:"detach-sign" description:"Make a detched signature"`
	Armor                  bool    `short:"a" long:"armor" description:"Use ASCII Armoured format for the output"`
	ArmorAlias             bool    `long:"armour" description:"Alias for --armor"`
	Export                 bool    `long:"export" description:"Export a public part of a KMS key in a PGP Key Block"`
	ExportName             *string `long:"export-name" description:"Name to use for the exported PGP key (used with --export)"`
	ExportEmail            *string `long:"export-email" description:"Email to use for the exported PGP key (used with --export)"`
	ExportComment          *string `long:"export-comment" description:"Comment to use for the exported PGP key (used with --export)"`
	Sign                   bool    `short:"s" long:"sign" description:"Sign a file using KMS key"`
	ClearSign              bool    `long:"clear-sign" description:"Create a clear text signature using KMS key"`
	ClearSignAlias         bool    `long:"clearsign"  description:"Alias for --clear-sign"`
	Output                 *string `short:"o" long:"output" description:"Output file (default: input file + .asc)"`
	User                   string  `short:"u" long:"local-user" description:"The key ID to use"`
	DigestAlgo             string  `long:"digest-algo" description:"Digest algorithm to use (sha1, sha256, sha384, sha512)" default:"sha256"`
	ListSecretKeys         bool    `short:"K" long:"list-secret-keys" description:"List secret keys"`
	WithColons             bool    `long:"with-colons" description:"Print key listings delimited by colons"`
	Version                bool    `long:"version" description:"Display version information"`
	StatusFd               *int    `long:"status-fd" description:"Write status info to this file descriptor"`
	EnableProgressFilter   bool    `long:"enable-progress-filter" description:"Enable progress indicator reporting"`
	ExitOnStatusWriteError bool    `long:"exit-on-status-write-error" description:"Exit if writing to status-fd fails"`
	LoggerFd               *int    `long:"logger-fd" description:"Write log info to this file descriptor"`
	Charset                *string `long:"charset" description:"Character set for display (accepted for GPG compatibility)"`
	Batch                  bool    `long:"batch" description:"Batch mode (accepted for GPG compatibility)"`
	NoTTY                  bool    `long:"no-tty" description:"No TTY (accepted for GPG compatibility)"`
	NoGreeting             bool    `long:"no-greeting" description:"No greeting (accepted for GPG compatibility)"`
	NoSkComments           bool    `long:"no-sk-comments" description:"No secret key comments (accepted for GPG compatibility)"`
	HomeDir                *string `long:"homedir" description:"GPG home directory (accepted for GPG compatibility)"`
	LcCtype                *string `long:"lc-ctype" description:"Locale ctype (accepted for GPG compatibility)"`
	EnableSpecialFilenames bool    `` /* 127-byte string literal not displayed */
	Detach                 bool    `long:"detach" description:"Produce a detached signature (used with --sign)"`
}

type StatusWriter added in v0.3.0

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

StatusWriter writes GPG status lines to a file descriptor. GPGME parses these lines to determine operation success.

func NewStatusWriter added in v0.3.0

func NewStatusWriter(fdNum *int, exitOnError bool) *StatusWriter

NewStatusWriter creates a StatusWriter for the given file descriptor. If fdNum is nil, the writer is inactive and Emit is a no-op.

func (*StatusWriter) Close added in v0.3.0

func (sw *StatusWriter) Close()

Close closes the status fd if active.

func (*StatusWriter) Emit added in v0.3.0

func (sw *StatusWriter) Emit(code string, args ...string)

Emit writes a GPG status line in the format: [GNUPG:] CODE args...\n It is a no-op if the writer is inactive.

Jump to

Keyboard shortcuts

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