gopass: github.com/justwatchcom/gopass/pkg/backend/crypto/xc/keyring Index | Files

package keyring

import "github.com/justwatchcom/gopass/pkg/backend/crypto/xc/keyring"

Index

Package Files

private_key.go public_key.go pubring.go secring.go

type PrivateKey Uses

type PrivateKey struct {
    PublicKey
    Encrypted     bool
    EncryptedData []byte

    Nonce [nonceLength]byte // for private key encryption

    Salt []byte // for KDF
    // contains filtered or unexported fields
}

PrivateKey is a private key part of a keypair

func GenerateKeypair Uses

func GenerateKeypair(passphrase string) (*PrivateKey, error)

GenerateKeypair generates a new keypair

func (*PrivateKey) Decrypt Uses

func (p *PrivateKey) Decrypt(passphrase string) error

Decrypt decrypts the private key

func (*PrivateKey) Encrypt Uses

func (p *PrivateKey) Encrypt(passphrase string) error

Encrypt encrypts the private key material with the given passphrase

func (*PrivateKey) PrivateKey Uses

func (p *PrivateKey) PrivateKey() [keyLength]byte

PrivateKey returns the decrypted private key material

type PublicKey Uses

type PublicKey struct {
    CreationTime time.Time
    PubKeyAlgo   PublicKeyAlgorithm
    PublicKey    [32]byte
    Identity     *xcpb.Identity
}

PublicKey is the public part of a keypair

func (PublicKey) Fingerprint Uses

func (p PublicKey) Fingerprint() string

Fingerprint calculates the unique ID of a public key

type PublicKeyAlgorithm Uses

type PublicKeyAlgorithm uint8

PublicKeyAlgorithm is a type of public key algorithm

const (
    // PubKeyNaCl is a NaCl (Salt) based public key
    PubKeyNaCl PublicKeyAlgorithm = iota
)

type Pubring Uses

type Pubring struct {
    File string

    sync.Mutex
    // contains filtered or unexported fields
}

Pubring is a public key ring

func LoadPubring Uses

func LoadPubring(file string, sec *Secring) (*Pubring, error)

LoadPubring loads an existing keyring from disk. If the file is not found an empty keyring is returned.

func NewPubring Uses

func NewPubring(sec *Secring) *Pubring

NewPubring initializes a new public key ring

func (*Pubring) Contains Uses

func (p *Pubring) Contains(fp string) bool

Contains checks if a given key is in the keyring

func (*Pubring) Export Uses

func (p *Pubring) Export(id string) ([]byte, error)

Export marshals a single key

func (*Pubring) Get Uses

func (p *Pubring) Get(id string) *PublicKey

Get returns a single key

func (*Pubring) Import Uses

func (p *Pubring) Import(buf []byte) error

Import unmarshals and inserts and previously exported key

func (*Pubring) KeyIDs Uses

func (p *Pubring) KeyIDs() []string

KeyIDs returns a list of all key IDs

func (*Pubring) Remove Uses

func (p *Pubring) Remove(id string) error

Remove deletes a single key

func (*Pubring) Save Uses

func (p *Pubring) Save() error

Save writes the keyring to the previously set location on disk

func (*Pubring) Set Uses

func (p *Pubring) Set(pk *PublicKey) error

Set inserts a key, possibly overwriting and existing entry

type Secring Uses

type Secring struct {
    File string

    sync.Mutex
    // contains filtered or unexported fields
}

Secring is private key ring

func LoadSecring Uses

func LoadSecring(file string) (*Secring, error)

LoadSecring loads an existing secring from disk. If the file is not found an empty keyring is returned

func NewSecring Uses

func NewSecring() *Secring

NewSecring initializes and a new secring

func (*Secring) Contains Uses

func (p *Secring) Contains(fp string) bool

Contains returns true if the given key is found in the keyring

func (*Secring) Export Uses

func (p *Secring) Export(id string, withPrivate bool) ([]byte, error)

Export marshals a single private key

func (*Secring) Get Uses

func (p *Secring) Get(id string) *PrivateKey

Get returns a single key

func (*Secring) Import Uses

func (p *Secring) Import(buf []byte) error

Import unmarshals and imports a previously exported key

func (*Secring) KeyIDs Uses

func (p *Secring) KeyIDs() []string

KeyIDs returns a list of key IDs

func (*Secring) Remove Uses

func (p *Secring) Remove(id string) error

Remove deletes the given key

func (*Secring) Save Uses

func (p *Secring) Save() error

Save writes the keyring to the previously set location on disk

func (*Secring) Set Uses

func (p *Secring) Set(pk *PrivateKey) error

Set inserts a single key

Package keyring imports 16 packages (graph). Updated 2019-03-12. Refresh now. Tools for package owners.