Module error

Module error 

Source
Expand description

Error types and handling for the seal-crypto-wrapper library.

seal-crypto-wrapper 库的错误类型和处理。

§Overview | 概述

This module defines a comprehensive error hierarchy that covers all possible failure modes in cryptographic operations. The error types are designed to provide clear, actionable information while maintaining security by not leaking sensitive details.

此模块定义了一个全面的错误层次结构,涵盖密码操作中所有可能的失败模式。 错误类型旨在提供清晰、可操作的信息,同时通过不泄露敏感细节来维护安全性。

§Error Categories | 错误分类

  • Cryptographic Errors: Algorithm-specific failures from the underlying crypto library

  • OS Errors: System-level failures (e.g., random number generation)

  • Format Errors: Data serialization, key format, and ciphertext structure issues

  • 密码学错误: 来自底层密码库的算法特定失败

  • 操作系统错误: 系统级失败(例如随机数生成)

  • 格式错误: 数据序列化、密钥格式和密文结构问题

§Error Handling Best Practices | 错误处理最佳实践

  • Always handle cryptographic errors gracefully

  • Never ignore authentication failures

  • Log errors appropriately without exposing sensitive data

  • Use proper error propagation with the ? operator

  • 始终优雅地处理密码学错误

  • 永远不要忽略认证失败

  • 适当记录错误而不暴露敏感数据

  • 使用 ? 操作符进行适当的错误传播

Enums§

BincodeError
Wrapper for bincode serialization and deserialization errors.
Error
Main error type for the seal-crypto-wrapper library.
FormatError
Errors related to data formatting, serialization, and structure validation.

Type Aliases§

Result
Convenient Result type alias for this library.