Back to godoc.org

Package cli

v1.8.6
Latest Go to latest
Published: Jul 26, 2019 | License: MIT | Module: github.com/justwatchcom/gopass

Index

Package Files

Variables

var (

	// Ext is the file extension used by this backend
	Ext = "gpg"
	// IDFile is the name of the recipients file used by this backend
	IDFile = ".gpg-id"
)

func Binary

func Binary(ctx context.Context, bin string) (string, error)

Binary reutrns the GGP binary location

func GPGOpts

func GPGOpts() []string

GPGOpts parses extra GPG options from the environment

type Config

type Config struct {
	Binary string
	Args   []string
	Umask  int
}

Config is the gpg wrapper config

type GPG

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

GPG is a gpg wrapper

func New

func New(ctx context.Context, cfg Config) (*GPG, error)

New creates a new GPG wrapper

func (*GPG) Binary

func (g *GPG) Binary() string

Binary returns the GPG binary location

func (*GPG) CreatePrivateKey

func (g *GPG) CreatePrivateKey(ctx context.Context) error

CreatePrivateKey will create a new GPG key in interactive mode

func (*GPG) CreatePrivateKeyBatch

func (g *GPG) CreatePrivateKeyBatch(ctx context.Context, name, email, passphrase string) error

CreatePrivateKeyBatch will create a new GPG keypair in batch mode

func (*GPG) Decrypt

func (g *GPG) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error)

Decrypt will try to decrypt the given file

func (*GPG) EmailFromKey

func (g *GPG) EmailFromKey(ctx context.Context, id string) string

EmailFromKey extracts the email from a key id

func (*GPG) Encrypt

func (g *GPG) Encrypt(ctx context.Context, plaintext []byte, recipients []string) ([]byte, error)

Encrypt will encrypt the given content for the recipients. If alwaysTrust is true the trust-model will be set to always as to avoid (annoying) "unusable public key" errors when encrypting.

func (*GPG) ExportPublicKey

func (g *GPG) ExportPublicKey(ctx context.Context, id string) ([]byte, error)

ExportPublicKey will export the named public key to the location given

func (*GPG) Ext

func (g *GPG) Ext() string

Ext returns gpg

func (*GPG) FindPrivateKeys

func (g *GPG) FindPrivateKeys(ctx context.Context, search ...string) ([]string, error)

FindPrivateKeys searches for the given private keys

func (*GPG) FindPublicKeys

func (g *GPG) FindPublicKeys(ctx context.Context, search ...string) ([]string, error)

FindPublicKeys searches for the given public keys

func (*GPG) Fingerprint

func (g *GPG) Fingerprint(ctx context.Context, id string) string

Fingerprint returns the full-length native fingerprint

func (*GPG) FormatKey

func (g *GPG) FormatKey(ctx context.Context, id string) string

FormatKey formats the details of a key id

func (*GPG) IDFile

func (g *GPG) IDFile() string

IDFile returns .gpg-id

func (*GPG) ImportPublicKey

func (g *GPG) ImportPublicKey(ctx context.Context, buf []byte) error

ImportPublicKey will import a key from the given location

func (*GPG) Initialized

func (g *GPG) Initialized(ctx context.Context) error

Initialized always returns nil

func (*GPG) ListPrivateKeyIDs

func (g *GPG) ListPrivateKeyIDs(ctx context.Context) ([]string, error)

ListPrivateKeyIDs returns a parsed list of GPG secret keys

func (*GPG) ListPublicKeyIDs

func (g *GPG) ListPublicKeyIDs(ctx context.Context) ([]string, error)

ListPublicKeyIDs returns a parsed list of GPG public keys

func (*GPG) Name

func (g *GPG) Name() string

Name returns gpg

func (*GPG) NameFromKey

func (g *GPG) NameFromKey(ctx context.Context, id string) string

NameFromKey extracts the name from a key id

func (*GPG) ReadNamesFromKey

func (g *GPG) ReadNamesFromKey(ctx context.Context, buf []byte) ([]string, error)

ReadNamesFromKey unmarshals and returns the names associated with the given public key

func (*GPG) RecipientIDs

func (g *GPG) RecipientIDs(ctx context.Context, buf []byte) ([]string, error)

RecipientIDs returns a list of recipient IDs for a given file

func (*GPG) Version

func (g *GPG) Version(ctx context.Context) semver.Version

Version will returns GPG version information

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier