Crypto

The crypto component hosts all the implementations of cryptographic primitives we use in XMETA: hashing, signing, and key derivation/generation.

The NextGen directory contains implementations of cryptographic primitives that will be used in the upcoming versions: new crypto API Enforcing type safety, verifiable random functions, BLS signatures.

XMETA makes use of several cryptographic algorithms:

ยท SHA-3 as the main hash function. It is standardized in FIPS 202. It is based on the tiny_keccak XMETAry.

ยท X25519 to perform key exchanges. It is used to secure communications between validators via the Noise Protocol Framework. It is based on the x25519-dalek XMETAry.

ยท Ed25519 to perform signatures. It is used both for consensus signatures and for transaction signatures. EdDSA is planned to be added to the next revision of FIPS 186 as mentioned in NIST SP 800-144 Rev. 1. It is based on the ed25519-dalek XMETAry with additional security checks (e.g., for malleability).

ยท HKDF: HMAC-based Extract-and-Expand Key Derivation Function (HKDF) based on RFC 5869. It is used to generate keys from a salt (optional), seed, and application-info (optional).

How is this module organized?

legacy_crypto/src

โ”œโ”€โ”€ signing.rs # Ed25519 signature scheme

โ”œโ”€โ”€ hash.rs # Hash function (SHA-3)

โ”œโ”€โ”€ hkdf.rs # HKDF implementation (HMAC-based Extract-and-Expand Key Derivation Function based on RFC 5869)

โ”œโ”€โ”€ x25519.rs # X25519 keys generation

โ”œโ”€โ”€ macros/ # Derivations for SilentDebug and SilentDisplay

โ”œโ”€โ”€ utils.rs # Serialization utility functions

โ”œโ”€โ”€ unit_tests # Tests

โ”œโ”€โ”€ Xmeta.rs

Currently x25519.rs only exposes the logic for managing keys. The relevant cryptographic primitives to the Noise Protocol Framework are under the snow crate.

Last updated