pub enum HpkeError {
Show 16 variants
ValidationError,
DeserializeError,
EncapError,
DecapError,
OpenError,
DeriveKeyPairError,
MessageLimitReached,
NotSupported,
InvalidPseudorandomKey,
InvalidKey,
KdfOutputTooLong,
Aead(AeadError),
EllipticCurve(EllipticCurveError),
MlKem(MlKemError),
Random(RandomError),
Unspecified,
}Expand description
Errors that can occur during HPKE setup, key encapsulation, key derivation or message encryption/decryption.
Variants§
ValidationError
A KEM input or output failed validation (e.g. an invalid or low-order public key was provided), or a pre-shared key mode input is missing (an empty pre-shared key or pre-shared key identifier).
DeserializeError
A key, encapsulated key or ciphertext could not be deserialized (e.g. wrong length or malformed encoding).
EncapError
The encapsulation step failed (e.g. the recipient’s public key is invalid).
DecapError
The decapsulation step failed (e.g. the encapsulated key is invalid, or the Diffie-Hellman output was rejected).
OpenError
The AEAD failed to decrypt the ciphertext (wrong key, tampered ciphertext or wrong associated data).
DeriveKeyPairError
Deriving a key pair from input keying material failed after exhausting all rejection-sampling candidates.
MessageLimitReached
A message length or sequence-number limit was reached: the plaintext
exceeds the AEAD’s P_MAX, the ciphertext exceeds C_MAX, or the
context has exhausted its sequence numbers, so no further messages can
be sealed or opened with this context (draft-ietf-hpke-hpke-05
Sections 4.3 and 5.2).
NotSupported
The operation is not supported by this KEM, KDF or AEAD (e.g. an authenticated mode with a KEM that does not support it, or sealing a message with the Export-Only pseudo-AEAD).
InvalidPseudorandomKey
The pseudorandom key given to the KDF expand step does not have the expected length.
InvalidKey
The key given to the AEAD does not have the expected length.
KdfOutputTooLong
The KDF was asked for more output than it can produce
(255 * OUTPUT_SIZE for two-stage KDFs, 2^16 - 1 bytes for
single-stage KDFs).
Aead(AeadError)
An underlying AEAD error.
EllipticCurve(EllipticCurveError)
An underlying elliptic-curve error.
MlKem(MlKemError)
An underlying ML-KEM error.
Random(RandomError)
The operating system’s random number generator failed.
Unspecified
Something went wrong, without further details.
Trait Implementations§
impl Copy for HpkeError
impl Eq for HpkeError
Source§impl Error for HpkeError
impl Error for HpkeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()