Search documentation of grizzly

# View Source Grizzly.ZWave.Security (grizzly v7.4.2)

Helpers for security

# Summary

## Types

key()
key_byte()
key_exchange_fail_type()

Possible key exchange failures

## Functions

byte_to_keys(granted_keys_byte)
failed_type_from_byte(int)

Decode a byte representation of the key exchanged failed type

failed_type_to_byte(atom)
get_highest_level(keys)

Gets the highest security level key from a key list

key_byte(atom)

Get the byte representation of a key.

keys()

Get the list of available security keys

keys_to_byte(keys)
validate_user_input_pin_length(n)

Validate the user input pin length, should be a 16 bit number

# Types

Link to this type

# key()

View Source

    @type key() :: :s2_unauthenticated | :s2_authenticated | :s2_access_control | :s0

Link to this type

# key_byte()

View Source

    @type key_byte() :: 1 | 2 | 4 | 128

Link to this type

# key_exchange_fail_type()

View Source

    @type key_exchange_fail_type() ::
      :none
      | :key
      | :scheme
      | :curves
      | :decrypt
      | :cancel
      | :auth
      | :get
      | :verify
      | :report

Possible key exchange failures

- `:none` - Bootstrapping was successful
- `:key` - No match between requested and granted keys
- `:scheme` - no scheme is supported by the controller or joining node
- `:decrypt` - joining node failed to decrypt the input pin from the value. Wrong input value/DSK from user
- `:cancel` - user has canceled the S2 bootstrapping
- `:auth` - the echo kex change frame does not match the earlier exchanged frame
- `:get` - the joining node requested a key that was not granted by the controller at an earlier stage
- `:verify` - the joining node cannot verify and decrypt the exchanged key
- `:report` - the including node transmitted a frame containing a different key than what was currently being exchanged

# Functions

Link to this function

# byte_to_keys(granted_keys_byte)

View Source

    @spec byte_to_keys(byte()) :: [key()]

Link to this function

# failed_type_from_byte(int)

View Source

    @spec failed_type_from_byte(byte()) :: key_exchange_fail_type()

Decode a byte representation of the key exchanged failed type

Link to this function

# failed_type_to_byte(atom)

View Source

    @spec failed_type_to_byte(key_exchange_fail_type()) :: byte()

Link to this function

# get_highest_level(keys)

View Source

    @spec get_highest_level([key()]) :: key() | :none

Gets the highest security level key from a key list

Since Z-Wave will work at the highest S2 security group available on a node, if multiple groups are in a list of keys it will assume that highest level is the security level of the node who provided this list.

If the node S0 security Z-Wave will response with granted keys with the lone key being S0.

Link to this function

# key_byte(atom)

View Source

    @spec key_byte(key()) :: key_byte()

Get the byte representation of a key.

The key `:none` is an invalid key to encode to, so this function does not support encoding to that key.

Link to this function

# keys()

View Source

    @spec keys() :: [key()]

Get the list of available security keys

Link to this function

# keys_to_byte(keys)

View Source

    @spec keys_to_byte([key()]) :: byte()

Link to this function

# validate_user_input_pin_length(n)

View Source

    @spec validate_user_input_pin_length(non_neg_integer()) :: :valid | :invalid

Validate the user input pin length, should be a 16 bit number