Documentation ¶
Index ¶
- Constants
- func CalculateHMAC(payload, key []byte) []byte
- func CryptMessage(input, iv, key []byte) []byte
- func EncryptEBS(key []byte, message []byte) []byte
- func GenerateNonce() []byte
- type EncryptedMessage
- func (cmd EncryptedMessage) CommandClassID() cc.CommandClassID
- func (cmd EncryptedMessage) CommandID() cc.CommandID
- func (cmd EncryptedMessage) CommandIDString() string
- func (cmd *EncryptedMessage) MarshalBinary() (payload []byte, err error)
- func (cmd *EncryptedMessage) UnmarshalBinary(data []byte) error
- type ILayer
- type Layer
- func (s *Layer) DecryptMessage(cmd serialapi.ApplicationCommand, inclusionMode bool) ([]byte, error)
- func (s *Layer) EncapsulateMessage(srcNode byte, dstNode byte, commandID cc.CommandID, senderNonce []byte, ...) (*EncryptedMessage, error)
- func (s *Layer) GenerateInternalNonce() (Nonce, error)
- func (s *Layer) GetExternalNonce(key byte) (Nonce, error)
- func (s *Layer) ReceiveNonce(fromNode byte, report security.NonceReport)
- func (s *Layer) WaitForExternalNonce(nodeID byte) (Nonce, error)
- type Nonce
- type NonceTable
- type SequenceCounter
Constants ¶
View Source
const ( SecuritySequenceCounterMin byte = 1 SecuritySequenceCounterMax = 15 )
Variables ¶
This section is empty.
Functions ¶
func CalculateHMAC ¶
func CryptMessage ¶
func EncryptEBS ¶
func GenerateNonce ¶
func GenerateNonce() []byte
Types ¶
type EncryptedMessage ¶
type EncryptedMessage struct { SenderNonce []byte EncryptedPayload []byte ReceiverNonceID byte HMAC []byte }
func (EncryptedMessage) CommandClassID ¶
func (cmd EncryptedMessage) CommandClassID() cc.CommandClassID
func (EncryptedMessage) CommandID ¶
func (cmd EncryptedMessage) CommandID() cc.CommandID
func (EncryptedMessage) CommandIDString ¶
func (cmd EncryptedMessage) CommandIDString() string
func (*EncryptedMessage) MarshalBinary ¶
func (cmd *EncryptedMessage) MarshalBinary() (payload []byte, err error)
func (*EncryptedMessage) UnmarshalBinary ¶
func (cmd *EncryptedMessage) UnmarshalBinary(data []byte) error
type ILayer ¶
type ILayer interface { DecryptMessage(cmd serialapi.ApplicationCommand, inclusionMode bool) ([]byte, error) EncapsulateMessage(srcNode byte, dstNode byte, commandID cc.CommandID, senderNonce []byte, receiverNonce []byte, payload []byte, inclusionMode bool) (*EncryptedMessage, error) GenerateInternalNonce() (Nonce, error) GetExternalNonce(key byte) (Nonce, error) ReceiveNonce(fromNode byte, report security.NonceReport) WaitForExternalNonce(nodeID byte) (Nonce, error) }
type Layer ¶
type Layer struct {
// contains filtered or unexported fields
}
func (*Layer) DecryptMessage ¶
func (s *Layer) DecryptMessage(cmd serialapi.ApplicationCommand, inclusionMode bool) ([]byte, error)
@todo verify message hmac
func (*Layer) EncapsulateMessage ¶
func (*Layer) GenerateInternalNonce ¶
GenerateInternalNonce returns a new internal nonce and stores it in the internal nonce table.
NOTE: The Z-Wave docs are not very clear on this, but the "receiver nonce id" is simply the first byte of the nonce (which must be unique among all of the active internal nonces)
func (*Layer) ReceiveNonce ¶
func (s *Layer) ReceiveNonce(fromNode byte, report security.NonceReport)
ReceiveNonce stores the received nonce in the external nonce table. Additionally, it sets a timeout on the nonce (after which the nonce will be deleted from the nonce table) and notifies any goroutine that may be waiting for a nonce from the given node
type NonceTable ¶
type NonceTable struct {
// contains filtered or unexported fields
}
func NewNonceTable ¶
func NewNonceTable() *NonceTable
func (*NonceTable) Delete ¶
func (t *NonceTable) Delete(key byte)
type SequenceCounter ¶
type SequenceCounter struct {
// contains filtered or unexported fields
}
func NewSequenceCounter ¶
func NewSequenceCounter() *SequenceCounter
func (*SequenceCounter) Get ¶
func (s *SequenceCounter) Get(nodeID byte) (counter byte)
Click to show internal directories.
Click to hide internal directories.