credentials

package
v0.0.0-...-3192b2a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxCHIPCertLength int = 400
	MaxDERCertLength  int = 600
)
View Source
const (
	CertChainElement_Rcac uint8 = 0
	CertChainElement_Icac uint8 = 1
	CertChainElement_Noc  uint8 = 2
)
View Source
const KEpochKeysMax = 3

Variables

This section is empty.

Functions

func SetDeviceAttestationCredentialsProvider

func SetDeviceAttestationCredentialsProvider(provider DeviceAttestationCredentialsProvider)

func SetGroupDataProvider

func SetGroupDataProvider(g *GroupDataProvider)

Types

type CertificateValidityPolicy

type CertificateValidityPolicy interface {
}

type DeviceAttestationCredentialsProvider

type DeviceAttestationCredentialsProvider interface {
	GetCertificationDeclaration()
	GetFirmwareInformation()
	GetDeviceAttestationCert()
	GetProductAttestationIntermediateCert()
	SignWithDeviceAttestationKey()
	IsDeviceAttestationCredentialsProviderSet() bool
}

func GetDeviceAttestationCredentialsProvider

func GetDeviceAttestationCredentialsProvider() DeviceAttestationCredentialsProvider

type EpochKey

type EpochKey struct {
	StartTime time.Time
	Key       [crypto.SymmetricKeyLengthBytes]byte // 对称加密密钥长度
}

func NewEpochKey

func NewEpochKey() *EpochKey

func (*EpochKey) Clear

func (e *EpochKey) Clear()

type ExampleDACProvider

type ExampleDACProvider interface {
	DeviceAttestationCredentialsProvider
}

type ExampleDACProviderImpl

type ExampleDACProviderImpl struct {
}

func (ExampleDACProviderImpl) GetCertificationDeclaration

func (e ExampleDACProviderImpl) GetCertificationDeclaration()

func (ExampleDACProviderImpl) GetDeviceAttestationCert

func (e ExampleDACProviderImpl) GetDeviceAttestationCert()

func (ExampleDACProviderImpl) GetFirmwareInformation

func (e ExampleDACProviderImpl) GetFirmwareInformation()

func (ExampleDACProviderImpl) GetProductAttestationIntermediateCert

func (e ExampleDACProviderImpl) GetProductAttestationIntermediateCert()

func (ExampleDACProviderImpl) IsDeviceAttestationCredentialsProviderSet

func (e ExampleDACProviderImpl) IsDeviceAttestationCredentialsProviderSet() bool

func (ExampleDACProviderImpl) SignWithDeviceAttestationKey

func (e ExampleDACProviderImpl) SignWithDeviceAttestationKey()

type FabricData

type FabricData struct {
	FabricIndex lib.FabricIndex
	FirstGroup  lib.GroupId
	GroupCount  uint16
	FirstMap    uint16
	MapCount    uint16
	KeysetCount uint16
	FirstKeyset lib.KeysetId
	Next        lib.FabricIndex
	// contains filtered or unexported fields
}

func (*FabricData) Deserialize

func (f *FabricData) Deserialize(d *tlv.Decoder) (err error)

func (*FabricData) Load

func (*FabricData) Serialize

func (f *FabricData) Serialize(e *tlv.Encoder) (err error)

func (*FabricData) UpdateKey

func (f *FabricData) UpdateKey() (lib.StorageKeyName, error)

type FabricInfo

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

func (*FabricInfo) CommitToStorage

func (info *FabricInfo) CommitToStorage(storage store.PersistentStorageDelegate)

func (*FabricInfo) CompressedFabricId

func (info *FabricInfo) CompressedFabricId() lib.CompressedFabricId

func (*FabricInfo) FabricId

func (info *FabricInfo) FabricId() lib.FabricId

func (*FabricInfo) FabricIndex

func (info *FabricInfo) FabricIndex() lib.FabricIndex

func (*FabricInfo) FetchRootPubkey

func (info *FabricInfo) FetchRootPubkey() (*crypto.P256PublicKey, error)

func (*FabricInfo) GetFabricLabel

func (info *FabricInfo) GetFabricLabel() string

func (*FabricInfo) GetNodeId

func (info *FabricInfo) GetNodeId() lib.NodeId

func (*FabricInfo) GetScopedNodeId

func (info *FabricInfo) GetScopedNodeId() lib.ScopedNodeId

func (*FabricInfo) GetScopedNodeIdForNode

func (info *FabricInfo) GetScopedNodeIdForNode(node lib.NodeId) lib.ScopedNodeId

func (*FabricInfo) GetVendorId

func (info *FabricInfo) GetVendorId() lib.VendorId

func (*FabricInfo) HasOperationalKey

func (info *FabricInfo) HasOperationalKey() bool

func (*FabricInfo) IsInitialized

func (info *FabricInfo) IsInitialized() bool

func (*FabricInfo) Reset

func (info *FabricInfo) Reset()

func (*FabricInfo) SetFabricLabel

func (info *FabricInfo) SetFabricLabel(label string)

func (*FabricInfo) SignWithOpKeypair

func (info *FabricInfo) SignWithOpKeypair(msg []byte) ([]byte, error)

type FabricInfoInitParams

type FabricInfoInitParams struct {
	NodeId                    lib.NodeId
	FabriceId                 lib.FabricId
	FabricIndex               lib.FabricIndex
	CompressedFabricId        lib.CompressedFabricId
	RootPublicKey             crypto.P256PublicKey
	VendorId                  uint16
	OperationalKeypair        crypto.P256Keypair
	HasExternallyOwnedKeypair bool
}

type FabricInfoProvider

type FabricInfoProvider interface {
	GetFabricLabel() string
	SetFabricLabel(label string)

	GetNodeId() lib.NodeId

	GetScopedNodeId() lib.ScopedNodeId
	GetScopedNodeIdForNode(node lib.NodeId) lib.ScopedNodeId

	FabricId() lib.FabricId
	FabricIndex() lib.FabricIndex

	CompressedFabricId() lib.CompressedFabricId

	GetVendorId() lib.VendorId

	IsInitialized() bool
	HasOperationalKey() bool
}

type FabricTable

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

func NewFabricTable

func NewFabricTable() *FabricTable

func (*FabricTable) AddFabricDelegate

func (f *FabricTable) AddFabricDelegate(delegate FabricTableDelegate) error

func (*FabricTable) AllocateEphemeralKeypairForCASE

func (f *FabricTable) AllocateEphemeralKeypairForCASE() *crypto.P256Keypair

func (*FabricTable) ClearCommitMarker

func (f *FabricTable) ClearCommitMarker()

func (*FabricTable) Delete

func (f *FabricTable) Delete(index lib.FabricIndex) error

func (*FabricTable) DeleteAllFabrics

func (f *FabricTable) DeleteAllFabrics()

func (*FabricTable) FabricCount

func (f *FabricTable) FabricCount() uint8

func (*FabricTable) FabricLabel

func (f *FabricTable) FabricLabel(index lib.FabricIndex) (string, error)

func (*FabricTable) Fabrics

func (f *FabricTable) Fabrics() []*FabricInfo

func (*FabricTable) FetchCATs

func (f *FabricTable) FetchCATs(index lib.FabricIndex) ([]byte, error)

func (*FabricTable) FetchICACert

func (f *FabricTable) FetchICACert(index lib.FabricIndex) ([]byte, error)

func (*FabricTable) FetchNOCCert

func (f *FabricTable) FetchNOCCert(index lib.FabricIndex) ([]byte, error)

func (*FabricTable) FetchPendingNonFabricAssociatedRootCert

func (f *FabricTable) FetchPendingNonFabricAssociatedRootCert() ([]byte, error)

func (*FabricTable) FetchRootCert

func (f *FabricTable) FetchRootCert(index lib.FabricIndex) ([]byte, error)

func (*FabricTable) FetchRootPubkey

func (f *FabricTable) FetchRootPubkey(index lib.FabricIndex) (*crypto.P256PublicKey, error)

func (*FabricTable) FindFabricWithIndex

func (f *FabricTable) FindFabricWithIndex(index lib.FabricIndex) *FabricInfo

func (*FabricTable) Forget

func (f *FabricTable) Forget(index lib.FabricIndex)

func (*FabricTable) GetDeletedFabricFromCommitMarker

func (f *FabricTable) GetDeletedFabricFromCommitMarker() lib.FabricIndex

func (*FabricTable) HasPendingFabricUpdate

func (f *FabricTable) HasPendingFabricUpdate() bool

func (*FabricTable) Init

func (f *FabricTable) Init(params *FabricTableInitParams) error

func (*FabricTable) LastKnownGoodChipEpochTime

func (f *FabricTable) LastKnownGoodChipEpochTime() (time.Time, error)

func (*FabricTable) MutableFabricByIndex

func (f *FabricTable) MutableFabricByIndex(index lib.FabricIndex) *FabricInfo

func (*FabricTable) RemoveFabricDelegate

func (f *FabricTable) RemoveFabricDelegate(delegate FabricTableDelegate)

func (*FabricTable) RevertPendingFabricData

func (f *FabricTable) RevertPendingFabricData()

func (*FabricTable) SetFabricLabel

func (f *FabricTable) SetFabricLabel(label string) error

func (*FabricTable) SetLastKnownGoodChipEpochTime

func (f *FabricTable) SetLastKnownGoodChipEpochTime(t time.Time) error

func (*FabricTable) SignWithOpKeypair

func (f *FabricTable) SignWithOpKeypair(index lib.FabricIndex, msg []byte) (crypto.P256ECDSASignature, error)

type FabricTableContainer

type FabricTableContainer interface {
	Init(*FabricTableInitParams) error
	Delete(index lib.FabricIndex) error
	DeleteAllFabrics()
	GetDeletedFabricFromCommitMarker() lib.FabricIndex
	ClearCommitMarker()
	Forget(index lib.FabricIndex)
	AddFabricDelegate(delegate FabricTableDelegate) error
	RemoveFabricDelegate(delegate FabricTableDelegate)
	SetFabricLabel(label string) error
	GetFabricLabel(index lib.FabricIndex) (string, error)
	GetLastKnownGoodChipEpochTime() (time.Time, error)
	SetLastKnownGoodChipEpochTime(time.Time) error
	FabricCount() uint8

	HasPendingFabricUpdate() bool

	FetchRootCert(lib.FabricIndex) ([]byte, error)
	FetchPendingNonFabricAssociatedRootCert() ([]byte, error)
	FetchICACert(index lib.FabricIndex) ([]byte, error)
	FetchNOCCert(index lib.FabricIndex) ([]byte, error)
	FetchRootPublicKey(index lib.FabricIndex) ([]byte, error)
	FetchCATs(index lib.FabricIndex) ([]byte, error)
	SignWithOpKeypair(lib.FabricIndex) *crypto.P256ECDSASignature
	FindFabricWithIndex(index lib.FabricIndex) *FabricInfo
}

type FabricTableDelegate

type FabricTableDelegate interface {
	FabricWillBeRemoved(table *FabricTable, index lib.FabricIndex)
	OnFabricRemoved(table *FabricTable, index lib.FabricIndex)
	OnFabricCommitted(table *FabricTable, index lib.FabricIndex)
	OnFabricUpdated(table *FabricTable, index lib.FabricIndex)
}

type FabricTableInitParams

type FabricTableInitParams struct {
	Storage             store.PersistentStorageDelegate
	OperationalKeystore crypto.OperationalKeystore
	OpCertStore         PersistentStorageOpCertStore
}

func NewFabricTableInitParams

func NewFabricTableInitParams() *FabricTableInitParams

type GroupDataProvider

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

func GetGroupDataProvider

func GetGroupDataProvider() *GroupDataProvider

func NewGroupDataProvider

func NewGroupDataProvider() *GroupDataProvider

func (*GroupDataProvider) GetIpkKeySet

func (g *GroupDataProvider) GetIpkKeySet(index lib.FabricIndex) (outKeyset *KeySet, err error)

func (*GroupDataProvider) GroupSessions

func (g *GroupDataProvider) GroupSessions(sessionId uint16) []*GroupSession

func (*GroupDataProvider) Init

func (g *GroupDataProvider) Init() error

func (*GroupDataProvider) KeyContext

func (g *GroupDataProvider) KeyContext(fabricIndex lib.FabricIndex, groupId lib.GroupId) crypto.SymmetricKeyContextBase

func (*GroupDataProvider) SetListener

func (g *GroupDataProvider) SetListener(listener GroupListener)

func (*GroupDataProvider) SetStorageDelegate

func (g *GroupDataProvider) SetStorageDelegate(delegate store.PersistentStorageDelegate)

type GroupDataProviderBase

type GroupDataProviderBase interface {
	SetStorageDelegate(delegate store.PersistentStorageDelegate)
	Init() error
	SetListener(listener GroupListener)
	GetIpkKeySet(index lib.FabricIndex) (*KeySet, error)
	GroupSessions(sessionId uint16) []*GroupSession
}

type GroupDataProviderImpl

type GroupDataProviderImpl struct {
}

type GroupEndpoint

type GroupEndpoint struct {
	GroupId    lib.GroupId
	EndPointId lib.EndpointId
}

type GroupInfo

type GroupInfo struct {
	Id lib.GroupId
}

type GroupKey

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

type GroupKeyContext

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

func (GroupKeyContext) KeyHash

func (g GroupKeyContext) KeyHash() uint16

func (GroupKeyContext) MessageEncrypt

func (g GroupKeyContext) MessageEncrypt(plaintext, nonce, addData []byte, tagSize int) (cipherTag []byte, err error)

func (GroupKeyContext) Release

func (g GroupKeyContext) Release()

type GroupListener

type GroupListener interface {
	OnGroupAdded(fabricIndex lib.FabricIndex, newGroup *GroupInfo)
	OnGroupRemoved(fabricIndex lib.FabricIndex, newGroup *GroupInfo)
}

type GroupSession

type GroupSession struct {
	GroupId        lib.GroupId
	FabricIndex    lib.FabricIndex
	SecurityPolicy SecurityPolicy
	Key            crypto.SymmetricKeyContextBase
}

type KeyMapData

type KeyMapData struct {
	*GroupKey
	LinkedData
	// contains filtered or unexported fields
}

func NewKeyMapData

func NewKeyMapData(index lib.FabricIndex, linkId uint16) *KeyMapData

func (KeyMapData) Load

type KeySet

type KeySet struct {
	NumKeysUsed uint8
	EpochKeys   []EpochKey
	Policy      any
	// contains filtered or unexported fields
}

type KeySetData

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

func (*KeySetData) Find

func (d *KeySetData) Find(mStorage store.PersistentStorageDelegate, fabric *FabricData, targetId lib.KeysetId) bool

type LinkedData

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

type OperationalCertificateStore

type OperationalCertificateStore interface {
	Init(persistentStorage store.PersistentStorageDelegate) error
}

type OperationalCertificateStoreImpl

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

func NewOperationalCertificateStoreImpl

func NewOperationalCertificateStoreImpl() *OperationalCertificateStoreImpl

func (OperationalCertificateStoreImpl) Init

type PersistentData

type PersistentData struct {
}

type PersistentStorageOpCertStore

type PersistentStorageOpCertStore interface {
	OperationalCertificateStore
	HasPendingRootCert() bool
	HasPendingNocChain() bool
	HasCertificateForFabric(fabricIndex lib.FabricIndex, element uint8) bool

	AddNewTrustedRootCertForFabric(fabricIndex lib.FabricIndex, rcac []byte) error

	AddNewOpCertsForFabric(fabricIndex lib.FabricIndex, noc []byte, icac []byte) error

	UpdateOpCertsForFabric(fabricIndex lib.FabricIndex, noc []byte, icac []byte) error

	CommitOpCertsForFabric(fabricIndex lib.FabricIndex) error

	RemoveOpCertsForFabric(fabricIndex lib.FabricIndex) error

	RevertPendingOpCerts()

	RevertPendingOpCertsExceptRoot()

	GetCertificate(fabricIndex lib.FabricIndex, element uint8) ([]byte, error)
}

type PersistentStorageOpCertStoreImpl

type PersistentStorageOpCertStoreImpl struct {
	*OperationalCertificateStoreImpl
}

func NewPersistentStorageOpCertStoreImpl

func NewPersistentStorageOpCertStoreImpl() *PersistentStorageOpCertStoreImpl

func (PersistentStorageOpCertStoreImpl) AddNewOpCertsForFabric

func (s PersistentStorageOpCertStoreImpl) AddNewOpCertsForFabric(fabricIndex lib.FabricIndex, noc []byte, icac []byte) error

func (PersistentStorageOpCertStoreImpl) AddNewTrustedRootCertForFabric

func (s PersistentStorageOpCertStoreImpl) AddNewTrustedRootCertForFabric(fabricIndex lib.FabricIndex, rcac []byte) error

func (PersistentStorageOpCertStoreImpl) CommitOpCertsForFabric

func (s PersistentStorageOpCertStoreImpl) CommitOpCertsForFabric(fabricIndex lib.FabricIndex) error

func (PersistentStorageOpCertStoreImpl) GetCertificate

func (s PersistentStorageOpCertStoreImpl) GetCertificate(fabricIndex lib.FabricIndex, element uint8) ([]byte, error)

func (PersistentStorageOpCertStoreImpl) HasCertificateForFabric

func (s PersistentStorageOpCertStoreImpl) HasCertificateForFabric(fabricIndex lib.FabricIndex, element uint8) bool

func (PersistentStorageOpCertStoreImpl) HasPendingNocChain

func (s PersistentStorageOpCertStoreImpl) HasPendingNocChain() bool

func (PersistentStorageOpCertStoreImpl) HasPendingRootCert

func (s PersistentStorageOpCertStoreImpl) HasPendingRootCert() bool

func (PersistentStorageOpCertStoreImpl) RemoveOpCertsForFabric

func (s PersistentStorageOpCertStoreImpl) RemoveOpCertsForFabric(fabricIndex lib.FabricIndex) error

func (PersistentStorageOpCertStoreImpl) RevertPendingOpCerts

func (s PersistentStorageOpCertStoreImpl) RevertPendingOpCerts()

func (PersistentStorageOpCertStoreImpl) RevertPendingOpCertsExceptRoot

func (s PersistentStorageOpCertStoreImpl) RevertPendingOpCertsExceptRoot()

func (PersistentStorageOpCertStoreImpl) UpdateOpCertsForFabric

func (s PersistentStorageOpCertStoreImpl) UpdateOpCertsForFabric(fabricIndex lib.FabricIndex, noc []byte, icac []byte) error

type SecurityPolicy

type SecurityPolicy uint8
const (
	TrustFirst SecurityPolicy = 1
)

type UnimplementedDACProvider

type UnimplementedDACProvider struct {
}

type ValidationContext

type ValidationContext struct {
}

Jump to

Keyboard shortcuts

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