module
JOSE::JWA::ECDH_ES
Overview
ECDH-ES key agreement with Concat KDF.
Defined in:
jose/jwa/ecdh_es.crClass Method Summary
-
.compute_shared_secret(our_private : LibCrypto::EC_KEY, their_public : LibCrypto::EC_KEY) : Bytes
Computes ECDH shared secret between our private key and the other party's public key.
-
.crv_for_nid(nid : Int32) : String
Returns the JWK crv string for a curve nid.
-
.derive_key(shared_secret : Bytes, algorithm : String, key_bits : Int32, apu : Bytes = Bytes.empty, apv : Bytes = Bytes.empty) : Bytes
Derives a symmetric key via Concat KDF (SHA-256 single-pass).
-
.ec_field_size(key : LibCrypto::EC_KEY) : Int32
Returns the field coordinate size in bytes for the curve of key.
-
.ec_field_size_for_nid(nid : Int32) : Int32
Returns the field coordinate byte length for the given curve nid (32 for P-256, 48 for P-384, or 66 for P-521).
-
.generate_ephemeral(nid : Int32) : LibCrypto::EC_KEY
Generates a fresh ephemeral EC key pair for the given curve NID.
-
.nid_for_crv(crv : String) : Int32
Returns the OpenSSL NID for the JWK crv string (
"P-256","P-384", or"P-521"). -
.public_key_bytes(key : LibCrypto::EC_KEY) : Bytes
Returns uncompressed public key bytes (04 ‖ x ‖ y) for an EC key.
Class Method Detail
Returns the field coordinate size in bytes for the curve of key.
Returns the field coordinate byte length for the given curve nid (32 for P-256, 48 for P-384, or 66 for P-521).
Generates a fresh ephemeral EC key pair for the given curve NID. Caller must free with LibCrypto.ec_key_free.
Returns the OpenSSL NID for the JWK crv string
("P-256", "P-384", or "P-521").
Returns uncompressed public key bytes (04 ‖ x ‖ y) for an EC key.