module
Matter::Crypto
Defined in:
matter/crypto/aes/word_array.crmatter/crypto/crypto.cr
matter/crypto/ecdh.cr
matter/crypto/key.cr
matter/crypto/spake2p.cr
Constant Summary
-
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
Class Method Summary
- .compute_sha256(data : Bytes | Array(Bytes)) : Bytes
- .create_hkdf_key(secret : Bytes, salt : Bytes, info : Bytes, length : Int32 = 32) : Bytes
- .create_key_pair : Key
- .create_pbkdf2_key(secret : Bytes, salt : Bytes, iterations : Int32, key_length : Int32) : Bytes
- .decrypt(key : Bytes, data : Bytes, nonce : Bytes, aad : Bytes | Nil = nil) : Bytes
-
.encrypt(key : Bytes, data : Bytes, nonce : Bytes, aad : Bytes | Nil = nil) : Bytes
Convenience methods that delegate to the global instance
- .generate_dh_secret(private_key : Key, peer_public_key : Key) : Bytes
- .instance : CryptoBase
- .instance=(crypto : CryptoBase)
-
.private_key(private_key : Bytes | BinaryKeyPair, extractable : Bool = true) : Key
Factory methods for convenience
- .public_key(public_key : Bytes, extractable : Bool = true) : Key
- .random_big_int(size : Int32, max_value : BigInt | Nil = nil) : BigInt
- .random_bytes(length : Int32) : Bytes
- .random_uint16 : UInt16
- .random_uint32 : UInt32
- .random_uint64 : UInt64
-
.random_uint8 : UInt8
Random number convenience methods
- .sign_ecdsa(private_key : Key, data : Bytes | Array(Bytes), dsa_encoding : String = "ieee-p1363") : Bytes
- .sign_hmac(key : Bytes, data : Bytes) : Bytes
- .symmetric_key(key_bytes : Bytes, extractable : Bool = true) : Key
- .verify_ecdsa(public_key : Key, data : Bytes, signature : Bytes, dsa_encoding : String = "ieee-p1363") : Nil
Class Method Detail
def self.create_hkdf_key(secret : Bytes, salt : Bytes, info : Bytes, length : Int32 = 32) : Bytes
#
def self.create_pbkdf2_key(secret : Bytes, salt : Bytes, iterations : Int32, key_length : Int32) : Bytes
#
def self.decrypt(key : Bytes, data : Bytes, nonce : Bytes, aad : Bytes | Nil = nil) : Bytes
#
def self.encrypt(key : Bytes, data : Bytes, nonce : Bytes, aad : Bytes | Nil = nil) : Bytes
#
Convenience methods that delegate to the global instance
Factory methods for convenience
def self.sign_ecdsa(private_key : Key, data : Bytes | Array(Bytes), dsa_encoding : String = "ieee-p1363") : Bytes
#