Crate phalanx_crypto

Crate phalanx_crypto 

Source
Expand description

§Phalanx Protocol

A general-purpose group E2E encryption protocol designed for maximum security and flexibility.

Phalanx provides cryptographically secure group communication with forward secrecy, post-compromise security, and efficient key rotation. While designed for Legion Protocol, it can be used by any communication system requiring group E2E encryption.

§Features

  • Double Ratchet for forward secrecy and post-compromise security
  • Group key agreement using X25519 key exchange
  • ChaCha20-Poly1305 for authenticated encryption
  • BLAKE3 for key derivation and message authentication
  • Ed25519 for digital signatures
  • Flexible transport layer - works over any reliable channel
  • Zero-knowledge proofs for membership verification (planned)

§Security Properties

  • End-to-End Encryption: Only group members can decrypt messages
  • Forward Secrecy: Past messages remain secure even if current keys are compromised
  • Post-Compromise Security: Future messages remain secure after key compromise recovery
  • Authentication: All messages are cryptographically authenticated
  • Deniability: Messages cannot be proven to have been sent by a specific user
  • Metadata Protection: Minimal metadata leakage

§Basic Usage

use phalanx::{PhalanxGroup, Identity, GroupMessage};

// Create a new identity
let identity = Identity::generate();

// Create or join a group
let mut group = PhalanxGroup::new(identity);

// Encrypt a message
let plaintext = b"Hello, secure world!";
let encrypted = group.encrypt_message(plaintext)?;

// Decrypt a message
let decrypted = group.decrypt_message(&encrypted)?;
assert_eq!(decrypted, plaintext);

Re-exports§

pub use identity::Identity;
pub use identity::PublicKey;
pub use identity::PrivateKey;
pub use group::PhalanxGroup;
pub use group::GroupConfig;
pub use group::MembershipProof;
pub use message::GroupMessage;
pub use message::MessageContent;
pub use message::MessageType;
pub use message::EncryptedMessage;
pub use error::PhalanxError;
pub use error::Result;
pub use protocol::ProtocolVersion;
pub use protocol::HandshakeMessage;
pub use protocol::KeyRotationMessage;
pub use key_manager::AdvancedKeyManager;
pub use key_manager::KeyBackupStorage;
pub use key_manager::HsmProvider;
pub use async_group::AsyncPhalanxGroup;

Modules§

algorithms
Cryptographic parameters and algorithms used by Phalanx
async_group
Async support for Phalanx groups
constants
Protocol constants
crypto
Core cryptographic primitives for Phalanx Protocol
error
Error types for Phalanx Protocol
group
Group management and encryption for Phalanx Protocol
identity
Identity management for Phalanx Protocol
key_manager
Advanced key management for Phalanx Protocol
message
Message types and handling for Phalanx Protocol
protocol
Protocol messages and handshake logic for Phalanx