pub struct AgileVerifyingKey { /* private fields */ }Expand description
Self-describing crypto-agile public verifying key (ML-DSA, SLH-DSA, or MLDSA65-Ed25519).
Implementations§
Source§impl AgileVerifyingKey
impl AgileVerifyingKey
Sourcepub const fn algorithm(&self) -> SignatureAlgorithm
pub const fn algorithm(&self) -> SignatureAlgorithm
Returns the signature algorithm of this verifying key.
Sourcepub fn raw_bytes(&self) -> &[u8] ⓘ
pub fn raw_bytes(&self) -> &[u8] ⓘ
Returns the raw algorithm verifying key bytes without agile framing.
Sourcepub fn from_raw(
policy: SecurityPolicy,
alg: SignatureAlgorithm,
raw: &[u8],
) -> Result<Self>
pub fn from_raw( policy: SecurityPolicy, alg: SignatureAlgorithm, raw: &[u8], ) -> Result<Self>
Constructs an agile verifying key from raw algorithm bytes, enforcing policy.
Sourcepub fn to_wire_bytes(&self) -> Vec<u8> ⓘ
pub fn to_wire_bytes(&self) -> Vec<u8> ⓘ
Serializes into self-describing wire bytes (QAVK || ver || alg_id || len || raw).
Sourcepub fn wire_algorithm(bytes: &[u8]) -> Result<SignatureAlgorithm>
pub fn wire_algorithm(bytes: &[u8]) -> Result<SignatureAlgorithm>
Reads the signature algorithm declared by a self-describing verifying key wire frame without enforcing any policy or validating the key material.
Intended for keyring routing: callers holding serialized keys can select the candidates
whose algorithm matches AgileSignature::algorithm and parse only those with
AgileVerifyingKey::from_wire_bytes under the active policy, so that unrelated legacy
keys in the ring never trigger a policy violation.
Returns the same framing errors as AgileVerifyingKey::from_wire_bytes
(Error::InvalidVerifyingKey or Error::InvalidLength).
Sourcepub fn from_wire_bytes(policy: SecurityPolicy, bytes: &[u8]) -> Result<Self>
pub fn from_wire_bytes(policy: SecurityPolicy, bytes: &[u8]) -> Result<Self>
Deserializes from self-describing wire bytes while enforcing policy.
Sourcepub fn verify(
&self,
policy: SecurityPolicy,
msg: &[u8],
ctx: &[u8],
sig: &AgileSignature,
) -> Result<()>
pub fn verify( &self, policy: SecurityPolicy, msg: &[u8], ctx: &[u8], sig: &AgileSignature, ) -> Result<()>
Verifies an agile signature sig over msg and context ctx while enforcing policy.
Sourcepub fn verify_with_keyring(
policy: SecurityPolicy,
keyring: &[&Self],
msg: &[u8],
ctx: &[u8],
sig: &AgileSignature,
) -> Result<SignatureAlgorithm>
pub fn verify_with_keyring( policy: SecurityPolicy, keyring: &[&Self], msg: &[u8], ctx: &[u8], sig: &AgileSignature, ) -> Result<SignatureAlgorithm>
Verifies sig against a keyring of trusted verifying keys for zero-downtime migration
across signature algorithms (e.g., ML-DSA-65, MLDSA65-Ed25519-SHA512, SLH-DSA-SHAKE-192f).
Returns Error::PolicyViolation if the signature’s algorithm is not allowed,
Error::ContextTooLong if ctx exceeds 255 bytes, and Error::InvalidSignature if
no key of the signature’s algorithm verifies it.