pub trait DhAlgorithm:
Sized
+ PartialEq
+ Eq
+ Debug
+ Clone {
// Required method
fn output_length(&self) -> usize;
// Provided method
fn from_cose_ecdh(curve: impl Into<i128>) -> Option<Self> { ... }
}Expand description
An algorithm for diffie-hellman style key establishment.
This not only encodes the cryptographic algorithm, but also the curve, but not post-processing such as the KDF.
Note that while JOSE and COSE have not switched their identifiers to fully-specified for ECDH, it makes sense to group algorithm (practically always ECDH so far) and curve, as it helps making illegal states unrepresentable.
The current constructors do not cover the breadth of what the interface can do, as COSE does not have entries for non-EC DH (or ony other) key agreement.
Required Methods§
Sourcefn output_length(&self) -> usize
fn output_length(&self) -> usize
Length of the shared secret produced by keys of this algorithm.
Provided Methods§
Sourcefn from_cose_ecdh(curve: impl Into<i128>) -> Option<Self>
fn from_cose_ecdh(curve: impl Into<i128>) -> Option<Self>
Selects a DH algorithm from its COSE numbers.
The curve number comes from the “COSE Elliptic Curves” registry maintained by IANA.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".