pakery-crypto 0.1.0

Concrete cryptographic implementations for PAKE protocols
Documentation

pakery-crypto

crates.io docs.rs License: MIT OR Apache-2.0

Concrete cryptographic implementations for the pakery PAKE workspace.

This crate provides implementations of the traits defined in pakery-core, backed by well-known cryptographic libraries. Select the primitives you need via feature flags.

Usage

[dependencies]
pakery-crypto = { version = "0.1", features = ["ristretto255"] }

Available types

Ristretto255 (ristretto255 feature)

Type Implements
Ristretto255Group CpaceGroup
Ristretto255Dh DhGroup
Ristretto255Oprf Oprf
Sha512Hash Hash
HkdfSha512 Kdf
HmacSha512 Mac
SPAKE2_M_COMPRESSED SPAKE2 M constant
SPAKE2_N_COMPRESSED SPAKE2 N constant

P-256 (p256 feature)

Type Implements
P256Group CpaceGroup
P256Dh DhGroup
P256Oprf Oprf
Sha256Hash Hash
HkdfSha256 Kdf
HmacSha256 Mac
SPAKE2_P256_M_COMPRESSED SPAKE2 M constant (P-256)
SPAKE2_P256_N_COMPRESSED SPAKE2 N constant (P-256)

Argon2 (argon2 feature)

Type Implements
Argon2idKsf Ksf

Example: defining a ciphersuite

use pakery_cpace::CpaceCiphersuite;
use pakery_crypto::{Ristretto255Group, Sha512Hash};

struct MyCpaceSuite;

impl CpaceCiphersuite for MyCpaceSuite {
    type Group = Ristretto255Group;
    type Hash = Sha512Hash;
    const DSI: &'static [u8] = b"CPaceRistretto255";
    const HASH_BLOCK_SIZE: usize = 128;
    const FIELD_SIZE_BYTES: usize = 32;
}

Features

Feature Description
std (default) Enable std support
ristretto255 (default) Ristretto255 / SHA-512 primitives
p256 P-256 / SHA-256 primitives
argon2 Argon2id key-stretching function
getrandom Enable OS-backed RNG via rand_core/getrandom

Security

  • #![forbid(unsafe_code)]
  • Constant-time comparisons via subtle
  • Secret values zeroized on drop via zeroize

MSRV

The minimum supported Rust version is 1.79.

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.