Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blindspot22/rust_cbor_cose_ecies
Implementing an example in rust with CBOR / COSE and ECIES
https://github.com/blindspot22/rust_cbor_cose_ecies
cbor cose ecies ecies-encryption rust rust-lang
Last synced: 4 days ago
JSON representation
Implementing an example in rust with CBOR / COSE and ECIES
- Host: GitHub
- URL: https://github.com/blindspot22/rust_cbor_cose_ecies
- Owner: Blindspot22
- License: mit
- Created: 2024-06-07T09:58:48.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-09-03T09:06:41.000Z (5 months ago)
- Last Synced: 2025-01-17T01:11:57.627Z (13 days ago)
- Topics: cbor, cose, ecies, ecies-encryption, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 42 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust_cbor_cose_ecies
This Rust project demonstrates how to use CBOR, COSE, and ECIES in a single application.
## Dependencies
- `ciborium`: For CBOR serialization and deserialization.
- `cose`: For COSE signing and encryption.
- `ecies`: For ECIES encryption and decryption.
- `rand`: For random number generation.
- `serde` and `serde_cbor`: For serializing and deserializing Rust structs to and from CBOR.
- `rsa`: For RSA key generation and signing.
- `sha2`: For SHA-256 hashing.## Usage
1. Clone the repository.
2. Run `cargo build` to build the project.
3. Run `cargo run` to execute the application.## Example Output
CBOR Data: [<...>]
COSE Data: [<...>]
Signature valid: true
Decrypted Data: [<...>]
Decoded Data: MyData { name: "example", value: 42 }
## Explanation
- 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..