Matter::Session::SecureMessage
Secure message encoder/decoder for Matter protocol Uses AES-128-CCM for authenticated encryption
Constants
Log = ::Log.for("matter.session.secure")
MIC_LENGTH = 16
MIC (Message Integrity Check) length in bytes
NONCE_LENGTH = 13
Nonce size for AES-CCM in Matter (13 bytes)
PRIVACY_NONCE_LENGTH = 13
Privacy nonce for unencrypted header (13 bytes)
Instance methods
build_aad(packet_header_bytes : Bytes) : Bytes
Build Additional Authenticated Data (AAD) for AES-CCM AAD = packet header (unencrypted portion)
build_nonce(source_node_id : UInt64, message_counter : UInt32, security_flags : UInt8 = 0_u8) : Bytes
Build nonce for AES-CCM encryption/decryption Matter spec format: security_flags (1 byte) | message_counter (4 bytes LE) | source_node_id (8 bytes LE)
decrypt(context : SecureContext, encrypted_payload : Bytes, message_counter : UInt32, packet_header : Codec::MessageCodec::PacketHeader, crypto : Crypto::CryptoBase = Crypto::StandardCrypto.new) : Bytes
Decrypt a message payload using session context
decrypt_with_params(key : Bytes, encrypted_payload : Bytes, source_node_id : UInt64, message_counter : UInt32, session_id : UInt16, security_flags : UInt8 = 0_u8, flags : UInt8 = 0_u8, crypto : Crypto::CryptoBase = Crypto::StandardCrypto.new) : Bytes
Decrypt with explicit parameters (for testing)
encrypt(context : SecureContext, payload : Bytes, packet_header : Codec::MessageCodec::PacketHeader, crypto : Crypto::CryptoBase = Crypto::StandardCrypto.new) : Bytes
Encrypt a message payload using session context
encrypt_with_params(key : Bytes, payload : Bytes, source_node_id : UInt64, message_counter : UInt32, session_id : UInt16, security_flags : UInt8 = 0_u8, flags : UInt8 = 0_u8, crypto : Crypto::CryptoBase = Crypto::StandardCrypto.new) : Bytes
Encrypt with explicit parameters (for testing)