Documentation
¶
Index ¶
- type Cert
- type FileTpm
- func (tpm *FileTpm) DeleteKey(keyName enc.Name)
- func (tpm *FileTpm) GenerateKey(keyName enc.Name, keyType string, keySize uint64) enc.Buffer
- func (tpm *FileTpm) GetSigner(keyName enc.Name, keyLocatorName enc.Name) ndn.Signer
- func (tpm *FileTpm) KeyExist(keyName enc.Name) bool
- func (tpm *FileTpm) String() string
- func (tpm *FileTpm) ToFileName(keyNameBytes []byte) string
- type Identity
- type Key
- type Pib
- type SqliteCert
- type SqliteIdent
- type SqliteKey
- type SqlitePib
- func (pib *SqlitePib) GetCert(certName enc.Name) Cert
- func (pib *SqlitePib) GetIdentity(name enc.Name) Identity
- func (pib *SqlitePib) GetKey(keyName enc.Name) Key
- func (pib *SqlitePib) GetSignerForCert(certName enc.Name) ndn.Signer
- func (pib *SqlitePib) String() string
- func (pib *SqlitePib) Tpm() Tpm
- type Tpm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cert ¶
type Cert interface {
AsSigner() ndn.Signer
Name() enc.Name
Key() Key
Data() []byte
// KeyLocator is the name of the key/certificate which signs this certificate
KeyLocator() enc.Name
}
Cert represents a certificate one owns
type FileTpm ¶
type FileTpm struct {
// contains filtered or unexported fields
}
func (*FileTpm) DeleteKey ¶
(AI GENERATED DESCRIPTION): Deletes the key identified by `keyName` from the file‑based TPM, removing its stored key material and associated metadata.
func (*FileTpm) GenerateKey ¶
(AI GENERATED DESCRIPTION): Generates a new cryptographic key of the given type and size, stores it in the file‑based TPM under the specified name, and returns the key’s encoded representation as an `enc.Buffer`.
func (*FileTpm) GetSigner ¶
(AI GENERATED DESCRIPTION): Retrieves a signer for a given key name by reading, base64‑decoding, and parsing the private key file stored on disk (returning an RSA or EC signer if recognized).
func (*FileTpm) KeyExist ¶
(AI GENERATED DESCRIPTION): Checks whether a key with the specified name exists in the FileTpm’s storage by verifying the presence of the corresponding file.
func (*FileTpm) String ¶ added in v1.4.3
(AI GENERATED DESCRIPTION): Returns a human‑readable string describing the FileTpm, formatted as “file‑tpm (<path>)”.
func (*FileTpm) ToFileName ¶
(AI GENERATED DESCRIPTION): Generates a deterministic filename for a private key by hashing the supplied key name bytes with SHA‑256 and appending the “.privkey” extension.
type Key ¶
type Key interface {
Name() enc.Name
Identity() Identity
KeyBits() []byte
SelfSignedCert() Cert
GetCert(enc.Name) Cert
FindCert(func(Cert) bool) Cert
}
Key represents a key one owns (with both private and public keybits)
type SqliteCert ¶
type SqliteCert struct {
// contains filtered or unexported fields
}
func (*SqliteCert) AsSigner ¶
func (cert *SqliteCert) AsSigner() ndn.Signer
(AI GENERATED DESCRIPTION): Returns an ndn.Signer that signs packets using the private key associated with this certificate.
func (*SqliteCert) Data ¶
func (cert *SqliteCert) Data() []byte
(AI GENERATED DESCRIPTION): Returns the raw certificate bits stored in the SqliteCert.
func (*SqliteCert) Key ¶
func (cert *SqliteCert) Key() Key
(AI GENERATED DESCRIPTION): Retrieves the Key associated with this certificate by dropping the last two components of its name and looking up the resulting key name in the PIB, returning nil if the name is too short.
func (*SqliteCert) KeyLocator ¶
func (cert *SqliteCert) KeyLocator() enc.Name
(AI GENERATED DESCRIPTION): Returns the key‑locator name associated with this certificate.
func (*SqliteCert) Name ¶
func (cert *SqliteCert) Name() enc.Name
(AI GENERATED DESCRIPTION): Returns the Name of the certificate stored in this SqliteCert.
type SqliteIdent ¶
type SqliteIdent struct {
// contains filtered or unexported fields
}
func (*SqliteIdent) FindCert ¶
func (iden *SqliteIdent) FindCert(check func(Cert) bool) Cert
(AI GENERATED DESCRIPTION): Finds and returns the first certificate belonging to this identity that satisfies a given condition, searching all of its keys and delegating to each key’s FindCert, or nil if no match is found.
func (*SqliteIdent) GetKey ¶
func (iden *SqliteIdent) GetKey(keyName enc.Name) Key
(AI GENERATED DESCRIPTION): Retrieves the Key object identified by `keyName` from the SqliteIdent’s persistent identity base (PIB).
func (*SqliteIdent) Name ¶
func (iden *SqliteIdent) Name() enc.Name
(AI GENERATED DESCRIPTION): Returns the name stored in the SqliteIdent instance.
type SqliteKey ¶
type SqliteKey struct {
// contains filtered or unexported fields
}
func (*SqliteKey) FindCert ¶
(AI GENERATED DESCRIPTION): FindCert returns the first certificate linked to the key that satisfies the supplied predicate, or nil if no matching certificate exists.
func (*SqliteKey) GetCert ¶
(AI GENERATED DESCRIPTION): Retrieves and returns the certificate identified by the given name from the underlying persistent identity base (PIB).
func (*SqliteKey) Identity ¶
(AI GENERATED DESCRIPTION): Retrieves the owning Identity for the key by removing its two‑byte key‑ID suffix from the key’s name and looking up that identity in the PIB; returns nil if the key name is too short.
func (*SqliteKey) KeyBits ¶
(AI GENERATED DESCRIPTION): Returns the raw key bits of the SqliteKey as a byte slice.
func (*SqliteKey) Name ¶
(AI GENERATED DESCRIPTION): Retrieves and returns the name associated with this SqliteKey instance.
func (*SqliteKey) SelfSignedCert ¶
(AI GENERATED DESCRIPTION): Retrieves the first certificate stored under the key whose name contains the component “self” as the second‑to‑last component, indicating it is a self‑signed cert.
type SqlitePib ¶
type SqlitePib struct {
// contains filtered or unexported fields
}
func NewSqlitePib ¶
(AI GENERATED DESCRIPTION): Initializes a new SqlitePib instance by opening the specified SQLite database and associating it with the provided TPM.
func (*SqlitePib) GetCert ¶
(AI GENERATED DESCRIPTION): Retrieves the certificate with the given name from the SQLite PIB database, parses its stored data to extract the certificate and signer key, and returns a Cert object populated with this information (or nil if not found or invalid).
func (*SqlitePib) GetIdentity ¶
(AI GENERATED DESCRIPTION): Retrieves an identity from the PIB database by its name, returning a `SqliteIdent` instance if a matching record exists, otherwise nil.
func (*SqlitePib) GetKey ¶
(AI GENERATED DESCRIPTION): Retrieves a key from the SQLite PIB by name, returning a Key instance or nil if the key is missing or an error occurs.
func (*SqlitePib) GetSignerForCert ¶
(AI GENERATED DESCRIPTION): Retrieves a Signer for the given certificate name from the TPM, returning nil if the name has fewer than two components.
type Tpm ¶
type Tpm interface {
GetSigner(keyName enc.Name, keyLocatorName enc.Name) ndn.Signer
GenerateKey(keyName enc.Name, keyType string, keySize uint64) enc.Buffer
KeyExist(keyName enc.Name) bool
DeleteKey(keyName enc.Name)
}
Tpm is a sceure storage that holds the private key
func NewFileTpm ¶
(AI GENERATED DESCRIPTION): Creates a new FileTpm instance initialized with the specified file path.