Struct SignatureAlgorithmBuilder

Source
pub struct SignatureAlgorithmBuilder;
Expand description

Builder for constructing signature algorithm instances.

用于构建签名算法实例的构建器。

§Usage Pattern | 使用模式

use seal_crypto_wrapper::algorithms::asymmetric::signature::SignatureAlgorithm;

// Traditional algorithms
let ed25519 = SignatureAlgorithm::build().ed25519();
let ecdsa = SignatureAlgorithm::build().ecdsa_p256();

// Post-quantum algorithms
let dilithium2 = SignatureAlgorithm::build().dilithium2();
let dilithium3 = SignatureAlgorithm::build().dilithium3();
let dilithium5 = SignatureAlgorithm::build().dilithium5();

§Algorithm Selection Guidelines | 算法选择指南

Consider these factors when choosing:

  • Performance Requirements: Ed25519 > ECDSA P-256 > Dilithium
  • Signature Size: Ed25519 ≈ ECDSA P-256 << Dilithium
  • Quantum Resistance: Only Dilithium provides quantum resistance
  • Standardization: All algorithms are well-standardized

选择时考虑这些因素:

  • 性能要求: Ed25519 > ECDSA P-256 > Dilithium
  • 签名大小: Ed25519 ≈ ECDSA P-256 << Dilithium
  • 量子抗性: 只有 Dilithium 提供量子抗性
  • 标准化: 所有算法都经过良好标准化

Implementations§

Source§

impl SignatureAlgorithmBuilder

Source

pub fn dilithium2(self) -> SignatureAlgorithm

Selects Dilithium-2 post-quantum signature algorithm.

选择 Dilithium-2 后量子签名算法。

§Properties | 属性
  • Security Level: 128-bit (NIST Category 2)
  • Public Key: ~1.3KB
  • Private Key: ~2.5KB
  • Signature: ~2.4KB
  • Quantum Safe: Yes
§Performance | 性能
  • Key Generation: ~0.1ms
  • Signing: ~0.2ms
  • Verification: ~0.1ms
§Use Cases | 使用场景

Best choice for most post-quantum signature applications. 大多数后量子签名应用的最佳选择。

Source

pub fn dilithium3(self) -> SignatureAlgorithm

Selects Dilithium-3 post-quantum signature algorithm.

选择 Dilithium-3 后量子签名算法。

§Properties | 属性
  • Security Level: 192-bit (NIST Category 3)
  • Public Key: ~2KB
  • Private Key: ~4KB
  • Signature: ~3.3KB
  • Quantum Safe: Yes
§Use Cases | 使用场景

For applications requiring higher security than 128-bit level. 用于需要高于 128 位级别安全性的应用。

Source

pub fn dilithium5(self) -> SignatureAlgorithm

Selects Dilithium-5 post-quantum signature algorithm.

选择 Dilithium-5 后量子签名算法。

§Properties | 属性
  • Security Level: 256-bit (NIST Category 5)
  • Public Key: ~2.6KB
  • Private Key: ~4.9KB
  • Signature: ~4.6KB
  • Quantum Safe: Yes
§Use Cases | 使用场景

Maximum security for the most sensitive applications. 最敏感应用的最大安全性。

Source

pub fn ed25519(self) -> SignatureAlgorithm

Selects Ed25519 signature algorithm.

选择 Ed25519 签名算法。

§Properties | 属性
  • Security Level: 128-bit
  • Public Key: 32 bytes
  • Private Key: 32 bytes
  • Signature: 64 bytes
  • Quantum Safe: No
§Advantages | 优势
  • High Performance: Fastest signature algorithm

  • Deterministic: Same message always produces same signature

  • Small Keys: Compact key and signature sizes

  • No Hash Required: Built-in message hashing

  • 高性能: 最快的签名算法

  • 确定性: 相同消息总是产生相同签名

  • 小密钥: 紧凑的密钥和签名大小

  • 无需哈希: 内置消息哈希

§Use Cases | 使用场景

Ideal for high-performance applications not requiring quantum resistance. 适用于不需要量子抗性的高性能应用。

Source

pub fn ecdsa_p256(self) -> SignatureAlgorithm

Selects ECDSA P-256 signature algorithm.

选择 ECDSA P-256 签名算法。

§Properties | 属性
  • Security Level: 128-bit
  • Public Key: 64 bytes (uncompressed)
  • Private Key: 32 bytes
  • Signature: ~64 bytes (variable)
  • Quantum Safe: No
§Advantages | 优势
  • Wide Support: Extensively supported across platforms

  • Standards Compliance: NIST FIPS 186-4, RFC 6090

  • Interoperability: Compatible with many systems

  • Good Performance: Efficient implementation

  • 广泛支持: 跨平台广泛支持

  • 标准合规性: NIST FIPS 186-4, RFC 6090

  • 互操作性: 与许多系统兼容

  • 良好性能: 高效实现

§Use Cases | 使用场景

Best for applications requiring standards compliance and interoperability. 最适合需要标准合规性和互操作性的应用。

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V