Crate umsh_crypto

Crate umsh_crypto 

Source
Expand description

Cryptographic traits and UMSH-specific key/packet operations.

This crate separates algorithm providers from protocol logic. The low-level traits such as AesProvider and Sha256Provider can be backed either by software implementations or hardware accelerators, while CryptoEngine implements the UMSH-specific derivation and packet-authentication rules.

§Example

use umsh_crypto::software::{SoftwareAes, SoftwareIdentity, SoftwareSha256};
use umsh_crypto::{CryptoEngine, NodeIdentity};

let alice = SoftwareIdentity::from_secret_bytes(&[0x11; 32]);
let bob = SoftwareIdentity::from_secret_bytes(&[0x22; 32]);
let shared = alice.shared_secret_with(bob.public_key()).unwrap();
let engine = CryptoEngine::new(SoftwareAes, SoftwareSha256);
let keys = engine.derive_pairwise_keys(&shared);

assert_ne!(keys.k_enc, [0u8; 16]);
assert_ne!(keys.k_mic, [0u8; 16]);

Re-exports§

pub use software::*;

Modules§

software

Structs§

CmacState
Incremental AES-CMAC state.
CryptoEngine
UMSH protocol crypto engine.
DerivedChannelKeys
Derived multicast or channel transport keys.
PairwiseKeys
Derived pairwise transport keys.
SharedSecret
Raw X25519 shared secret.

Enums§

CryptoError
Protocol-level crypto failures.

Traits§

AesCipher
AES block-cipher instance used by the protocol engine.
AesProvider
Factory for keyed AES cipher instances.
NodeIdentity
Node identity capable of signing and key agreement.
Sha256Provider
SHA-256 and HMAC-SHA-256 provider.