This Rust project demonstrates how to use CBOR, COSE, and ECIES in a single application.
ciborium
: For CBOR serialization and deserialization.cose
: For COSE signing and encryption.ecies
: For ECIES encryption and decryption.rand
: For random number generation.serde
andserde_cbor
: For serializing and deserializing Rust structs to and from CBOR.rsa
: For RSA key generation and signing.sha2
: For SHA-256 hashing.
- Clone the repository.
- Run
cargo build
to build the project. - Run
cargo run
to execute the application.
CBOR Data: [<...>]
COSE Data: [<...>]
Signature valid: true
Decrypted Data: [<...>]
Decoded Data: MyData { name: "example", value: 42 }
- The application first serializes a Rust struct to CBOR.
- It then signs the CBOR data using COSE with RSA keys.
- It verifies the signed COSE data.
- It encrypts the CBOR data using ECIES and then decrypts it.
- Finally, it deserializes the decrypted CBOR data back into the original Rust struct..