keychain

package
v0.0.0-...-d1ba03b Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const EXT_CERT = ".cert"
View Source
const EXT_KEY = ".key"
View Source
const EXT_PEM = ".pem"

Variables

This section is empty.

Functions

func InsertFile

func InsertFile(kc ndn.KeyChain, content []byte) error

InsertFile inserts all signers and certs from the given content.

func NewKeyChain

func NewKeyChain(uri string, pubStore ndn.Store) (ndn.KeyChain, error)

Constructs a key chain instance using the specified URI scheme (mem or dir) and public key store, returning an error for invalid schemes.

func NewKeyChainDir

func NewKeyChainDir(path string, pubStore ndn.Store) (ndn.KeyChain, error)

NewKeyChainDir creates a new in-memory keychain.

func NewKeyChainMem

func NewKeyChainMem(pubStore ndn.Store) ndn.KeyChain

NewKeyChainMem creates a new in-memory keychain.

Types

type KeyChainDir

type KeyChainDir struct {
	// contains filtered or unexported fields
}

KeyChainDir is a directory-based keychain.

func (*KeyChainDir) Identities

func (kc *KeyChainDir) Identities() []ndn.KeyChainIdentity

Returns the list of identities managed by the key chain.

func (*KeyChainDir) IdentityByName

func (kc *KeyChainDir) IdentityByName(name enc.Name) ndn.KeyChainIdentity

Returns the key chain identity associated with the specified name.

func (*KeyChainDir) InsertCert

func (kc *KeyChainDir) InsertCert(wire []byte) error

Inserts a certificate into the keychain's memory and writes it to a persistent file with the certificate file extension.

func (*KeyChainDir) InsertKey

func (kc *KeyChainDir) InsertKey(signer ndn.Signer) error

Inserts a signer's key into the keychain's in-memory storage and persists it to a file with the designated key file extension.

func (*KeyChainDir) Store

func (kc *KeyChainDir) Store() ndn.Store

Returns the underlying storage implementation used by the key chain.

func (*KeyChainDir) String

func (kc *KeyChainDir) String() string

Returns a string representation of the KeyChainDir instance, including its associated path in the format "keychain-dir (path)".

type KeyChainMem

type KeyChainMem struct {
	// contains filtered or unexported fields
}

KeyChainMem is an in-memory keychain.

func (*KeyChainMem) Identities

func (kc *KeyChainMem) Identities() []ndn.KeyChainIdentity

Returns the slice of identities managed by the key chain.

func (*KeyChainMem) IdentityByName

func (kc *KeyChainMem) IdentityByName(name enc.Name) ndn.KeyChainIdentity

Returns the KeyChainIdentity with the specified name if it exists in the key chain, otherwise returns nil.

func (*KeyChainMem) InsertCert

func (kc *KeyChainMem) InsertCert(wire []byte) error

Inserts a key certificate into the key chain after validating its content type, name structure, and expiration, and updates associated identities.

func (*KeyChainMem) InsertKey

func (kc *KeyChainMem) InsertKey(signer ndn.Signer) error

Inserts a cryptographic signer into the key chain under its associated identity, attaching any existing certificates and ensuring no duplicate keys are added.

func (*KeyChainMem) Store

func (kc *KeyChainMem) Store() ndn.Store

Returns the public key store managed by the key chain for accessing and managing cryptographic keys.

func (*KeyChainMem) String

func (kc *KeyChainMem) String() string

Returns the string representation "keychain-mem" for the KeyChainMem instance when converted to a string.

Jump to

Keyboard shortcuts

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