vault: github.com/hashicorp/vault/helper/pgpkeys Index | Files

package pgpkeys

import "github.com/hashicorp/vault/helper/pgpkeys"

Index

Package Files

encrypt_decrypt.go flag.go keybase.go test_keys.go

Constants

const (
    TestPrivKey1 = "" /* 3726 byte string literal not displayed */

    TestPrivKey2 = "" /* 3726 byte string literal not displayed */

    TestPrivKey3 = "" /* 3726 byte string literal not displayed */

    TestPubKey1 = "" /* 1967 byte string literal not displayed */

    TestPubKey2 = "" /* 1967 byte string literal not displayed */

    TestPubKey3 = "" /* 1967 byte string literal not displayed */

    TestAAPubKey1 = "" /* 2069 byte string literal not displayed */

)

func DecryptBytes Uses

func DecryptBytes(encodedCrypt, privKey string) (*bytes.Buffer, error)

DecryptBytes takes in base64-encoded encrypted bytes and the base64-encoded private key and decrypts it. A bytes.Buffer is returned to allow the caller to do useful thing with it (get it as a []byte, get it as a string, use it as an io.Reader, etc), and also because this function doesn't know if what comes out is binary data or a string, so let the caller decide.

func EncryptShares Uses

func EncryptShares(input [][]byte, pgpKeys []string) ([]string, [][]byte, error)

EncryptShares takes an ordered set of byte slices to encrypt and the corresponding base64-encoded public keys to encrypt them with, encrypts each byte slice with the corresponding public key.

Note: There is no corresponding test function; this functionality is thoroughly tested in the init and rekey command unit tests

func FetchKeybasePubkeys Uses

func FetchKeybasePubkeys(input []string) (map[string]string, error)

FetchKeybasePubkeys fetches public keys from Keybase given a set of usernames, which are derived from correctly formatted input entries. It doesn't use their client code due to both the API and the fact that it is considered alpha and probably best not to rely on it. The keys are returned as base64-encoded strings.

func GetEntities Uses

func GetEntities(pgpKeys []string) ([]*openpgp.Entity, error)

GetEntities takes in a string array of base64-encoded PGP keys and returns the openpgp Entities

func GetFingerprints Uses

func GetFingerprints(pgpKeys []string, entities []*openpgp.Entity) ([]string, error)

GetFingerprints takes in a list of openpgp Entities and returns the fingerprints. If entities is nil, it will instead parse both entities and fingerprints from the pgpKeys string slice.

func ParsePGPKeys Uses

func ParsePGPKeys(keyfiles []string) ([]string, error)

ParsePGPKeys takes a list of PGP keys and parses them either using keybase or reading them from disk and returns the "expanded" list of pgp keys in the same order.

func ReadPGPFile Uses

func ReadPGPFile(path string) (string, error)

ReadPGPFile reads the given PGP file from disk.

type PubKeyFileFlag Uses

type PubKeyFileFlag string

PubKeyFileFlag implements flag.Value and command.Example to receive exactly one PGP or keybase key via a flag.

func (*PubKeyFileFlag) Example Uses

func (p *PubKeyFileFlag) Example() string

func (*PubKeyFileFlag) Set Uses

func (p *PubKeyFileFlag) Set(val string) error

func (*PubKeyFileFlag) String Uses

func (p *PubKeyFileFlag) String() string

type PubKeyFilesFlag Uses

type PubKeyFilesFlag []string

PGPPubKeyFiles implements the flag.Value interface and allows parsing and reading a list of PGP public key files.

func (*PubKeyFilesFlag) Example Uses

func (p *PubKeyFilesFlag) Example() string

func (*PubKeyFilesFlag) Set Uses

func (p *PubKeyFilesFlag) Set(val string) error

func (*PubKeyFilesFlag) String Uses

func (p *PubKeyFilesFlag) String() string

Package pgpkeys imports 11 packages (graph) and is imported by 49 packages. Updated 2019-04-16. Refresh now. Tools for package owners.