Documentation ¶
Overview ¶
Package sypgp implements the openpgp integration into the apptainer project.
Index ¶
- Constants
- Variables
- func DecryptKey(k *openpgp.Entity, message string) error
- func EncryptKey(k *openpgp.Entity, pass string) error
- func FetchPubkey(ctx context.Context, fingerprint string, noPrompt bool, opts ...client.Option) (openpgp.EntityList, error)
- func GetPrivateEntity(f EntitySelector) (*openpgp.Entity, error)
- func GetTokenFile() string
- func NewHybridKeyRing(ctx context.Context, opts ...client.Option) (openpgp.KeyRing, error)
- func NewMultiKeyRing(keyrings ...openpgp.KeyRing) openpgp.KeyRing
- func PrintEntity(index int, e *openpgp.Entity)
- func PublicKeyRing() (openpgp.KeyRing, error)
- func PushPubkey(ctx context.Context, e *openpgp.Entity, opts ...client.Option) error
- func RecryptKey(k *openpgp.Entity, passphrase []byte) error
- func SearchPubkey(ctx context.Context, search string, longOutput bool, opts ...client.Option) error
- func SelectPrivKey(el openpgp.EntityList) (*openpgp.Entity, error)
- type EntitySelector
- type GenKeyPairOptions
- type Handle
- func (keyring *Handle) CheckLocalPubKey(ckey string) (bool, error)
- func (keyring *Handle) ExportPrivateKey(kpath string, armor bool) error
- func (keyring *Handle) ExportPubKey(kpath string, armor bool) error
- func (keyring *Handle) GenKeyPair(opts GenKeyPairOptions) (*openpgp.Entity, error)
- func (keyring *Handle) ImportKey(kpath string, setNewPassword bool) error
- func (keyring *Handle) LoadPrivKeyring() (openpgp.EntityList, error)
- func (keyring *Handle) LoadPubKeyring() (openpgp.EntityList, error)
- func (keyring *Handle) PathsCheck() error
- func (keyring *Handle) PrintPrivKeyring() error
- func (keyring *Handle) PrintPubKeyring() error
- func (keyring *Handle) PublicPath() string
- func (keyring *Handle) RemovePrivKey(toDelete string) error
- func (keyring *Handle) RemovePubKey(toDelete string) error
- func (keyring *Handle) SecretPath() string
- type HandleOpt
- type KeyExistsError
Constants ¶
const ( Directory = "keys" LegacyDirectory = "sypgp" PublicFile = "pgp-public" SecretFile = "pgp-secret" )
Variables ¶
var ( // ErrEmptyKeyring is the error when the public, or private keyring // empty. ErrEmptyKeyring = errors.New("keyring is empty") )
Functions ¶
func DecryptKey ¶
DecryptKey decrypts a private key provided a pass phrase.
func EncryptKey ¶
EncryptKey encrypts a private key using a pass phrase
func FetchPubkey ¶
func FetchPubkey(ctx context.Context, fingerprint string, noPrompt bool, opts ...client.Option) (openpgp.EntityList, error)
FetchPubkey pulls a public key from the Key Service.
func GetPrivateEntity ¶
func GetPrivateEntity(f EntitySelector) (*openpgp.Entity, error)
GetPrivateEntity retrieves the entity selected by f from the Apptainer private keyring.
func GetTokenFile ¶
func GetTokenFile() string
GetTokenFile returns a string describing the path to the stored token file
func NewHybridKeyRing ¶
NewHybridKeyRing returns a keyring backed by both the local public keyring and the configured keyserver.
func NewMultiKeyRing ¶
NewMultiKeyRing returns a keyring backed by different public keyring.
func PrintEntity ¶
PrintEntity pretty prints an entity entry
func PublicKeyRing ¶
PublicKeyRing retrieves the Apptainer public KeyRing.
func PushPubkey ¶
PushPubkey pushes a public key to the Key Service and displays the service's response if provided.
func RecryptKey ¶
RecryptKey Will decrypt a entity, then recrypt it with the same password. This function seems pritty usless, but its not!
func SearchPubkey ¶
SearchPubkey connects to a key server and searches for a specific key
func SelectPrivKey ¶
func SelectPrivKey(el openpgp.EntityList) (*openpgp.Entity, error)
SelectPrivKey prints a secret key list to user and returns the choice
Types ¶
type EntitySelector ¶
type EntitySelector func(el openpgp.EntityList) (*openpgp.Entity, error)
EntitySelector selects an Entity given an EntityList.
type GenKeyPairOptions ¶
type GenKeyPairOptions struct { Name string Email string Comment string Password string KeyLength int }
GenKeyPairOptions parameters needed for generating new key pair.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is a structure representing a keyring
func (*Handle) CheckLocalPubKey ¶
CheckLocalPubKey will check if we have a local public key matching ckey string returns true if there's a match.
func (*Handle) ExportPrivateKey ¶
ExportPrivateKey Will export a private key into a file (kpath).
func (*Handle) ExportPubKey ¶
ExportPubKey Will export a public key into a file (kpath).
func (*Handle) GenKeyPair ¶
func (keyring *Handle) GenKeyPair(opts GenKeyPairOptions) (*openpgp.Entity, error)
GenKeyPair generates an PGP key pair and store them in the sypgp home folder
func (*Handle) ImportKey ¶
ImportKey imports one or more keys from the specified file. The keys can be either a public or private keys, and the file can be either in binary or ascii-armored format.
func (*Handle) LoadPrivKeyring ¶
func (keyring *Handle) LoadPrivKeyring() (openpgp.EntityList, error)
LoadPrivKeyring loads the private keys from local store into an EntityList
func (*Handle) LoadPubKeyring ¶
func (keyring *Handle) LoadPubKeyring() (openpgp.EntityList, error)
LoadPubKeyring loads the public keys from local store into an EntityList
func (*Handle) PathsCheck ¶
PathsCheck creates the sypgp home folder, secret and public keyring files for non global keyring.
func (*Handle) PrintPrivKeyring ¶
PrintPrivKeyring prints the secret keyring read from the public local store
func (*Handle) PrintPubKeyring ¶
PrintPubKeyring prints the public keyring read from the public local store
func (*Handle) PublicPath ¶
PublicPath returns a string describing the path to the public keys store
func (*Handle) RemovePrivKey ¶
RemovePrivKey will delete a private key matching toDelete
func (*Handle) RemovePubKey ¶
RemovePubKey will delete a public key matching toDelete
func (*Handle) SecretPath ¶
SecretPath returns a string describing the path to the private keys store
type HandleOpt ¶
type HandleOpt func(*Handle)
HandleOpt is a type representing option which can be passed to NewHandle.
func GlobalHandleOpt ¶
func GlobalHandleOpt() HandleOpt
GlobalHandleOpt is the option to set a keyring as global.
type KeyExistsError ¶
type KeyExistsError struct {
// contains filtered or unexported fields
}
KeyExistsError is a type representing an error associated to a specific key.
func (*KeyExistsError) Error ¶
func (e *KeyExistsError) Error() string