pub struct PublicKeyBundle { /* private fields */ }Expand description
The public keys of a hybrid keypair.
Serialize with PublicKeyBundle::to_bytes; parsing via
PublicKeyBundle::from_bytes validates every component.
Implementations§
Source§impl PublicKeyBundle
impl PublicKeyBundle
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Parse a v2 public-key bundle, validating the length and the components that support validation.
The X25519, ML-KEM-1024, and Ed25519 components are checked (a non-canonical Ed25519 point or an out-of-range ML-KEM key is rejected). ML-DSA-87 verifying keys have no upstream validation and are only length-checked; a structurally-invalid one simply fails verification later. X25519 has no point validation by design (every 32-byte string is a valid u-coordinate).
§Errors
Returns Error::InvalidKey if the encoding is malformed or a
validatable component fails validation.
Source§impl PublicKeyBundle
impl PublicKeyBundle
Sourcepub fn to_pem(&self) -> Result<String>
Available on crate feature pem only.
pub fn to_pem(&self) -> Result<String>
pem only.Serialize the public keys as a concatenated multi-PEM document.
§Errors
Returns Error::InvalidKey if any component fails to PEM-encode
(not expected for a valid bundle).
Sourcepub fn from_pem(pem: &str) -> Result<Self>
Available on crate feature pem only.
pub fn from_pem(pem: &str) -> Result<Self>
pem only.Parse a public-key bundle from a PublicKeyBundle::to_pem document.
The four blocks must appear in order (X25519, ML-KEM, ML-DSA, Ed25519).
Every component is validated (the result round-trips through the
canonical QSP2 parser).
§Errors
Returns Error::InvalidKey on any malformed block, wrong count,
wrong order, or component that fails validation.
Trait Implementations§
Source§impl Clone for PublicKeyBundle
impl Clone for PublicKeyBundle
Source§fn clone(&self) -> PublicKeyBundle
fn clone(&self) -> PublicKeyBundle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PublicKeyBundle
impl Debug for PublicKeyBundle
Source§impl<'de> Deserialize<'de> for PublicKeyBundle
Available on crate feature serde only.
impl<'de> Deserialize<'de> for PublicKeyBundle
serde only.