pub struct Policy {
pub default_alg: String,
pub allow_algs: Vec<String>,
pub required_signatures: Option<RequiredSignatures>,
pub offline_ok: bool,
pub require_fips_only: bool,
pub require_level5: bool,
pub digest_alg: String,
pub allow_lower_levels: bool,
}Expand description
Signing policy describing allowed algorithms and approval requirements.
Fields§
§default_alg: StringDefault algorithm identifier (e.g., “mldsa-87”).
allow_algs: Vec<String>Whitelist of allowed algorithms.
required_signatures: Option<RequiredSignatures>Optional multi-party signature quorum requirement.
offline_ok: boolWhether signing is permitted without network transparency.
require_fips_only: boolEnforce FIPS-approved algorithms only (defaults to true).
require_level5: boolEnforce NIST PQC Level-5 defaults when true (default).
digest_alg: StringDigest algorithm (sha512 or shake256-64 for Level-5).
allow_lower_levels: boolExplicit escape hatch for non-Level-5 algorithms.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn canonical_hash(&self) -> [u8; 32]
pub fn canonical_hash(&self) -> [u8; 32]
Compute a canonical SHA-256 hash of the policy for inclusion in intents.
Sourcepub fn ensure_fips(&self, allow_nonfips: bool) -> Result<(), ValidationError>
pub fn ensure_fips(&self, allow_nonfips: bool) -> Result<(), ValidationError>
Enforce that non-FIPS algorithms are not used when policy forbids it.
Sourcepub fn enforce_level5(&self) -> Result<(), ValidationError>
pub fn enforce_level5(&self) -> Result<(), ValidationError>
Enforce Level-5 defaults when required.
Sourcepub fn ensure_quorum(&self, collected: usize) -> Result<(), ValidationError>
pub fn ensure_quorum(&self, collected: usize) -> Result<(), ValidationError>
Validate that the collected signatures satisfy the quorum constraint.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Policy
impl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more