keyctl

package
v3.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package keyctl is a Go interface to linux kernel keyrings (keyctl interface)

Deprecated: Most callers should use either golang.org/x/sys/unix directly, or the original (and more extensive) github.com/jsipprell/keyctl .

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Link(parent Keyring, child ID) error

Link a key into a keyring

func SetPerm

func SetPerm(k ID, p KeyPerm) error

SetPerm sets the permissions on a key or keyring.

func Unlink(parent Keyring, child ID) error

Unlink an object from a keyring

Types

type ID

type ID interface {
	ID() int32
}

ID is unique 32-bit serial number identifiers for all Keys and Keyrings have.

type Key

type Key struct {
	Name string
	// contains filtered or unexported fields
}

Key represents a single key linked to one or more kernel keyrings.

func (*Key) Get

func (k *Key) Get() ([]byte, error)

Get the key's value as a byte slice

func (*Key) ID

func (k *Key) ID() int32

ID returns the 32-bit kernel identifier for a specific key

func (k *Key) Unlink() error

Unlink a key from the keyring it was loaded from (or added to). If the key is not linked to any other keyrings, it is destroyed.

type KeyPerm

type KeyPerm uint32

KeyPerm represents in-kernel access control permission to keys and keyrings as a 32-bit integer broken up into four permission sets, one per byte. In MSB order, the perms are: Processor, User, Group, Other.

const (
	// PermOtherAll sets all permission for Other
	PermOtherAll KeyPerm = 0x3f << (8 * iota)
	// PermGroupAll sets all permission for Group
	PermGroupAll
	// PermUserAll sets all permission for User
	PermUserAll
	// PermProcessAll sets all permission for Processor
	PermProcessAll
)

type Keyring

type Keyring interface {
	ID
	Add(string, []byte) (*Key, error)
	Search(string) (*Key, error)
}

Keyring is the basic interface to a linux keyctl keyring.

func SessionKeyring

func SessionKeyring() (Keyring, error)

SessionKeyring returns the current login session keyring

func UserKeyring

func UserKeyring() (Keyring, error)

UserKeyring returns the keyring specific to the current user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL