class
Matter::Crypto::Key
- Matter::Crypto::Key
- Reference
- Object
Overview
Represents a cryptographic key Models keys similar to JSON Web Key (JWK) format for compatibility
Defined in:
matter/crypto/key.crConstructors
-
.generate_key_pair : Key
Generate a random EC key pair
- .new(type : KeyType = KeyType::EC, curve : CurveType | Nil = CurveType::P256, extractable : Bool = true)
Class Method Summary
-
.compute_shared_secret(private_key : Key, peer_public_key : Key) : Bytes
Compute shared secret for Diffie-Hellman
-
.extract_private_key_from_der(der : Bytes) : Bytes
Extract 32-byte private key from DER format TODO: Make private after testing
-
.extract_public_key_from_der(der : Bytes) : Bytes
Extract 65-byte uncompressed public key from DER format TODO: Make private after testing
Instance Method Summary
- #algorithm : String | Nil
- #algorithm=(algorithm : String | Nil)
- #curve : CurveType | Nil
- #curve=(curve : CurveType | Nil)
- #extractable : Bool
- #extractable=(extractable : Bool)
-
#import_pkcs8(data : Bytes)
Import PKCS#8 private key
-
#import_sec1(data : Bytes)
Import SEC1 private key
-
#import_spki(data : Bytes)
Import SPKI public key
- #key_pair : BinaryKeyPair
-
#key_pair_bits : BinaryKeyPair | Nil
Import/export key pair
- #key_pair_bits=(pair : BinaryKeyPair)
- #operations : Array(String) | Nil
- #operations=(operations : Array(String) | Nil)
-
#private_bits : Bytes | Nil
Get/set private key bytes
- #private_bits=(value : Bytes | Nil)
- #private_key : Bytes
-
#public_bits : Bytes | Nil
Import/export public key in SEC1/SPKI format (0x04 || x || y)
- #public_bits=(value : Bytes)
-
#public_key : Bytes
Asserted accessors that raise if not present
- #type : KeyType
- #type=(type : KeyType)
-
#x_bits : Bytes | Nil
Get/set public key x coordinate
- #x_bits=(value : Bytes | Nil)
-
#y_bits : Bytes | Nil
Get/set public key y coordinate
- #y_bits=(value : Bytes | Nil)
Constructor Detail
Class Method Detail
Extract 32-byte private key from DER format
TODO Make private after testing
Extract 65-byte uncompressed public key from DER format
TODO Make private after testing