Returns the encapsulation scheme.
The bytes (a view; do not mutate).
StaticcodecTagged-CBOR codec; the tag value selects the scheme, as the reference's TryFrom<CBOR>.
StaticfromCreate an EncapsulationPublicKey from an X25519PublicKey.
StaticfromCreate an EncapsulationPublicKey from raw X25519 public key bytes.
StaticfromCreate an EncapsulationPublicKey from an MLKEMPublicKey.
StaticfromCreate an EncapsulationPublicKey from raw MLKEM public key bytes.
Returns true if this is an X25519 public key.
Returns true if this is an MLKEM public key.
Returns the X25519 public key if this is an X25519 encapsulation key.
Returns the MLKEM public key if this is an MLKEM encapsulation key.
Returns the X25519 public key if available, or null.
Returns the MLKEM public key if available, or null.
Returns this object as an EncapsulationPublicKey.
This method allows EncapsulationPublicKey to implement the Encrypter interface.
Since this class is itself an encapsulation public key, it returns this.
This encapsulation public key
Encapsulate a new shared secret for this public key.
This generates a random shared secret and encapsulates it so that only the holder of the corresponding private key can recover it.
A tuple of [sharedSecret, ciphertext]
Compare with another EncapsulationPublicKey.
Get string representation.
EncapsulationPublicKey(<ref_hex_short>, <inner_key_display>)
where ref_hex_short is computed from the tagged-CBOR form.
Returns a unique reference to this EncapsulationPublicKey instance.
The reference is derived from the SHA-256 hash of the tagged CBOR representation, providing a unique, content-addressable identifier.
Returns the CBOR tags associated with this public key.
Returns the untagged CBOR encoding.
The tagged CBOR form; the tag follows the scheme.
StaticfromDecode tagged (X25519 or ML-KEM) or untagged (X25519) CBOR.
Represents a public key for key encapsulation.
Use this to encapsulate a shared secret for a recipient.