Expand description
§reallyme-crypto
Umbrella crate that re-exports the ReallyMe cryptographic primitives, dispatch and signer abstractions behind one dependency and a consistent feature set.
§Platform lanes
Rust exposes two backend lanes selected by Cargo feature and target:
native (portable Rust) and wasm (browser/Node host bindings).
Swift and Kotlin provider selection lives in their package facades; those
facades call this Rust workspace through FFI/JNI only for algorithms whose
provider policy explicitly selects Rust. A lane never silently falls back to
another backend.
The canonical contract is not the Rust API by itself. It is the shared set of protobuf/enums, package algorithm identifiers, typed error taxonomy, provider manifest, and conformance vectors. Rust is the reference implementation and the shared implementation for selected primitives; native platform routes are interchangeable only when vectors and typed-error tests prove identical input, output, failure, and edge-case behavior.
§Security posture
#![forbid(unsafe_code)] here; secret material is returned in zeroizing
wrappers; signature verification fails closed; and cross-implementation
conformance vectors pin the Rust output against an independent oracle.
See SECURITY.md and SECURITY_MEMORY_MODEL.md at the repository root.
§Example: sign then verify
A detached signature round-trip through dispatch (requires the
dispatch and ed25519 features, both on by default). Verification
fails closed — tampering with the message yields Err, never Ok(false).
use reallyme_crypto::core::Algorithm;
use reallyme_crypto::dispatch::{generate_keypair, sign, verify};
let (public, secret) = generate_keypair(Algorithm::Ed25519)?;
let message = b"attested payload";
let signature = sign(Algorithm::Ed25519, &secret, message)?;
verify(Algorithm::Ed25519, &public, message, &signature)?;
// A signature never covers a different message: verify returns Err.
assert!(verify(Algorithm::Ed25519, &public, b"tampered", &signature).is_err());Re-exports§
pub use crypto_core as core;pub use envelopes_jwk as jwk;pub use envelopes_jwk_multikey as jwk_multikey;
Modules§
- aes
- AES-GCM authenticated encryption primitives and their typed key/nonce wrappers and length constants.
- aes_
gcm_ siv - AES-256-GCM-SIV nonce-misuse-resistant authenticated encryption primitive and its typed key/nonce wrappers and length constants.
- aes_kw
- AES-256 Key Wrap (RFC 3394) for wrapping compact key material.
- argon2id
- Argon2id password-based key derivation, including platform-tuned cost profiles and typed salt/secret/derived-key wrappers.
- chacha20_
poly1305 - ChaCha20-Poly1305 and XChaCha20-Poly1305 authenticated encryption primitives with typed key and nonce wrappers.
- concat_
kdf - JWA ECDH-ES Concat KDF over SHA-256 for deriving content-encryption keys from an ECDH shared secret.
- constant_
time - Constant-time (non-short-circuiting) byte-slice equality checks.
- csprng
- OS-backed cryptographically secure randomness and typed generators for AEAD nonces and Argon2 salts.
- dispatch
- Algorithm-selected dispatch: keygen, sign/verify, key agreement, KEM, AEAD,
hashing, and multikey binding routed by an
core::Algorithmselector. - ed25519
- Ed25519 signatures: keypair generation, sign/verify, and public-key encoding.
- hkdf
- HKDF (RFC 5869) extract-and-expand key derivation over the SHA-2/SHA-3 suites, with domain-separated key derivation helpers.
- hmac
- HMAC authentication tags over SHA-256 and SHA-512.
- hpke
- RFC 9180 HPKE Base-mode encryption over supported DHKEM/HKDF/AEAD suites.
- ml_
dsa_ 44 - ML-DSA-44 (FIPS 204) post-quantum signatures: keygen, sign/verify, and public-key encoding.
- ml_
dsa_ 65 - ML-DSA-65 (FIPS 204) post-quantum signatures: keygen, sign/verify, and public-key encoding.
- ml_
dsa_ 87 - ML-DSA-87 (FIPS 204) post-quantum signatures: keygen, sign/verify, and public-key encoding.
- ml_
kem_ 512 - ML-KEM-512 (FIPS 203) post-quantum key encapsulation: keygen, encapsulate, and decapsulate.
- ml_
kem_ 768 - ML-KEM-768 (FIPS 203) post-quantum key encapsulation: keygen, encapsulate, and decapsulate.
- ml_
kem_ 1024 - ML-KEM-1024 (FIPS 203) post-quantum key encapsulation: keygen, encapsulate, and decapsulate.
- p256
- NIST P-256 (secp256r1) ECDSA over pre-hashed messages, with public-key compression and Secure Enclave handle encoding.
- p384
- NIST P-384 (secp384r1) ECDSA and ECDH, with public-key compression/decompression helpers.
- p521
- NIST P-521 (secp521r1) ECDSA and ECDH, with public-key compression/decompression helpers.
- pbkdf2
- PBKDF2 (RFC 8018) for legacy password-based key derivation.
- rsa
- RSA signature verification for PKCS#1 v1.5 and PSS.
- secp256k1
- secp256k1 ECDSA signs SHA-256(message) once, returns compact low-S
r || s, and uses compressed SEC1 public keys as the canonical API representation. - sha2
- SHA-2-256 hashing and its fixed-length digest wrapper.
- sha3
- SHA-3-256 hashing and its fixed-length digest wrapper.
- signer
- Signer/verifier traits and dispatch-backed implementations for producing and checking detached signatures.
- slh_dsa
- SLH-DSA-SHA2-128s (FIPS 205) hash-based post-quantum signatures.
- x25519
- X25519 Diffie–Hellman key agreement and public-key encoding.
- x_wing
- X-Wing hybrid KEM suites over X25519 plus ML-KEM-768 or ML-KEM-1024.