diff --git a/crates/matrix-sdk-crypto/src/x509/errors.rs b/crates/matrix-sdk-crypto/src/x509/errors.rs index 7ab441bf1..b44e548b4 100644 --- a/crates/matrix-sdk-crypto/src/x509/errors.rs +++ b/crates/matrix-sdk-crypto/src/x509/errors.rs @@ -108,8 +108,8 @@ pub enum RawX509SignatureParseError { #[error("could not parse SignatureAlgorithm.parameters")] SignatureAlgorithmParametersParseError(#[source] der::Error), - #[error("SignatureAlgorithm hash type does not match digest algorithm")] - UnexpectedSignatureAlgorithmHash, + #[error("unsupported SignatureAlgorithm hash algorithm: {}", .0.actual)] + UnsupportedSignatureAlgorithmHash(OidMismatch), #[error("unsupported SignatureAlgorithm mask generation function: {}", .0.actual)] UnsupportedSignatureAlgorithmMaskGen(OidMismatch), @@ -118,9 +118,9 @@ pub enum RawX509SignatureParseError { SignatureAlgorithmMaskGenParametersNotSet, #[error( - "SignatureAlgorithm mask generation function hash type does not match digest algorithm" + "unsupported SignatureAlgorithm mask generation function hash algorithm: {}", .0.actual )] - UnexpectedSignatureAlgorithmMaskGenHash, + UnsupportedSignatureAlgorithmMaskGenHash(OidMismatch), #[error("SignatureAlgorithm salt length is not 64: {0}")] UnsupportedSignatureAlgorithmSaltLen(u8), diff --git a/crates/matrix-sdk-crypto/src/x509/raw_x509_signature.rs b/crates/matrix-sdk-crypto/src/x509/raw_x509_signature.rs index 7be443a9b..6f3543eed 100644 --- a/crates/matrix-sdk-crypto/src/x509/raw_x509_signature.rs +++ b/crates/matrix-sdk-crypto/src/x509/raw_x509_signature.rs @@ -333,7 +333,7 @@ fn map_signer_info_algorithms_to_signature_scheme( .map_err(RawX509SignatureParseError::SignatureAlgorithmParametersParseError)?; assert_oid_matches(&signature_algorithm_params.hash.oid, &const_oid::db::rfc5912::ID_SHA_512) - .map_err(RawX509SignatureParseError::UnsupportedDigestAlgorithm)?; + .map_err(RawX509SignatureParseError::UnsupportedSignatureAlgorithmHash)?; assert_digest_alg_params_null_or_absent(&signature_algorithm_params.hash.parameters)?; assert_oid_matches(&signature_algorithm_params.mask_gen.oid, &const_oid::db::rfc5912::ID_MGF_1) @@ -345,7 +345,7 @@ fn map_signer_info_algorithms_to_signature_scheme( .ok_or(RawX509SignatureParseError::SignatureAlgorithmMaskGenParametersNotSet)?; assert_oid_matches(&mask_gen_params.oid, &const_oid::db::rfc5912::ID_SHA_512) - .map_err(RawX509SignatureParseError::UnsupportedDigestAlgorithm)?; + .map_err(RawX509SignatureParseError::UnsupportedSignatureAlgorithmMaskGenHash)?; assert_digest_alg_params_null_or_absent(&mask_gen_params.parameters)?; if signature_algorithm_params.salt_len != 64 {