beaconcrypt 0.4.2__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1}/Cargo.lock +9 -1
- beaconcrypt-0.5.1/Cargo.toml +9 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1}/PKG-INFO +1 -1
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/Cargo.toml +13 -17
- beaconcrypt-0.5.1/beaconcrypt/LICENSE +7 -0
- beaconcrypt-0.5.1/beaconcrypt/README.md +155 -0
- beaconcrypt-0.5.1/beaconcrypt/bindings.h +435 -0
- beaconcrypt-0.5.1/beaconcrypt/build.rs +60 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/examples/rust/main.rs +78 -12
- beaconcrypt-0.5.1/beaconcrypt/src/beacon.rs +577 -0
- beaconcrypt-0.5.1/beaconcrypt/src/cbinds.rs +1503 -0
- beaconcrypt-0.5.1/beaconcrypt/src/deser.rs +1022 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/src/error.rs +10 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/src/lib.rs +22 -7
- beaconcrypt-0.5.1/beaconcrypt/src/persistence.rs +1130 -0
- beaconcrypt-0.5.1/beaconcrypt/src/pqxdh.rs +588 -0
- beaconcrypt-0.5.1/beaconcrypt/src/pybinds.rs +559 -0
- beaconcrypt-0.5.1/beaconcrypt/src/ratchet.rs +622 -0
- beaconcrypt-0.5.1/beaconcrypt/src/ser.rs +404 -0
- beaconcrypt-0.5.1/beaconcrypt/src/server.rs +533 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/src/shared.rs +663 -607
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/tests/beacon.rs +3 -6
- beaconcrypt-0.5.1/beaconcrypt/tests/c_persistence.c +176 -0
- beaconcrypt-0.5.1/beaconcrypt/tests/construction.rs +39 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/tests/protocol.rs +466 -385
- beaconcrypt-0.5.1/beaconcrypt/tests/raw_receive.rs +164 -0
- beaconcrypt-0.5.1/beaconcrypt/tests/record_opening.rs +157 -0
- beaconcrypt-0.5.1/beaconcrypt/tests/registration_completion.rs +266 -0
- beaconcrypt-0.5.1/beaconcrypt/tests/registration_response_alias.rs +91 -0
- beaconcrypt-0.5.1/beaconcrypt/tests/rooterberg.rs +426 -0
- beaconcrypt-0.5.1/beaconcrypt/tests/server.rs +864 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/tests/wycheproof.rs +6 -6
- beaconcrypt-0.5.1/beaconcrypt-core/Cargo.toml +21 -0
- beaconcrypt-0.5.1/beaconcrypt-core/LICENSE +7 -0
- beaconcrypt-0.5.1/beaconcrypt-core/README.md +5 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/commitment.rs +108 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/constants.rs +1 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/lib.rs +29 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/pqxdh/concrete.rs +115 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/pqxdh.rs +1582 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/ratchet/concrete.rs +613 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/ratchet/control.rs +564 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/ratchet/refined.rs +986 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/ratchet.rs +1883 -0
- beaconcrypt-0.5.1/beaconcrypt-core/src/record.rs +185 -0
- beaconcrypt-0.5.1/beaconcrypt-core/tests/general_registration_admission.rs +137 -0
- beaconcrypt-0.5.1/beaconcrypt.pyi +103 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1}/pyproject.toml +5 -1
- beaconcrypt-0.4.2/.cargo/config.toml +0 -1
- beaconcrypt-0.4.2/.github/workflows/codeql.yml +0 -105
- beaconcrypt-0.4.2/.github/workflows/go.yml +0 -140
- beaconcrypt-0.4.2/.github/workflows/python.yml +0 -135
- beaconcrypt-0.4.2/.github/workflows/release.yml +0 -150
- beaconcrypt-0.4.2/.github/workflows/rust.yml +0 -32
- beaconcrypt-0.4.2/.gitignore +0 -77
- beaconcrypt-0.4.2/.gitmodules +0 -3
- beaconcrypt-0.4.2/README.md +0 -114
- beaconcrypt-0.4.2/beaconcrypt.go +0 -425
- beaconcrypt-0.4.2/beaconcrypt.pyi +0 -47
- beaconcrypt-0.4.2/beaconcrypt_test.go +0 -1370
- beaconcrypt-0.4.2/bindings.h +0 -149
- beaconcrypt-0.4.2/build.rs +0 -37
- beaconcrypt-0.4.2/clippy.toml +0 -1
- beaconcrypt-0.4.2/doc/multi-opening-fixture.md +0 -218
- beaconcrypt-0.4.2/doc/persistence.md +0 -87
- beaconcrypt-0.4.2/doc/protocol.md +0 -156
- beaconcrypt-0.4.2/doc/rationale.md +0 -11
- beaconcrypt-0.4.2/doc/threat_model.md +0 -38
- beaconcrypt-0.4.2/doc/wycheproof.md +0 -55
- beaconcrypt-0.4.2/examples/c/CMakeLists.txt +0 -70
- beaconcrypt-0.4.2/examples/c/README.md +0 -16
- beaconcrypt-0.4.2/examples/c/main.c +0 -326
- beaconcrypt-0.4.2/examples/go/.gitignore +0 -1
- beaconcrypt-0.4.2/examples/go/README.md +0 -11
- beaconcrypt-0.4.2/examples/go/go.mod +0 -7
- beaconcrypt-0.4.2/examples/go/go.sum +0 -0
- beaconcrypt-0.4.2/examples/go/main.go +0 -161
- beaconcrypt-0.4.2/examples/python/.gitignore +0 -2
- beaconcrypt-0.4.2/examples/python/README.md +0 -4
- beaconcrypt-0.4.2/examples/python/main.py +0 -69
- beaconcrypt-0.4.2/examples/python/pyproject.toml +0 -11
- beaconcrypt-0.4.2/go.mod +0 -7
- beaconcrypt-0.4.2/go.sum +0 -4
- beaconcrypt-0.4.2/rustfmt.toml +0 -5
- beaconcrypt-0.4.2/scripts/derive_multi_opening.py +0 -270
- beaconcrypt-0.4.2/scripts/generate_kat_vectors.go +0 -321
- beaconcrypt-0.4.2/scripts/generate_kat_vectors.py +0 -242
- beaconcrypt-0.4.2/scripts/generate_python_stubs.py +0 -47
- beaconcrypt-0.4.2/src/beacon.rs +0 -6
- beaconcrypt-0.4.2/src/cbinds.rs +0 -400
- beaconcrypt-0.4.2/src/deser.rs +0 -746
- beaconcrypt-0.4.2/src/pqxdh.rs +0 -1031
- beaconcrypt-0.4.2/src/pybinds.rs +0 -198
- beaconcrypt-0.4.2/src/ser.rs +0 -309
- beaconcrypt-0.4.2/src/server.rs +0 -80
- beaconcrypt-0.4.2/tests/server.rs +0 -240
- beaconcrypt-0.4.2/tests/test_encryption.py +0 -317
- beaconcrypt-0.4.2/tests/test_registration.py +0 -74
- beaconcrypt-0.4.2/tests/test_server_state.py +0 -207
- beaconcrypt-0.4.2/uv.lock +0 -247
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1}/LICENSE +0 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/examples/rust/README.md +0 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/src/schema/cryptoframe.capnp +0 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/src/schema/phase1.capnp +0 -0
- {beaconcrypt-0.4.2 → beaconcrypt-0.5.1/beaconcrypt}/src/schema/phase2.capnp +0 -0
|
@@ -78,8 +78,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
|
|
78
78
|
|
|
79
79
|
[[package]]
|
|
80
80
|
name = "beaconcrypt"
|
|
81
|
-
version = "0.
|
|
81
|
+
version = "0.5.1"
|
|
82
82
|
dependencies = [
|
|
83
|
+
"beaconcrypt-core",
|
|
83
84
|
"capnp",
|
|
84
85
|
"capnpc",
|
|
85
86
|
"cbindgen",
|
|
@@ -90,6 +91,13 @@ dependencies = [
|
|
|
90
91
|
"zeroize",
|
|
91
92
|
]
|
|
92
93
|
|
|
94
|
+
[[package]]
|
|
95
|
+
name = "beaconcrypt-core"
|
|
96
|
+
version = "0.1.0"
|
|
97
|
+
dependencies = [
|
|
98
|
+
"zeroize",
|
|
99
|
+
]
|
|
100
|
+
|
|
93
101
|
[[package]]
|
|
94
102
|
name = "bitflags"
|
|
95
103
|
version = "2.13.1"
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "beaconcrypt"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.1"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
license-file = "LICENSE"
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
description = "Cryptographic transport for C2 channels"
|
|
8
8
|
rust-version = "1.96"
|
|
9
9
|
repository = "https://github.com/0xd6cb6d73/beaconcrypt"
|
|
10
|
-
exclude = [
|
|
11
|
-
"wycheproof/**",
|
|
12
|
-
"!wycheproof/testvectors_v1/chacha20_poly1305_test.json",
|
|
13
|
-
"!wycheproof/testvectors_v1/ed25519_test.json",
|
|
14
|
-
"!wycheproof/testvectors_v1/hkdf_sha512_test.json",
|
|
15
|
-
"!wycheproof/testvectors_v1/mlkem_768_encaps_test.json",
|
|
16
|
-
"!wycheproof/testvectors_v1/mlkem_768_test.json",
|
|
17
|
-
"!wycheproof/testvectors_v1/x25519_test.json",
|
|
18
|
-
]
|
|
19
10
|
|
|
20
11
|
[lib]
|
|
21
12
|
name = "beaconcrypt"
|
|
@@ -36,6 +27,11 @@ name = "protocol"
|
|
|
36
27
|
path = "tests/protocol.rs"
|
|
37
28
|
required-features = ["pqxdh", "beacon", "server"]
|
|
38
29
|
|
|
30
|
+
[[test]]
|
|
31
|
+
name = "rooterberg"
|
|
32
|
+
path = "tests/rooterberg.rs"
|
|
33
|
+
required-features = ["pqxdh"]
|
|
34
|
+
|
|
39
35
|
[[test]]
|
|
40
36
|
name = "server"
|
|
41
37
|
path = "tests/server.rs"
|
|
@@ -50,9 +46,15 @@ required-features = ["pqxdh"]
|
|
|
50
46
|
capnpc = "0.26"
|
|
51
47
|
cbindgen = "0.29"
|
|
52
48
|
|
|
49
|
+
[dev-dependencies]
|
|
50
|
+
beaconcrypt-core = { path = "../beaconcrypt-core", features = ["test-utils"] }
|
|
51
|
+
serde = { version = "1", features = ["derive"] }
|
|
52
|
+
serde_json = "1"
|
|
53
|
+
|
|
53
54
|
[dependencies]
|
|
55
|
+
beaconcrypt-core = { version = "0.1.0", path = "../beaconcrypt-core" }
|
|
54
56
|
capnp = "0.26"
|
|
55
|
-
libsodium-rs = "0.2"
|
|
57
|
+
libsodium-rs = "=0.2.4"
|
|
56
58
|
zeroize = "1.9"
|
|
57
59
|
pyo3 = { version = "0.29.0", features = ["abi3-py311", "experimental-inspect"], optional = true }
|
|
58
60
|
serde = { version = "1", features = ["derive"], optional = true }
|
|
@@ -68,12 +70,6 @@ cbinds = ["beacon", "server", "pqxdh"]
|
|
|
68
70
|
pybinds = ["dep:pyo3", "beacon", "server", "pqxdh"]
|
|
69
71
|
all = ["gobinds", "pybinds", "cbinds"]
|
|
70
72
|
|
|
71
|
-
[profile.release]
|
|
72
|
-
strip = true
|
|
73
|
-
lto = true
|
|
74
|
-
codegen-units = 1
|
|
75
|
-
panic = "abort"
|
|
76
|
-
|
|
77
73
|
[package.metadata.maturin]
|
|
78
74
|
name = "beaconcrypt"
|
|
79
75
|
bindings = "pyo3"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
BSD Zero Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2026 by 0xd6cb6d73 72226198+0xd6cb6d73@users.noreply.github.com
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: 0BSD -->
|
|
2
|
+
|
|
3
|
+
## **!! I am not a cryptographer and this has received no review. Assume this is irreparably broken !!**
|
|
4
|
+
|
|
5
|
+
# Overview
|
|
6
|
+
Generic C2 PQ-safe cryptographic transport protocol intended to protect against powerful wire attackers, with a rust reference implementation. This repo contains two things:
|
|
7
|
+
- a protocol specification, with an associated threat model
|
|
8
|
+
- a reference implementation
|
|
9
|
+
|
|
10
|
+
See the `doc` folder for the specification, threat model and rationale.
|
|
11
|
+
|
|
12
|
+
## What this is not
|
|
13
|
+
A C2 transport protocol. This protocol is only concerned with cryptographically protecting the data transmitted between a beacon and its server. It does not know anything about how data should be transported or where. Therefore, the intent is for this protocol to be used in a way that ryhmes with this:
|
|
14
|
+
```c++
|
|
15
|
+
class transport {
|
|
16
|
+
// ...
|
|
17
|
+
std::vector<uint8_t> network_send(const uint8_t* ptr, size_t len);
|
|
18
|
+
// ...
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
bool transport::send(const std::span<const uint8_t> data) {
|
|
22
|
+
uint8_t* encrypted_ptr = nullptr;
|
|
23
|
+
size_t encrypted_len = 0;
|
|
24
|
+
size_t encrypted_capa = 0;
|
|
25
|
+
if (encrypt_to_server(data.data(), data.size(), encrypted_ptr, encrypted_len, encrypted_capa) == 0) {
|
|
26
|
+
auto response = this->network_send(encrypted_ptr, encrypted_len);
|
|
27
|
+
free_vec(encrypted_ptr, encrypted_len, encrypted_capa);
|
|
28
|
+
// ...
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
In essence, this **only** handles crypto, you still get to do whatever you want on the transport side.
|
|
35
|
+
|
|
36
|
+
## Limitations
|
|
37
|
+
In short: PQ algorithms take a lot more space than classical ones.
|
|
38
|
+
This is unfortunately unavoidable. Therfore, the initial registration handshake will be somewhat large.
|
|
39
|
+
The ML-KEM public key and ciphertext combined take up ~2.2kb by themselves.
|
|
40
|
+
This overhead will grow larger when hybrid signatures are implemented.
|
|
41
|
+
Thankfully, this only affects the registration handshake.
|
|
42
|
+
No subsequent messages are affected, as they only use symmetric cryptography.
|
|
43
|
+
However, this does not impact any follow on messages, for which the only overhead is the captn' proto framing.
|
|
44
|
+
|
|
45
|
+
The reference implementation is large, ~6.5MB for the static lib. It goes down to ~2MB if building the stdlib ourselves with a nightly toolchain. This is largely due to the fact that we need to bring a bunch of rust stuff with us. Unfortunately, most crypto libraries aren't really meant to run in 40KB images, so there's always going to be some floor there. It should however be easy to cut the rust-related stuff by implementing this protocol in C or C++, though you'll still have to pay for the libsodium + captn proto libraries.
|
|
46
|
+
|
|
47
|
+
It is very likely that neither the rust nor C interfaces are thread-safe.
|
|
48
|
+
|
|
49
|
+
# TODOs
|
|
50
|
+
Test the C interface.
|
|
51
|
+
|
|
52
|
+
See about adding proofs.
|
|
53
|
+
|
|
54
|
+
Make the server interface thread-safe in rust.
|
|
55
|
+
|
|
56
|
+
# Reference implementation
|
|
57
|
+
I don't use rust a lot, so the code is probably fairly naive. It provides both a beacon and server implementation with C bindings through `cbindgen`. Ideally more bindings would be built on top of that so it can be used in the mythic server-side.
|
|
58
|
+
|
|
59
|
+
The reference implementation expects that all beacons are compiled with the server's public key, and that beaconcrypt is initialized with it.
|
|
60
|
+
|
|
61
|
+
Rust, C, Go, and Python support durable full-server state through a caller-supplied snapshot store. Snapshots contain plaintext secrets and are not self-authenticating; the store must protect their integrity and provenance, maintain one rollback-resistant authoritative head, and implement linearizable durable compare-and-swap. Store-backed servers commit accepted receives and other state-changing results before release, while a normally rejected receive preserves the complete state and performs no snapshot encoding or compare-and-swap. The bindings also retain checkpoint-only export and restoration for single-owner applications; those constructors require manual saving after every state-changing operation, and standalone checkpoint files cannot detect rollback. See [server-state persistence](doc/persistence.md) and the runnable examples for [Rust](beaconcrypt/examples/rust/main.rs), [Python](examples/python/main.py), [C](examples/c/main.c), and [Go](examples/go/main.go).
|
|
62
|
+
|
|
63
|
+
## Building
|
|
64
|
+
You will need [Capn'Proto](https://capnproto.org/install.html) (just the binaries) and a recent version of rust for every build.
|
|
65
|
+
|
|
66
|
+
The repository is a Cargo workspace containing the public `beaconcrypt` adapter and the `no_std` `beaconcrypt-core` state machines.
|
|
67
|
+
|
|
68
|
+
For windows, I prefer building with stable-gnu for normal usage, and nightly-gnu for release builds. You can find the exact arguments I use to the the static library as small as possible in [release.yml](/.github\workflows\release.yml). The MSVC toolchain is expected to work just as well, I just like mingw.
|
|
69
|
+
|
|
70
|
+
Build and run all tests:
|
|
71
|
+
```bash
|
|
72
|
+
cargo test --workspace
|
|
73
|
+
cargo build -p beaconcrypt --features gobinds --release --target x86_64-pc-windows-gnu
|
|
74
|
+
go test -a -count=1 .
|
|
75
|
+
uv run maturin develop --uv
|
|
76
|
+
uv run pytest tests
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The `-a` flag is required after rebuilding the Rust static library because Go's build cache does not detect changes to libraries linked through cgo. `-count=1` also prevents reuse of a cached successful test result.
|
|
80
|
+
|
|
81
|
+
### Mutation testing
|
|
82
|
+
|
|
83
|
+
Install `cargo-mutants` 27.1.0 and run the complete workspace mutation suite:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
cargo install --locked cargo-mutants@27.1.0
|
|
87
|
+
cargo mutants --workspace --jobs 8
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The [configuration](.cargo/mutants.toml) exercises both crates through workspace tests and documents exclusions for equivalent private-state mutations and adapters covered by the Go and Python suites. After substantial code additions, every viable mutant must be caught; `mutants.out/missed.txt` and `mutants.out/timeout.txt` must be empty. Finish validation with a complete run without `--iterate`.
|
|
91
|
+
|
|
92
|
+
### Reproducing known-answer test vectors
|
|
93
|
+
|
|
94
|
+
The fixed cryptographic values used by the Rust known-answer tests can be
|
|
95
|
+
reproduced independently with Python and Go. Run both generators from the
|
|
96
|
+
repository root:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
uv run python scripts/generate_kat_vectors.py
|
|
100
|
+
go run scripts/generate_kat_vectors.go
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The Python generator uses PyCryptodome. The Go generator uses the Go team's
|
|
104
|
+
crypto packages from `golang.org/x/crypto`. Their output should be identical;
|
|
105
|
+
any difference indicates that the vectors or one of the generators has
|
|
106
|
+
diverged.
|
|
107
|
+
|
|
108
|
+
### Wycheproof
|
|
109
|
+
|
|
110
|
+
The test suite includes pinned [C2SP Wycheproof](https://github.com/C2SP/wycheproof)
|
|
111
|
+
vectors for X25519, Ed25519, ChaCha20-Poly1305-IETF, HKDF-SHA-512 and
|
|
112
|
+
ML-KEM-768. After cloning, initialize the vector submodule before running the
|
|
113
|
+
normal test suite:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git submodule update --init --recursive
|
|
117
|
+
cargo test
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
See [the Wycheproof test documentation](doc/wycheproof.md) for the coverage
|
|
121
|
+
matrix, result semantics and update procedure.
|
|
122
|
+
|
|
123
|
+
### Rooterberg
|
|
124
|
+
|
|
125
|
+
The test suite also runs pinned
|
|
126
|
+
[Rooterberg](https://github.com/bleichenbacher-daniel/Rooterberg) vectors for
|
|
127
|
+
X25519, Ed25519 signing and verification, ChaCha20-Poly1305-IETF,
|
|
128
|
+
HKDF-SHA-512 and BLAKE2b-512. Rooterberg is included as a Git submodule and is
|
|
129
|
+
initialized by the same command used for Wycheproof:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git submodule update --init --recursive
|
|
133
|
+
cargo test
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
See [the Rooterberg test documentation](doc/rooterberg.md) for the coverage
|
|
137
|
+
matrix, upstream format caveats and update procedure.
|
|
138
|
+
|
|
139
|
+
## Usage
|
|
140
|
+
The reference implementation is a library that can currently be used either from rust, through C FFI, go and python bindings. The C interface is tested directly and through the Go bindings. Note that 0-length messages are explicitly disallowed by the reference implementation, as my feeling is that such messages have no purpose except testing parser edge cases. The library also doesn't handle chnking of any kind and will try to process entire messages at once in memory. It is expected that the caller should handle chunking itself if that is required.
|
|
141
|
+
|
|
142
|
+
From Rust, usage is mostly just constructing role-specific `Server` and `Beacon` objects. See the [example](beaconcrypt/examples/rust/main.rs) for usage.
|
|
143
|
+
|
|
144
|
+
Existing Rust callers must replace `BeaconCryptPqxdh` with the appropriate `Server` or `Beacon` type. C callers must use the matching `beaconcrypt_server_free` or `beaconcrypt_beacon_free` and role-specific identity functions; `beaconcrypt_export_state` is now `beaconcrypt_server_export_state`. Server checkpoints are binary snapshots: Go's `NewServerFromState` accepts `[]byte`, and Python's state export and restoration use `bytes` instead of JSON strings. See the persistence documentation for format compatibility and storage requirements.
|
|
145
|
+
|
|
146
|
+
From python, you can just use the wheels published to pypi, see the [example](examples/python/main.py) for usage.
|
|
147
|
+
|
|
148
|
+
The [C interface](beaconcrypt/src/cbinds.rs) uses opaque role-specific handles; the caller is responsible for their lifetimes and for freeing returned buffers. See the [example](examples/c/main.c) for usage.
|
|
149
|
+
|
|
150
|
+
Go is unfortunately the worst off as the bindings use cgo and therefore building your binary requires being able to link to a version of the library built with the `gobinds` feature. See the [example](examples/go/main.go) for usage.
|
|
151
|
+
|
|
152
|
+
# Copyright
|
|
153
|
+
This work is dedicated to the public domain.
|
|
154
|
+
|
|
155
|
+
The C and go bindings, as well as most tests and the GH action code were generated by an LLM. This includes the KAT generation scripts, the ChaCha20-Poly1305 invisible salamanders implementation and its associated documentation.
|