module

Matter::Crypto

Constants

CRYPTO_AUTH_TAG_LENGTH = 16
CRYPTO_EC_CURVE = "prime256v1"

ECDSA P-256 constants (prime256v1)

CRYPTO_EC_KEY_BYTES = 32
CRYPTO_ENCRYPT_ALGORITHM = "aes-128-ccm"

Cryptographic constants for Matter protocol

CRYPTO_HASH_ALGORITHM = "sha256"
CRYPTO_SYMMETRIC_KEY_LENGTH = 16
Log = ::Log.for("matter.crypto")

Class methods

compute_sha256(data : Bytes | Array(Bytes)) : Bytes
Source
create_hkdf_key(secret : Bytes, salt : Bytes, info : Bytes, length : Int32 = 32) : Bytes
Source
create_key_pair
Source
create_pbkdf2_key(secret : Bytes, salt : Bytes, iterations : Int32, key_length : Int32) : Bytes
Source
decrypt(key : Bytes, data : Bytes, nonce : Bytes, aad : Bytes | Nil = nil) : Bytes
Source
encrypt(key : Bytes, data : Bytes, nonce : Bytes, aad : Bytes | Nil = nil) : Bytes

Convenience methods that delegate to the global instance

Source
generate_dh_secret(private_key : Key, peer_public_key : Key) : Bytes
Source
instance
Source
instance=(crypto : CryptoBase)
Source
private_key(private_key : Bytes | BinaryKeyPair, extractable : Bool = true) : Key

Factory methods for convenience

Source
public_key(public_key : Bytes, extractable : Bool = true) : Key
Source
random_big_int(size : Int32, max_value : BigInt | Nil = nil) : BigInt
Source
random_bytes(length : Int32) : Bytes
Source
random_uint16
Source
random_uint32
Source
random_uint64
Source
random_uint8

Random number convenience methods

Source
sign_ecdsa(private_key : Key, data : Bytes | Array(Bytes), dsa_encoding : String = "ieee-p1363") : Bytes
Source
sign_hmac(key : Bytes, data : Bytes) : Bytes
Source
symmetric_key(key_bytes : Bytes, extractable : Bool = true) : Key
Source
verify_ecdsa(public_key : Key, data : Bytes, signature : Bytes, dsa_encoding : String = "ieee-p1363") : Nil
Source

Nested types