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
impl SignatureAlgorithmBuilder
Sourcepub fn dilithium2(self) -> SignatureAlgorithm
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. 大多数后量子签名应用的最佳选择。
Sourcepub fn dilithium3(self) -> SignatureAlgorithm
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 位级别安全性的应用。
Sourcepub fn dilithium5(self) -> SignatureAlgorithm
pub fn dilithium5(self) -> SignatureAlgorithm
Sourcepub fn ed25519(self) -> SignatureAlgorithm
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. 适用于不需要量子抗性的高性能应用。
Sourcepub fn ecdsa_p256(self) -> SignatureAlgorithm
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. 最适合需要标准合规性和互操作性的应用。