Password-Authenticated Key Agreement protocols

Related tags

Cryptography PAKEs
Overview

RustCrypto: PAKEs dependency status

Password-Authenticated Key Agreement protocols implementation.

Warnings

Crates in this repository have not yet received any formal cryptographic and security reviews.

No efforts were yet taken in regards of blinding or erasing secrets from the memory.

USE AT YOUR OWN RISK.

Supported algorithms

Name Crates.io Documentation
SRP crates.io Documentation
spake2 crates.io Documentation

Rust version requirements

The MSRV (Minimum Supported Rust Version) is 1.32.0 . If/when this changes, it will be noted in the changelog, and the crate semver will be updated. So downstream projects should depend upon e.g. spake2 = "0.2" to avoid picking up new versions that would require a newer compiler.

SRP-v0.4.1 actually works with rustc-1.31.1, but this will probably be changed in the next release.

SPAKE2 required rustc-1.32 beginning with spake2-v0.2.0 .

Our CI scripts check all builds against a pinned version of rustc to test the intended MSRV. Sometimes upstream dependencies make surprising changes that could require a newer version of rustc, without changes to the source code in this repository, but hopefully this won't happen very frequently.

License

All crates are licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments
  • srp: rebuild library

    srp: rebuild library

    This PR is a complete rewrite of the SRP library. It includes many improvements over the old library at the expense of backwards compatibility.

    Improvements include:

    • Improved file and code organization
    • Access to individual SRP computations
    • Consistent sever and client API
    • Simpler API
    • Improved documentation with tests in documentation
    • New tests for compatibility with the RFC
    • Bumps dependencies
    • Timing safe verification comparisons
    • Modernized error handling
    • And much more...
    opened by jbis9051 20
  • Add spake2

    Add spake2

    This does a "git subtree add", moving the entire history of https://github.com/warner/spake2.rs into the spake2/ subdirectory of this repo. I think that's the appropriate thing to do.. it makes the history look a little funky (there are now two unparented commits, not just the usual one original commit), but it keeps all the revision IDs identical.

    If this seems reasonable and we land it, I'll add tags next (with names like spake2-0.1.0), and then update the travis config, then the READMEs.

    opened by warner 8
  • SRP: Pure get_password_verifier function

    SRP: Pure get_password_verifier function

    It would be awesome if the function get_password_verifier wouldn't require a client but just had a signature like fn get_password_verifier<D: Digest>(private_key: &[u8], params, &[u8]) -> Vec<u8> or something.

    opened by est31 5
  • update rand and curve25519-dalek crates

    update rand and curve25519-dalek crates

    This now only needs rand_core, not the full rand hierarchy, because the latest rand_core includes a basic OsRng function.

    The latest curve25519-dalek uses zeroize, which uses the alloc feature, which raises the spake2 MSRV to rustc-1.36 .

    It upgrades srp to use rand_core as well. The srp MSRV remains at rustc-1.32 .

    I update the travis config to exercise 1.36, because it seemed too hard to make it test srp/spake2 with different versions.

    fixes #21

    @newpavlov you might want to defer this until you made the SRP API changes you mentioned in #21

    opened by warner 4
  • Implement proof generation as per RFC2945.

    Implement proof generation as per RFC2945.

    This is a backward-incompatible change.

    For details, refer to:

    • https://tools.ietf.org/html/rfc2945
    • https://tools.ietf.org/html/rfc5054
    • http://srp.stanford.edu/design.html
    • https://github.com/RustCrypto/PAKEs/issues/20

    This resolves issue #20.

    opened by brndnmtthws 4
  • SRP: 'M' computation does not match RFC5054/RFC2945

    SRP: 'M' computation does not match RFC5054/RFC2945

    RFC5054 refers to RFC2945 for the computation of the 'M' value. However, this implementation does not seem to be following the standard.

    'M' should be computed as: M = H(H(N) XOR H(g) | H(U) | s | A | B | K)

    But instead, it is computed as: M1 = H(A, B, K) https://github.com/RustCrypto/PAKEs/blob/master/srp/src/client.rs#L170 https://github.com/RustCrypto/PAKEs/blob/master/srp/src/server.rs#L132

    I am not an expert of SRP, but am I missing something? The samples on the wikipedia page match the RFC, but I can't figure out why this implementation differs in that regard.

    Thanks for clarifying this portion of the code!

    opened by awakecoding 4
  • travis: exercise 1.31.1 and 1.32

    travis: exercise 1.31.1 and 1.32

    1.31.1 is our intended MSRV (Minimum Supported Rust Version), but we probably don't actually work there because of an insufficiently-constrained dependency that requires 1.32.

    1.32 is probably our actual MSRV, and will be the one we aim for going forward.

    refs #21

    opened by warner 3
  • SRP: tools::powm should use faster constant time exponentiation

    SRP: tools::powm should use faster constant time exponentiation

    There are methods for much more efficient and cryptographically appropriate modular exponentiation than what is currently implemented.

    I'm not familiar enough with the Rust ecosystem to specifically recommend something at this point. (Indeed, I read this code in the hopes of finding the recommended practice.)

    opened by jpgoldberg 3
  • More idiomatic Debug impl

    More idiomatic Debug impl

    debug_struct is built in and makes your Debug impl more consistent with others.

    I noodled for a while over trying to make it also tell you which Group it's generic over, I don't think there's a way to do it unmodified, but you can either add a Default bound to it, or just add a name() fn to the Group trait.

    opened by richo 3
  • Support the nousernameinx flag

    Support the nousernameinx flag

    Hello, I'm writing a client implementation of SRP, but the server I'm connecting to requires that the nousernameinx flag be set. How would I go about doing this, or what would this library have to change to support this? Thanks!

    opened by jkcoxson 2
  • build(deps): bump rand_core from 0.5.1 to 0.6.3

    build(deps): bump rand_core from 0.5.1 to 0.6.3

    Bumps rand_core from 0.5.1 to 0.6.3.

    Changelog

    Sourced from rand_core's changelog.

    [0.6.3] - 2019-01-04

    Fixes

    • Make the std feature require the optional rand_os dependency (#675)
    • Re-export the optional WASM dependencies of rand_os from rand to avoid breakage (#674)

    [0.6.2] - 2019-01-04

    Additions

    • Add Default for ThreadRng (#657)
    • Move rngs::OsRng to rand_os sub-crate; clean up code; use as dependency (#643) ##BLOCKER##
    • Add rand_xoshiro sub-crate, plus benchmarks (#642, #668)

    Fixes

    • Fix bias in UniformInt::sample_single (#662)
    • Use autocfg instead of rustc_version for rustc version detection (#664)
    • Disable i128 and u128 if the target_os is emscripten (#671: work-around Emscripten limitation)
    • CI fixes (#660, #671)

    Optimisations

    • Optimise memory usage of UnitCircle and UnitSphereSurface distributions (no PR)

    [0.6.1] - 2018-11-22

    • Support sampling Duration also for no_std (only since Rust 1.25) (#649)
    • Disable default features of libc (#647)

    [0.6.0] - 2018-11-14

    Project organisation

    Platforms

    • Add fork protection on Unix (#466)
    • Added support for wasm-bindgen. (#541, #559, #562, #600)
    • Enable OsRng for powerpc64, sparc and sparc64 (#609)
    • Use syscall from libc on Linux instead of redefining it (#629)

    RNGs

    • Switch SmallRng to use PCG (#623)
    • Implement Pcg32 and Pcg64Mcg generators (#632)
    • Move ISAAC RNGs to a dedicated crate (#551)
    • Move Xorshift RNG to its own crate (#557)
    • Move ChaCha and HC128 RNGs to dedicated crates (#607, #636)
    • Remove usage of Rc from ThreadRng (#615)

    Sampling and distributions

    • Implement Rng.gen_ratio() and Bernoulli::new_ratio() (#491)

    ... (truncated)

    Commits
    • 8792268 Merge pull request #1137 from rust-random/work2
    • 1bfc53d Update changelogs and bump version numbers
    • 4534311 Merge pull request #1133 from rust-random/work2
    • 81f1af8 Correct usage of reserve
    • fa17d1c Add comment to append_string for Standard
    • b4c1d66 Add DistString
    • 1947c89 Move Distribution trait and associates to sub-module
    • 98a0339 Merge pull request #1135 from dhardy/work
    • a7f8fb7 Prepare rand_chacha v0.3.1 release
    • 09d3df3 Merge pull request #1130 from dhardy/work
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • SPAKE2: Password not passed to memory-hard hash function

    SPAKE2: Password not passed to memory-hard hash function

    Hi,

    I noticed that the spake2 crate uses HKDF instead of a memory-hard hash function when converting the password to a scalar: https://github.com/RustCrypto/PAKEs/blob/04ca077f2706fbd4bb5ed903a22bdcd2f20b2b0a/spake2/src/lib.rs#L473

    According to the draft specification, as well as this analysis, implementers should use a function like scrypt to slow down brute-force attacks. My guess is that HKDF was used for interoperability with Magic Wormhole's Python implementation, where the one-time nature of passwords means brute force isn't a viable attack. However, this may be a problem for other use cases where a password can be attempted more than once without manual intervention from the other side.

    Workarounds include request rate limiting or for callers to send the password through something like scrypt first, using the derived key as input to SPAKE2. However, many users of the library won't know to do this, since the lack of a memory-hard function is not necessarily clear from the documentation.

    opened by ayyghost 2
  • deps: update to newer rand/hkdf crates

    deps: update to newer rand/hkdf crates

    I don't know what the Rust convention is, but when I see cargo outdated telling me that there are newer versions of dependencies that we might use, I'm tempted to upgrade. SPAKE2 is currently out-of-date on HKDF and the rand crate.

    I've got a PR for spake2's use of HKDF that I'll submit in a minute, but we can't update to rand-0.7 until curve25519-dalek does the same, because the random-element selection API cites a rand_core::CryptoRng trait that must be the same on both sides of the interface.

    I haven't looked closely at SRP, but it's behind on both rand (which should be easy) and generic-array (about which I have no idea).

    opened by warner 8
  • SRP: Use constant time comparisons of secrets

    SRP: Use constant time comparisons of secrets

    In srp/src/server.rs for example, we see

    if user_proof == d.result().as_slice() {
    

    where the types are byte slices, &[u8]. I suspect that the same kind of thing appears throughout the code (although I haven't checked).

    That will result in a non-constant time comparison, and expose this to timing attacks.

    I am new to Rust, so take my suggestion with a large grain of salt. It seems that if we create a trait for secrets and then implement comparison tests for that trait with constant time checks, we could use Rust's type system to enforce that we always have constant time comparisons.

    opened by jpgoldberg 5
  • no_std?

    no_std?

    I'd like to start working on optional no_std support, is there anything major preventing this, and if not, is it the sort of thing you would like to see merged?

    enhancement 
    opened by fmckeogh 5
Owner
Rust Crypto
Cryptographic algorithms written in pure Rust
Rust Crypto
Lockstitch is an incremental, stateful cryptographic primitive for symmetric-key cryptographic operations in complex protocols.

Lockstitch is an incremental, stateful cryptographic primitive for symmetric-key cryptographic operations (e.g. hashing, encryption, message authentication codes, and authenticated encryption) in complex protocols.

Coda Hale 3 Dec 27, 2022
✈️A private, authenticated, permissioned cargo registry

chartered a little dig at creating a private cargo repository with authenticated downloads, the plan is to have git connect to a git server we setup t

Jordan Doyle 121 Dec 26, 2022
Authenticated Encryption with Associated Data Algorithms: high-level encryption ciphers

RustCrypto: Authenticated Encryption with Associated Data (AEAD) Algorithms Collection of Authenticated Encryption with Associated Data (AEAD) algorit

Rust Crypto 457 Jan 4, 2023
Bessie - an authenticated, chunked cipher based on BLAKE3

Bessie Bessie is an authenticated, chunked cipher based on BLAKE3. Right now it's in the early design stages. See design.md. Although the Bessie ciphe

Jack O'Connor 12 Dec 9, 2022
A safe implementation of the secure remote password authentication and key-exchange protocol (SRP), SRP6a and legacy are as features available.

Secure Remote Password (SRP 6 / 6a) A safe implementation of the secure remote password authentication and key-exchange protocol (SRP version 6a). Ver

Sven Assmann 10 Nov 3, 2022
Rust implementation of the i2p client/server/router protocols

ri2p Rust implementation of the i2p client/server/router protocols Status Common Commands cargo build: Builds the ri2p binary cargo run: Runs the ri2p

Christopher Bilger 8 Nov 25, 2022
A multiplexed p2p network framework that supports custom protocols

Tentacle Overview This is a minimal implementation for a multiplexed p2p network based on yamux that supports mounting custom protocols. Architecture

漂流 188 Dec 19, 2022
An implementation of the paper "Honey Badger of BFT Protocols" in Rust. This is a modular library of consensus.

Honey Badger Byzantine Fault Tolerant (BFT) consensus algorithm Welcome to a Rust library of the Honey Badger Byzantine Fault Tolerant (BFT) consensus

null 335 Dec 25, 2022
Two-party and multi-party ECDSA protocols based on class group with Rust

CG-MPC-ECDSA This project aims to implement two-party and multi-party ECDSA protocols based on class group with Rust. It currently includes schemes de

LatticeX Foundation 16 Mar 17, 2022
Proteus: Programmable Protocols for Censorship Circumvention

Proteus Debug build (also used for tests): cargo build Release build (optimized): cargo build --release Run unit tests: cargo test Run integration

null 5 Jul 11, 2023
A Rust implementation of the ISO11783 (ISOBUS) & J1939 protocols

AgIsoStack-rs About This Library AgIsoStack-rs is an MIT licensed hardware agnostic ISOBUS (ISO11783) and SAE J1939 CAN stack written in Rust. This pr

null 7 Aug 7, 2023
Open Protocol Indexer, OPI, is the best-in-slot open-source indexing client for meta-protocols on Bitcoin.

OPI - Open Protocol Indexer Open Protocol Indexer, OPI, is the best-in-slot open-source indexing client for meta-protocols on Bitcoin. OPI uses a fork

Best in Slot 33 Dec 16, 2023
Master Password in Pure Rust

Master Password •••| This is the Rust version of the original found here. This can be used as a drop-in replacement for the reference C version, offer

Rust India 34 Apr 13, 2022
A Rust port of the password primitives used in Django Project.

Rust DjangoHashers A Rust port of the password primitives used in Django Project. Django's django.contrib.auth.models.User class has a few methods to

Ronaldo Ferreira 52 Nov 17, 2022
The simple password manager for geeks, built with Rust.

Rooster Rooster is a simple password manager for geeks (it works in the terminal). Rooster is made available free of charge. You can support its devel

Conrad Kleinespel 131 Dec 25, 2022
🐴 RusTOTPony — CLI manager of one-time password generators aka Google Authenticator

?? RusTOTPony CLI manager of time-based one-time password generators. It is a desktop alternative for Google Authenticator. Installation Arch Linux Pa

German Lashevich 23 Jan 5, 2023
A simple password manager written in rust

Passman - A password manager written in rust. How to use?: USAGE: passman option Currently available options are: new - initalize passman with a new m

Strawkage 7 Aug 26, 2021
A simple password manager written in Rust

ripasso A simple password manager written in Rust. The root crate ripasso is a library for accessing and decrypting passwords stored in pass format (G

Joakim Lundborg 550 Dec 30, 2022
Ruo is a dictionary-based password cracker written in rust 🦀 .

Ruo is a dictionary-based password cracker written in rust ?? . The primary purpose is to crack weak hashes/commonly used passwords.

Asjid Kalam 10 Mar 6, 2022