Documentation
¶
Index ¶
- Constants
- func InsertFile(kc ndn.KeyChain, content []byte) error
- func NewKeyChain(uri string, pubStore ndn.Store) (ndn.KeyChain, error)
- func NewKeyChainDir(path string, pubStore ndn.Store) (ndn.KeyChain, error)
- func NewKeyChainMem(pubStore ndn.Store) ndn.KeyChain
- type KeyChainDir
- func (kc *KeyChainDir) Identities() []ndn.KeyChainIdentity
- func (kc *KeyChainDir) IdentityByName(name enc.Name) ndn.KeyChainIdentity
- func (kc *KeyChainDir) InsertCert(wire []byte) error
- func (kc *KeyChainDir) InsertKey(signer ndn.Signer) error
- func (kc *KeyChainDir) Store() ndn.Store
- func (kc *KeyChainDir) String() string
- type KeyChainMem
- func (kc *KeyChainMem) Identities() []ndn.KeyChainIdentity
- func (kc *KeyChainMem) IdentityByName(name enc.Name) ndn.KeyChainIdentity
- func (kc *KeyChainMem) InsertCert(wire []byte) error
- func (kc *KeyChainMem) InsertKey(signer ndn.Signer) error
- func (kc *KeyChainMem) Store() ndn.Store
- func (kc *KeyChainMem) String() string
Constants ¶
const EXT_CERT = ".cert"
const EXT_KEY = ".key"
const EXT_PEM = ".pem"
Variables ¶
This section is empty.
Functions ¶
func InsertFile ¶
InsertFile inserts all signers and certs from the given content.
func NewKeyChain ¶
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 ¶
NewKeyChainDir 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.