No description
- Rust 100%
|
|
||
|---|---|---|
| .cargo | ||
| .claude | ||
| .forgejo/workflows | ||
| scripts | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| LICENSE | ||
| README.md | ||
| TFLXTLS_datasheet.txt | ||
ATECC608A Driver
no_std driver for the Microchip ATECC608A Secure Element.
Description
This crate provides a Rust interface for the ATECC608A Secure Element, supporting:
- P-256 ECDSA key pair generation
- P-256 ECDSA digital signatures
- P-256 ECDH key exchange
- Secure key storage (private keys never exposed to the MCU)
Features
- ✅
no_stdcompatible - ✅ Uses
embedded-halI2C traits - ✅ Hardware-accelerated cryptographic operations
- ✅ Private keys never exposed to the MCU
- ✅ Protection against physical attacks
Usage
Adding to your project
Add the dependency from the Forgejo registry:
[dependencies]
atecc608x = { version = "0.1.0", registry = "forgejo" }
embedded-hal = "1.0.0"
Configure the Forgejo registry in your project (e.g. in .cargo/config.toml or environment) so Cargo can resolve the forgejo registry index and authentication.
Basic example
use atecc608x::Atecc608x;
use embedded_hal::i2c::I2c;
// Initialize the driver (pass &mut i2c; you keep ownership of the bus)
let mut atecc = Atecc608x::new(&mut delay, &mut i2c, 0x60)?;
// Generate a P-256 key pair in slot 0
let public_key = atecc.generate_keypair(0)?;
// Sign a message hash
let message_hash = [0u8; 32]; // SHA-256 hash
let signature = atecc.sign(0, &message_hash)?;
// Perform ECDH key exchange
let peer_public_key = [0u8; 65]; // Peer public key
let shared_secret = atecc.ecdh(0, &peer_public_key)?;
Project structure
atecc608x/
├── src/
│ ├── lib.rs # Entry point and re-exports
│ ├── driver/ # Main driver implementation
│ ├── error.rs # Error types
│ ├── types.rs # Types (KeySlot, P256PublicKey, P256Signature)
│ ├── status.rs # Status handling
│ └── setup/ # Configuration profiles
├── scripts/
│ └── test.sh # Run tests
├── Cargo.toml
└── README.md