age

package
Version: v3.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MasterKey

type MasterKey struct {
	Identity     string // a Bech32-encoded private key
	Recipient    string // a Bech32-encoded public key
	EncryptedKey string // a sops data key encrypted with age
	// contains filtered or unexported fields
}

MasterKey is an age key used to encrypt and decrypt sops' data key.

func MasterKeyFromRecipient

func MasterKeyFromRecipient(recipient string) (*MasterKey, error)

MasterKeyFromRecipient takes a Bech32-encoded public key and returns a new MasterKey.

func MasterKeysFromRecipients

func MasterKeysFromRecipients(commaSeparatedRecipients string) ([]*MasterKey, error)

MasterKeysFromRecipients takes a comma-separated list of Bech32-encoded public keys and returns a slice of new MasterKeys.

func (*MasterKey) Decrypt

func (key *MasterKey) Decrypt() ([]byte, error)

Decrypt decrypts the EncryptedKey field with the age identity and returns the result.

func (*MasterKey) Encrypt

func (key *MasterKey) Encrypt(datakey []byte) error

Encrypt takes a sops data key, encrypts it with age and stores the result in the EncryptedKey field.

func (*MasterKey) EncryptIfNeeded

func (key *MasterKey) EncryptIfNeeded(datakey []byte) error

EncryptIfNeeded encrypts the provided sops' data key and encrypts it if it hasn't been encrypted yet.

func (*MasterKey) EncryptedDataKey

func (key *MasterKey) EncryptedDataKey() []byte

EncryptedDataKey returns the encrypted data key this master key holds.

func (*MasterKey) NeedsRotation

func (key *MasterKey) NeedsRotation() bool

NeedsRotation returns whether the data key needs to be rotated or not.

func (*MasterKey) SetEncryptedDataKey

func (key *MasterKey) SetEncryptedDataKey(enc []byte)

SetEncryptedDataKey sets the encrypted data key for this master key.

func (*MasterKey) ToMap

func (key *MasterKey) ToMap() map[string]interface{}

ToMap converts the MasterKey to a map for serialization purposes.

func (*MasterKey) ToString

func (key *MasterKey) ToString() string

ToString converts the key to a string representation.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL