beaconcrypt 0.3.0__tar.gz → 0.3.2__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.3.2/.github/workflows/go.yml +136 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/.github/workflows/python.yml +1 -1
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/.github/workflows/release.yml +2 -1
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/Cargo.lock +5 -5
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/Cargo.toml +1 -1
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/PKG-INFO +1 -1
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/README.md +6 -1
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/beaconcrypt.go +2 -1
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/pqxdh.rs +3 -1
- beaconcrypt-0.3.0/.github/workflows/go.yml +0 -44
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/.cargo/config.toml +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/.github/workflows/rust.yml +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/.gitignore +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/LICENSE +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/beaconcrypt_test.go +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/bindings.h +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/build.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/clippy.toml +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/doc/protocol.md +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/doc/rationale.md +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/doc/threat_model.md +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/go.mod +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/pyproject.toml +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/rustfmt.toml +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/beacon.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/cnsa2.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/error.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/lib.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/schema/cryptoframe.capnp +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/schema/phase1.capnp +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/schema/phase2.capnp +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/schema/protogram.capnp +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/server.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/src/shared.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/tests/beacon.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/tests/server.rs +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/tests/test_encryption.py +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/tests/test_registration.py +0 -0
- {beaconcrypt-0.3.0 → beaconcrypt-0.3.2}/uv.lock +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
name: Go Module
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "[0-9]*.[0-9]*.[0-9]*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
CARGO_TERM_COLOR: always
|
|
13
|
+
GOPROXY: https://proxy.golang.org
|
|
14
|
+
GONOSUMDB: ""
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
name: Test Go module on ${{ matrix.os }}
|
|
19
|
+
runs-on: ${{ matrix.os }}
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
os:
|
|
24
|
+
- ubuntu-latest
|
|
25
|
+
- ubuntu-24.04-arm
|
|
26
|
+
- macos-latest
|
|
27
|
+
- windows-latest
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v7
|
|
31
|
+
|
|
32
|
+
- name: Set up Go
|
|
33
|
+
uses: actions/setup-go@v6
|
|
34
|
+
with:
|
|
35
|
+
go-version-file: go.mod
|
|
36
|
+
check-latest: true
|
|
37
|
+
|
|
38
|
+
- name: Set up MinGW on Windows
|
|
39
|
+
if: runner.os == 'Windows'
|
|
40
|
+
uses: msys2/setup-msys2@v2
|
|
41
|
+
with:
|
|
42
|
+
install: mingw-w64-x86_64-gcc
|
|
43
|
+
|
|
44
|
+
- name: Install cap'n proto on Linux
|
|
45
|
+
if: runner.os == 'Linux'
|
|
46
|
+
run: sudo apt update && sudo apt install capnproto
|
|
47
|
+
|
|
48
|
+
- name: Install cap'n proto on macOS
|
|
49
|
+
if: runner.os == 'macOS'
|
|
50
|
+
run: brew install capnp
|
|
51
|
+
|
|
52
|
+
- name: Install cap'n proto on Windows
|
|
53
|
+
if: runner.os == 'Windows'
|
|
54
|
+
run: |
|
|
55
|
+
"C:\msys64\mingw64\bin" >> $env:GITHUB_PATH
|
|
56
|
+
curl.exe -O https://capnproto.org/capnproto-c++-win32-1.5.0.zip
|
|
57
|
+
Expand-Archive capnproto-c++-win32-1.5.0.zip
|
|
58
|
+
"$pwd\capnproto-c++-win32-1.5.0\capnproto-tools-win32-1.5.0" >> $env:GITHUB_PATH
|
|
59
|
+
|
|
60
|
+
- name: Build native library
|
|
61
|
+
if: runner.os != 'Windows'
|
|
62
|
+
run: cargo build --verbose
|
|
63
|
+
|
|
64
|
+
- name: Build native library on Windows
|
|
65
|
+
if: runner.os == 'Windows'
|
|
66
|
+
env:
|
|
67
|
+
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: gcc
|
|
68
|
+
run: |
|
|
69
|
+
rustup target add x86_64-pc-windows-gnu
|
|
70
|
+
cargo build --verbose --target x86_64-pc-windows-gnu
|
|
71
|
+
|
|
72
|
+
- name: Test Go module
|
|
73
|
+
if: runner.os != 'Windows'
|
|
74
|
+
env:
|
|
75
|
+
CGO_ENABLED: 1
|
|
76
|
+
run: go test ./...
|
|
77
|
+
|
|
78
|
+
- name: Test Go module on Windows
|
|
79
|
+
if: runner.os == 'Windows'
|
|
80
|
+
env:
|
|
81
|
+
CGO_ENABLED: 1
|
|
82
|
+
CC: gcc
|
|
83
|
+
run: go test ./...
|
|
84
|
+
|
|
85
|
+
publish:
|
|
86
|
+
needs: test
|
|
87
|
+
runs-on: ubuntu-latest
|
|
88
|
+
permissions:
|
|
89
|
+
contents: write
|
|
90
|
+
|
|
91
|
+
steps:
|
|
92
|
+
- uses: actions/checkout@v7
|
|
93
|
+
with:
|
|
94
|
+
fetch-depth: 0
|
|
95
|
+
|
|
96
|
+
- name: Set up Go
|
|
97
|
+
uses: actions/setup-go@v6
|
|
98
|
+
with:
|
|
99
|
+
go-version-file: go.mod
|
|
100
|
+
check-latest: true
|
|
101
|
+
|
|
102
|
+
- name: Publish module to Go proxy
|
|
103
|
+
run: |
|
|
104
|
+
module_path="$(go list -m)"
|
|
105
|
+
version="${GITHUB_REF_NAME}"
|
|
106
|
+
go_version="v${version}"
|
|
107
|
+
|
|
108
|
+
git fetch origin "refs/tags/${go_version}:refs/tags/${go_version}" || true
|
|
109
|
+
if ! git rev-parse --verify --quiet "refs/tags/${go_version}" >/dev/null; then
|
|
110
|
+
git tag "${go_version}" "${GITHUB_SHA}"
|
|
111
|
+
git push origin "refs/tags/${go_version}"
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
tag_visible=false
|
|
115
|
+
for attempt in {1..30}; do
|
|
116
|
+
if git ls-remote --exit-code --tags origin "refs/tags/${go_version}" >/dev/null; then
|
|
117
|
+
tag_visible=true
|
|
118
|
+
break
|
|
119
|
+
fi
|
|
120
|
+
sleep 10
|
|
121
|
+
done
|
|
122
|
+
if [ "${tag_visible}" != "true" ]; then
|
|
123
|
+
echo "Timed out waiting for ${go_version} to become visible on origin" >&2
|
|
124
|
+
exit 1
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
GOPROXY=direct go list -m "${module_path}@${go_version}"
|
|
128
|
+
|
|
129
|
+
for attempt in {1..30}; do
|
|
130
|
+
if go list -m "${module_path}@${go_version}"; then
|
|
131
|
+
exit 0
|
|
132
|
+
fi
|
|
133
|
+
sleep 10
|
|
134
|
+
done
|
|
135
|
+
|
|
136
|
+
go list -m "${module_path}@${go_version}"
|
|
@@ -84,7 +84,7 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
|
|
84
84
|
|
|
85
85
|
[[package]]
|
|
86
86
|
name = "beaconcrypt"
|
|
87
|
-
version = "0.3.
|
|
87
|
+
version = "0.3.2"
|
|
88
88
|
dependencies = [
|
|
89
89
|
"capnp",
|
|
90
90
|
"capnpc",
|
|
@@ -99,9 +99,9 @@ dependencies = [
|
|
|
99
99
|
|
|
100
100
|
[[package]]
|
|
101
101
|
name = "bitflags"
|
|
102
|
-
version = "2.13.
|
|
102
|
+
version = "2.13.1"
|
|
103
103
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
104
|
-
checksum = "
|
|
104
|
+
checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
|
|
105
105
|
|
|
106
106
|
[[package]]
|
|
107
107
|
name = "bumpalo"
|
|
@@ -1166,9 +1166,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
|
|
1166
1166
|
|
|
1167
1167
|
[[package]]
|
|
1168
1168
|
name = "uuid"
|
|
1169
|
-
version = "1.
|
|
1169
|
+
version = "1.24.0"
|
|
1170
1170
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1171
|
-
checksum = "
|
|
1171
|
+
checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239"
|
|
1172
1172
|
dependencies = [
|
|
1173
1173
|
"getrandom",
|
|
1174
1174
|
"js-sys",
|
|
@@ -46,13 +46,18 @@ Test the C interface
|
|
|
46
46
|
# Reference implementation
|
|
47
47
|
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.
|
|
48
48
|
|
|
49
|
+
## Building
|
|
50
|
+
You will need [Capn'Proto](https://capnproto.org/install.html) (just the binaries) and a recent version of rust for every build.
|
|
51
|
+
|
|
52
|
+
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.
|
|
53
|
+
|
|
49
54
|
## Profiles
|
|
50
55
|
The reference implementation has two profiles: `PQXDH` and `CNSA2`. Profiles are controlled by cargo features. The CNSA2 profile only exists as a test for now. It uses a simple ML-KEM encapsulation for key exchange and the underlying libraries are not FIPS-approved. It is experimental and is likely broken. PQXDH is the intended target and the default.
|
|
51
56
|
|
|
52
57
|
## Usage
|
|
53
58
|
The reference implementation is a library that can currently be used either from rust or through C FFI. The C interface is currently not tested.
|
|
54
59
|
|
|
55
|
-
From rust, usage is mostly just instanciating `CryptoProvider` objects. When using the C FFI, the library creates a global `CryptoProvider` object, whose methods are wrapped by the various functions in the interface.
|
|
60
|
+
From rust, usage is mostly just instanciating `CryptoProvider` objects. When using the C FFI, the library creates a global `CryptoProvider` object, whose methods are wrapped by the various functions in the interface. Look at tests for examples.
|
|
56
61
|
|
|
57
62
|
# Copyright
|
|
58
63
|
This work is dedicated to the public domain.
|
|
@@ -4,7 +4,8 @@ package beaconcrypt
|
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
#cgo windows LDFLAGS: -L${SRCDIR}/target/x86_64-pc-windows-gnu/debug -l:libbeaconcrypt.a -lbcrypt -lws2_32 -luserenv -ldbghelp -lntdll
|
|
7
|
-
#cgo
|
|
7
|
+
#cgo linux LDFLAGS: -L${SRCDIR}/target/debug -l:libbeaconcrypt.a
|
|
8
|
+
#cgo darwin LDFLAGS: ${SRCDIR}/target/debug/libbeaconcrypt.a
|
|
8
9
|
#include <stdint.h>
|
|
9
10
|
#include <stdlib.h>
|
|
10
11
|
|
|
@@ -331,6 +331,9 @@ impl ProviderBeacon for BeaconCryptPqxdh {
|
|
|
331
331
|
crypto_kx::PublicKey::from_bytes(response.get_ephemeral_key().ok()?).ok()?;
|
|
332
332
|
let server_id =
|
|
333
333
|
crypto_sign::PublicKey::from_bytes(response.get_identity_key().ok()?).ok()?;
|
|
334
|
+
if server_id != self.server_id()?.clone() {
|
|
335
|
+
return None;
|
|
336
|
+
}
|
|
334
337
|
let server_kex_id = crypto_sign::ed25519_pk_to_curve25519(&server_id).ok()?;
|
|
335
338
|
let beacon_kex_id = crypto_sign::ed25519_sk_to_curve25519(self.identity_sk()).ok()?;
|
|
336
339
|
let shared_secret =
|
|
@@ -353,7 +356,6 @@ impl ProviderBeacon for BeaconCryptPqxdh {
|
|
|
353
356
|
let derived_secret = derive_root_key(dh1, dh2, dh3, dh4, shared_secret).ok()?;
|
|
354
357
|
self.delete_onetime_keypair();
|
|
355
358
|
|
|
356
|
-
self.add_server_pk(server_id.clone());
|
|
357
359
|
self.set_identity_kid(response.get_key_id());
|
|
358
360
|
let id = self.identity_pk().clone();
|
|
359
361
|
self.set_associated_data(build_additional_data(server_id, id));
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
name: Go Module
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "*"
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
|
|
11
|
-
env:
|
|
12
|
-
CARGO_TERM_COLOR: always
|
|
13
|
-
GOPROXY: https://proxy.golang.org
|
|
14
|
-
GONOSUMDB: ""
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
publish:
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v7
|
|
22
|
-
|
|
23
|
-
- name: Set up Go
|
|
24
|
-
uses: actions/setup-go@v6
|
|
25
|
-
with:
|
|
26
|
-
go-version-file: go.mod
|
|
27
|
-
check-latest: true
|
|
28
|
-
|
|
29
|
-
- name: Install cap'n proto
|
|
30
|
-
run: sudo apt update && sudo apt install capnproto
|
|
31
|
-
|
|
32
|
-
- name: Build native library
|
|
33
|
-
run: cargo build --verbose
|
|
34
|
-
|
|
35
|
-
- name: Test Go module
|
|
36
|
-
run: go test ./...
|
|
37
|
-
|
|
38
|
-
- name: Publish module to Go proxy
|
|
39
|
-
run: |
|
|
40
|
-
module_path="$(go list -m)"
|
|
41
|
-
version="${GITHUB_REF_NAME}"
|
|
42
|
-
encoded_module="${module_path,,}"
|
|
43
|
-
curl --fail --show-error --location --retry 5 --retry-all-errors --retry-delay 10 \
|
|
44
|
-
"https://proxy.golang.org/${encoded_module}/@v/v${version}.info"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|