diff --git a/Cargo.toml b/Cargo.toml index 0c9c460..e5d5750 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ description = "An implementation of the ACE-OAuth framework" version = "0.4.0" edition = "2021" authors = ["Falko Galperin "] -rust-version = "1.58" +rust-version = "1.62" license = "MIT OR Apache-2.0" keywords = ["no_std", "framework", "oauth", "ace"] categories = ["authentication", "data-structures", "embedded", "encoding", "no-std"] diff --git a/src/common/test_helper.rs b/src/common/test_helper.rs index bd5e0ca..e0050a6 100644 --- a/src/common/test_helper.rs +++ b/src/common/test_helper.rs @@ -20,7 +20,7 @@ use rand::{CryptoRng, Rng}; use crate::common::cbor_map::ToCborMap; use crate::error::{AccessTokenError, CoseCipherError, MultipleCoseError}; -use crate::token::cose::encrypt::{CoseEncryptCipher, CoseKeyDistributionCipher}; +use crate::token::cose::encrypted::{CoseEncryptCipher, CoseKeyDistributionCipher}; use crate::token::cose::key::{CoseEc2Key, CoseSymmetricKey}; use crate::token::cose::CoseCipher; use crate::CoseSignCipher; @@ -93,11 +93,6 @@ where { fn from(x: CoseCipherError>) -> Self { match x { - CoseCipherError::HeaderAlreadySet { - existing_header_name, - } => CoseCipherError::HeaderAlreadySet { - existing_header_name, - }, CoseCipherError::VerificationFailure => CoseCipherError::VerificationFailure, CoseCipherError::DecryptionFailure => CoseCipherError::DecryptionFailure, CoseCipherError::Other(x) => CoseCipherError::Other(x.to_string()), @@ -119,12 +114,9 @@ where CoseCipherError::KeyAlgorithmMismatch(v, w) } CoseCipherError::DuplicateHeaders(v) => CoseCipherError::DuplicateHeaders(v), - CoseCipherError::InvalidKeyId(v) => CoseCipherError::InvalidKeyId(v), CoseCipherError::MissingKeyParam(v) => CoseCipherError::MissingKeyParam(v), CoseCipherError::InvalidKeyParam(v, w) => CoseCipherError::InvalidKeyParam(v, w), - CoseCipherError::TypeMismatch(v) => CoseCipherError::TypeMismatch(v), CoseCipherError::NoKeyFound => CoseCipherError::NoKeyFound, - CoseCipherError::IvRequired => CoseCipherError::IvRequired, CoseCipherError::MissingHeaderParam(v) => CoseCipherError::MissingHeaderParam(v), CoseCipherError::InvalidHeaderParam(v, w) => CoseCipherError::InvalidHeaderParam(v, w), CoseCipherError::AadUnsupported => CoseCipherError::AadUnsupported, @@ -144,10 +136,6 @@ where AccessTokenError::CoseCipherError(CoseCipherError::from(x)) } AccessTokenError::UnknownCoseStructure => AccessTokenError::UnknownCoseStructure, - AccessTokenError::NoMatchingRecipient => AccessTokenError::NoMatchingRecipient, - AccessTokenError::MultipleMatchingRecipients => { - AccessTokenError::MultipleMatchingRecipients - } } } } diff --git a/src/error/mod.rs b/src/error/mod.rs index 14203a6..ecfac10 100644 --- a/src/error/mod.rs +++ b/src/error/mod.rs @@ -248,31 +248,24 @@ pub enum CoseCipherError where T: Display, { - /// A header which the cipher is supposed to set has already been set. - HeaderAlreadySet { - /// The name of the header which has already been set. - existing_header_name: String, - }, /// The given signature or MAC tag is either invalid or does not match the given data. VerificationFailure, /// The given ciphertext could not be decrypted. DecryptionFailure, - /// A different error has occurred. Details are provided in the contained error. - Other(T), /// Key type is not supported. UnsupportedKeyType(KeyType), /// Curve is not supported by coset or the chosen cryptographic backend. UnsupportedCurve(EllipticCurve), - /// Algorithm is not supported by coset or the chosen cryptographic backend. + /// Algorithm is not supported by coset, the chosen cryptographic backend or dcaf-rs itself. UnsupportedAlgorithm(Algorithm), /// The cryptographic backend does not support deriving the public key from the private key, and - /// your provided key does not provide the public key parts even though it is required for this + /// the provided key does not provide the public key parts even though it is required for this /// operation. UnsupportedKeyDerivation, /// The algorithm has not explicitly been specified anywhere (protected headers, unprotected /// headers or the key itself). NoAlgorithmDeterminable, - /// Your provided key does not support the given operation. + /// The provided key does not support the given operation. KeyOperationNotPermitted(BTreeSet, KeyOperation), /// Key in given curve must be in different format. KeyTypeCurveMismatch(KeyType, EllipticCurve), @@ -281,50 +274,22 @@ where /// Algorithm provided in key does not match algorithm selected for operation. KeyAlgorithmMismatch(Algorithm, Algorithm), DuplicateHeaders(Vec