Skip to main content

SecurityPolicy

Enum SecurityPolicy 

Source
pub enum SecurityPolicy {
    Permissive,
    NistPost2030,
    CryptrecCategory3Plus,
    HybridRequired,
}
Expand description

Security policy enforced across key generation, key import, and envelope encryption/decryption.

Variants§

§

Permissive

Allows all supported NIST PQC and hybrid KEMs (including Category 1 ML-KEM-512).

§

NistPost2030

Aligned with NIST IR 8547 (Post-2030): requires NIST-standardized PQC (FIPS 203 / 204 / 205) or a PQ/T hybrid built on it, and excludes quantum-vulnerable classical-only algorithms.

Currently accepts exactly the same algorithms as Self::Permissive. This is intentional. IR 8547 deprecates and then disallows only quantum-vulnerable algorithms (RSA, ECDSA, EdDSA, (EC)DH, …). It keeps every parameter set of ML-KEM, ML-DSA and SLH-DSA, including Category 1 / 2 sets such as ML-KEM-512, and it allows hybrids. Every algorithm this SDK implements is in that set: ML-KEM, ML-DSA, SLH-DSA, X-Wing and MLDSA65-Ed25519-SHA512. Unlike Self::Permissive, this policy states the compliance intent explicitly, and it must reject any classical-only algorithm, and any post-quantum algorithm NIST has not standardized, that is added in the future. For a minimum security category, use Self::CryptrecCategory3Plus.

§

CryptrecCategory3Plus

Aligned with Japan CRYPTREC PQC List (2026) baseline: enforces NIST Category 3+ (ML-KEM-768, ML-KEM-1024, or X-Wing); rejects ML-KEM-512.

§

HybridRequired

Enforces PQ + Classical Hybrid (X-Wing) for migration windows requiring defense-in-depth against both classical and quantum cryptanalysis.

Implementations§

Source§

impl SecurityPolicy

Source

pub const fn validate_kem(self, alg: KemAlgorithm) -> Result<()>

Checks whether alg satisfies this security policy.

Returns Error::PolicyViolation if alg is disallowed.

Source

pub const fn default_kem(self) -> KemAlgorithm

Recommended default KEM algorithm under this policy (X-Wing satisfies all policies).

Source

pub const fn validate_signature(self, alg: SignatureAlgorithm) -> Result<()>

Checks whether digital signature algorithm alg satisfies this security policy.

Returns Error::PolicyViolation if alg is disallowed.

Source

pub const fn default_signature(self) -> SignatureAlgorithm

Recommended default digital signature algorithm under this policy.

Returns SignatureAlgorithm::MlDsa65Ed25519 for Self::HybridRequired and SignatureAlgorithm::MlDsa65 otherwise.

Trait Implementations§

Source§

impl Clone for SecurityPolicy

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SecurityPolicy

Source§

impl Debug for SecurityPolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SecurityPolicy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for SecurityPolicy

Source§

impl PartialEq for SecurityPolicy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SecurityPolicy

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.