beaconcrypt 0.3.11__tar.gz → 0.4.0__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.
Files changed (86) hide show
  1. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/.github/workflows/go.yml +4 -4
  2. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/.github/workflows/release.yml +29 -21
  3. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/.github/workflows/rust.yml +6 -0
  4. beaconcrypt-0.4.0/.gitmodules +3 -0
  5. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/Cargo.lock +44 -31
  6. beaconcrypt-0.4.0/Cargo.toml +79 -0
  7. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/PKG-INFO +1 -1
  8. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/README.md +41 -7
  9. beaconcrypt-0.4.0/beaconcrypt.go +443 -0
  10. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/beaconcrypt.pyi +22 -6
  11. beaconcrypt-0.4.0/beaconcrypt_test.go +1385 -0
  12. beaconcrypt-0.4.0/bindings.h +152 -0
  13. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/build.rs +0 -1
  14. beaconcrypt-0.4.0/doc/multi-opening-fixture.md +217 -0
  15. beaconcrypt-0.4.0/doc/persistence.md +92 -0
  16. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/doc/protocol.md +36 -26
  17. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/doc/threat_model.md +7 -1
  18. beaconcrypt-0.4.0/doc/wycheproof.md +55 -0
  19. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/c/main.c +44 -24
  20. beaconcrypt-0.4.0/examples/go/.gitignore +1 -0
  21. beaconcrypt-0.4.0/examples/go/README.md +11 -0
  22. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/go/go.mod +2 -2
  23. beaconcrypt-0.4.0/examples/go/go.sum +0 -0
  24. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/go/main.go +18 -9
  25. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/python/.gitignore +1 -0
  26. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/python/main.py +20 -9
  27. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/python/pyproject.toml +3 -1
  28. beaconcrypt-0.4.0/examples/rust/README.md +6 -0
  29. beaconcrypt-0.4.0/examples/rust/main.rs +122 -0
  30. beaconcrypt-0.4.0/go.mod +7 -0
  31. beaconcrypt-0.4.0/go.sum +4 -0
  32. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/pyproject.toml +2 -4
  33. beaconcrypt-0.4.0/scripts/derive_multi_opening.py +245 -0
  34. beaconcrypt-0.4.0/scripts/generate_kat_vectors.go +317 -0
  35. beaconcrypt-0.4.0/scripts/generate_kat_vectors.py +238 -0
  36. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/scripts/generate_python_stubs.py +0 -1
  37. beaconcrypt-0.4.0/src/beacon.rs +6 -0
  38. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/src/cbinds.rs +135 -64
  39. beaconcrypt-0.4.0/src/deser.rs +746 -0
  40. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/src/lib.rs +5 -9
  41. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/src/pqxdh.rs +279 -153
  42. beaconcrypt-0.4.0/src/pybinds.rs +209 -0
  43. beaconcrypt-0.4.0/src/schema/cryptoframe.capnp +12 -0
  44. beaconcrypt-0.4.0/src/ser.rs +309 -0
  45. beaconcrypt-0.4.0/src/server.rs +82 -0
  46. beaconcrypt-0.4.0/src/shared.rs +1597 -0
  47. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/tests/beacon.rs +4 -3
  48. beaconcrypt-0.4.0/tests/protocol.rs +1466 -0
  49. beaconcrypt-0.4.0/tests/server.rs +240 -0
  50. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/tests/test_encryption.py +71 -50
  51. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/tests/test_registration.py +1 -0
  52. beaconcrypt-0.4.0/tests/test_server_state.py +209 -0
  53. beaconcrypt-0.4.0/tests/wycheproof.rs +475 -0
  54. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/uv.lock +32 -0
  55. beaconcrypt-0.3.11/Cargo.toml +0 -43
  56. beaconcrypt-0.3.11/beaconcrypt.go +0 -279
  57. beaconcrypt-0.3.11/beaconcrypt_test.go +0 -691
  58. beaconcrypt-0.3.11/bindings.h +0 -536
  59. beaconcrypt-0.3.11/examples/go/README.md +0 -6
  60. beaconcrypt-0.3.11/examples/go/go.sum +0 -2
  61. beaconcrypt-0.3.11/examples/python/uv.lock +0 -176
  62. beaconcrypt-0.3.11/go.mod +0 -3
  63. beaconcrypt-0.3.11/src/beacon.rs +0 -309
  64. beaconcrypt-0.3.11/src/cnsa2.rs +0 -562
  65. beaconcrypt-0.3.11/src/gobinds.rs +0 -340
  66. beaconcrypt-0.3.11/src/pybinds.rs +0 -129
  67. beaconcrypt-0.3.11/src/schema/cryptoframe.capnp +0 -11
  68. beaconcrypt-0.3.11/src/schema/protogram.capnp +0 -10
  69. beaconcrypt-0.3.11/src/server.rs +0 -286
  70. beaconcrypt-0.3.11/src/shared.rs +0 -956
  71. beaconcrypt-0.3.11/tests/protocol.rs +0 -362
  72. beaconcrypt-0.3.11/tests/server.rs +0 -44
  73. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/.cargo/config.toml +0 -0
  74. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/.github/workflows/codeql.yml +0 -0
  75. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/.github/workflows/python.yml +0 -0
  76. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/.gitignore +0 -0
  77. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/LICENSE +0 -0
  78. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/clippy.toml +0 -0
  79. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/doc/rationale.md +0 -0
  80. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/c/CMakeLists.txt +0 -0
  81. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/c/README.md +0 -0
  82. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/examples/python/README.md +0 -0
  83. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/rustfmt.toml +0 -0
  84. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/src/error.rs +0 -0
  85. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/src/schema/phase1.capnp +0 -0
  86. {beaconcrypt-0.3.11 → beaconcrypt-0.4.0}/src/schema/phase2.capnp +0 -0
@@ -63,7 +63,7 @@ jobs:
63
63
 
64
64
  - name: Build native library
65
65
  if: runner.os != 'Windows'
66
- run: cargo build --verbose --features gobinds
66
+ run: cargo build --verbose --release --features gobinds
67
67
 
68
68
  - name: Build native library on Windows
69
69
  if: runner.os == 'Windows'
@@ -71,20 +71,20 @@ jobs:
71
71
  CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: gcc
72
72
  run: |
73
73
  rustup target add x86_64-pc-windows-gnu
74
- cargo build --verbose --target x86_64-pc-windows-gnu --features gobinds
74
+ cargo build --verbose --release --target x86_64-pc-windows-gnu --features gobinds
75
75
 
76
76
  - name: Test Go module
77
77
  if: runner.os != 'Windows'
78
78
  env:
79
79
  CGO_ENABLED: 1
80
- run: go test ./...
80
+ run: go test -race ./...
81
81
 
82
82
  - name: Test Go module on Windows
83
83
  if: runner.os == 'Windows'
84
84
  env:
85
85
  CGO_ENABLED: 1
86
86
  CC: gcc
87
- run: go test ./...
87
+ run: go test -race ./...
88
88
 
89
89
  publish:
90
90
  if: startsWith(github.ref, 'refs/tags/')
@@ -1,24 +1,24 @@
1
1
  name: Release
2
2
 
3
3
  on:
4
- push:
5
- tags:
6
- - "v[0-9]*.[0-9]*.[0-9]*"
4
+ push:
7
5
 
8
6
  env:
9
7
  CARGO_TERM_COLOR: always
10
8
 
11
9
  jobs:
12
- ubuntu-build:
10
+ unix-build:
13
11
  strategy:
14
12
  matrix:
15
- os: [ubuntu-latest, ubuntu-24.04-arm]
13
+ os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-15-intel]
16
14
  runs-on: ${{ matrix.os }}
17
15
  permissions:
18
16
  contents: read
19
17
 
20
18
  steps:
21
19
  - uses: actions/checkout@v7
20
+ with:
21
+ submodules: recursive
22
22
  - name: Install cap'n proto
23
23
  run: |
24
24
  curl -O https://capnproto.org/capnproto-c++-1.5.0.tar.gz
@@ -30,17 +30,18 @@ jobs:
30
30
  - name: Build
31
31
  run: |
32
32
  rustup component add rust-src --toolchain nightly
33
- cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features beacon,server,pqxdh --crate-type=staticlib
33
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features gobinds --crate-type=staticlib
34
+ mv target/release/libbeaconcrypt.a target/release/libbeaconcrypt-gobinds-${{ matrix.os }}.a
35
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features beacon --crate-type=staticlib
36
+ mv target/release/libbeaconcrypt.a target/release/libbeaconcrypt-beacon-${{ matrix.os }}.a
34
37
  - name: Run tests
35
38
  run: cargo test --verbose
36
- - name: Rename
37
- run: mv target/release/libbeaconcrypt.a target/release/libbeaconcrypt-${{ matrix.os }}.a
38
39
  - name: Upload release artifact
39
40
  uses: actions/upload-artifact@v7
40
41
  with:
41
42
  name: beaconcrypt-static-${{ matrix.os }}
42
- path: target/release/libbeaconcrypt-${{ matrix.os }}.a
43
- retention-days: 7
43
+ path: target/release/libbeaconcrypt-*.a
44
+ retention-days: 1
44
45
 
45
46
  windows-build:
46
47
  strategy:
@@ -52,6 +53,8 @@ jobs:
52
53
 
53
54
  steps:
54
55
  - uses: actions/checkout@v7
56
+ with:
57
+ submodules: recursive
55
58
  - name: Install cap'n proto
56
59
  run: |
57
60
  curl.exe -O https://capnproto.org/capnproto-c++-win32-1.5.0.zip
@@ -60,20 +63,21 @@ jobs:
60
63
  run: |
61
64
  $env:Path = "$env:Path;$(join-path $pwd '\capnproto-c++-win32-1.5.0\capnproto-tools-win32-1.5.0')"
62
65
  rustup component add rust-src --toolchain nightly-msvc
63
- cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features beacon,server,pqxdh --crate-type=staticlib
66
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features gobinds --crate-type=staticlib
67
+ mv target/release/beaconcrypt.lib target/release/beaconcrypt-gobinds-${{ matrix.os }}.lib
68
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features beacon --crate-type=staticlib
69
+ mv target/release/beaconcrypt.lib target/release/beaconcrypt-beacon-${{ matrix.os }}.lib
64
70
  ls target/release
65
71
  - name: Run tests
66
72
  run: |
67
73
  $env:Path = "$env:Path;$(join-path $pwd '\capnproto-c++-win32-1.5.0\capnproto-tools-win32-1.5.0')"
68
74
  cargo test --verbose
69
- - name: Rename
70
- run: mv target/release/beaconcrypt.lib target/release/beaconcrypt-${{ matrix.os }}.lib
71
75
  - name: Upload release artifact
72
76
  uses: actions/upload-artifact@v7
73
77
  with:
74
78
  name: beaconcrypt-static-${{ matrix.os }}
75
- path: target/release/beaconcrypt-${{ matrix.os }}.lib
76
- retention-days: 7
79
+ path: target/release/beaconcrypt-*.lib
80
+ retention-days: 1
77
81
 
78
82
  windows-mingw-build:
79
83
  runs-on: windows-latest
@@ -82,6 +86,8 @@ jobs:
82
86
 
83
87
  steps:
84
88
  - uses: actions/checkout@v7
89
+ with:
90
+ submodules: recursive
85
91
  - name: Set up MinGW
86
92
  uses: msys2/setup-msys2@v2
87
93
  with:
@@ -98,23 +104,25 @@ jobs:
98
104
  run: |
99
105
  rustup target add x86_64-pc-windows-gnu --toolchain nightly
100
106
  rustup component add rust-src --toolchain nightly
101
- cargo +nightly rustc --release -Z build-std=std,panic_abort --target x86_64-pc-windows-gnu --no-default-features --features beacon,server,pqxdh --crate-type=staticlib
107
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --target x86_64-pc-windows-gnu --no-default-features --features gobinds --crate-type=staticlib
108
+ mv target/x86_64-pc-windows-gnu/release/libbeaconcrypt.a target/x86_64-pc-windows-gnu/release/libbeaconcrypt-gobinds-windows-mingw-x86_64.a
109
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --target x86_64-pc-windows-gnu --no-default-features --features beacon --crate-type=staticlib
110
+ mv target/x86_64-pc-windows-gnu/release/libbeaconcrypt.a target/x86_64-pc-windows-gnu/release/libbeaconcrypt-beacon-windows-mingw-x86_64.a
102
111
  ls target/x86_64-pc-windows-gnu/release
103
112
  - name: Run tests
104
113
  env:
105
114
  CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: gcc
106
115
  run: cargo test --verbose --target x86_64-pc-windows-gnu
107
- - name: Rename
108
- run: mv target/x86_64-pc-windows-gnu/release/libbeaconcrypt.a target/x86_64-pc-windows-gnu/release/libbeaconcrypt-windows-mingw-x86_64.a
109
116
  - name: Upload release artifact
110
117
  uses: actions/upload-artifact@v7
111
118
  with:
112
119
  name: beaconcrypt-static-windows-mingw-x86_64
113
- path: target/x86_64-pc-windows-gnu/release/libbeaconcrypt-windows-mingw-x86_64.a
114
- retention-days: 7
120
+ path: target/x86_64-pc-windows-gnu/release/libbeaconcrypt-*.a
121
+ retention-days: 1
115
122
 
116
123
  release:
117
- needs: [ubuntu-build, windows-build, windows-mingw-build]
124
+ needs: [unix-build, windows-build, windows-mingw-build]
125
+ if: ${{ github.ref_type == 'tag' }}
118
126
  runs-on: ubuntu-latest
119
127
  permissions:
120
128
  contents: write
@@ -18,9 +18,15 @@ jobs:
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v7
21
+ with:
22
+ submodules: recursive
21
23
  - name: Install cap'n proto
22
24
  run: sudo apt update && sudo apt install capnproto
23
25
  - name: Build
24
26
  run: cargo build --verbose
27
+ - name: Check PQXDH server build
28
+ run: cargo check --no-default-features --features pqxdh,server --lib
29
+ - name: Check PQXDH beacon build
30
+ run: cargo check --no-default-features --features pqxdh,beacon --lib
25
31
  - name: Run tests
26
32
  run: cargo test --verbose
@@ -0,0 +1,3 @@
1
+ [submodule "wycheproof"]
2
+ path = wycheproof
3
+ url = https://github.com/C2SP/wycheproof.git
@@ -78,13 +78,15 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
78
78
 
79
79
  [[package]]
80
80
  name = "beaconcrypt"
81
- version = "0.3.11"
81
+ version = "0.4.0"
82
82
  dependencies = [
83
83
  "capnp",
84
84
  "capnpc",
85
85
  "cbindgen",
86
86
  "libsodium-rs",
87
87
  "pyo3",
88
+ "serde",
89
+ "serde_json",
88
90
  "zeroize",
89
91
  ]
90
92
 
@@ -138,16 +140,16 @@ dependencies = [
138
140
  "quote",
139
141
  "serde",
140
142
  "serde_json",
141
- "syn",
143
+ "syn 2.0.119",
142
144
  "tempfile",
143
145
  "toml",
144
146
  ]
145
147
 
146
148
  [[package]]
147
149
  name = "cc"
148
- version = "1.2.67"
150
+ version = "1.4.0"
149
151
  source = "registry+https://github.com/rust-lang/crates.io-index"
150
- checksum = "e17dd265a7d0f31ef544e1b20e03add05d3b45b491b633b10d67145d2acc1a38"
152
+ checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9"
151
153
  dependencies = [
152
154
  "find-msvc-tools",
153
155
  "shlex",
@@ -161,9 +163,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
161
163
 
162
164
  [[package]]
163
165
  name = "clap"
164
- version = "4.6.2"
166
+ version = "4.6.4"
165
167
  source = "registry+https://github.com/rust-lang/crates.io-index"
166
- checksum = "dd059f9da4f5c36b3787f65d38ccaab1cc315f07b01f89abc8359ee6a8205011"
168
+ checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7"
167
169
  dependencies = [
168
170
  "clap_builder",
169
171
  ]
@@ -269,9 +271,9 @@ dependencies = [
269
271
 
270
272
  [[package]]
271
273
  name = "fastrand"
272
- version = "2.4.1"
274
+ version = "2.5.0"
273
275
  source = "registry+https://github.com/rust-lang/crates.io-index"
274
- checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
276
+ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
275
277
 
276
278
  [[package]]
277
279
  name = "filetime"
@@ -379,15 +381,15 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
379
381
 
380
382
  [[package]]
381
383
  name = "libc"
382
- version = "0.2.186"
384
+ version = "0.2.189"
383
385
  source = "registry+https://github.com/rust-lang/crates.io-index"
384
- checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
386
+ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
385
387
 
386
388
  [[package]]
387
389
  name = "libflate"
388
- version = "2.3.0"
390
+ version = "2.3.1"
389
391
  source = "registry+https://github.com/rust-lang/crates.io-index"
390
- checksum = "cd96e993e5f3368b0cb8497dae6c860c22af8ff18388c61c6c0b86c58d86b5df"
392
+ checksum = "a4da9b700e758e57152a1fd1c52cbdc5727c1aa6d8743dc1acda917398f1d76c"
391
393
  dependencies = [
392
394
  "adler32",
393
395
  "crc32fast",
@@ -520,9 +522,9 @@ checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3"
520
522
 
521
523
  [[package]]
522
524
  name = "proc-macro2"
523
- version = "1.0.106"
525
+ version = "1.0.107"
524
526
  source = "registry+https://github.com/rust-lang/crates.io-index"
525
- checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
527
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
526
528
  dependencies = [
527
529
  "unicode-ident",
528
530
  ]
@@ -569,7 +571,7 @@ dependencies = [
569
571
  "proc-macro2",
570
572
  "pyo3-macros-backend",
571
573
  "quote",
572
- "syn",
574
+ "syn 2.0.119",
573
575
  ]
574
576
 
575
577
  [[package]]
@@ -581,14 +583,14 @@ dependencies = [
581
583
  "heck",
582
584
  "proc-macro2",
583
585
  "quote",
584
- "syn",
586
+ "syn 2.0.119",
585
587
  ]
586
588
 
587
589
  [[package]]
588
590
  name = "quote"
589
- version = "1.0.46"
591
+ version = "1.0.47"
590
592
  source = "registry+https://github.com/rust-lang/crates.io-index"
591
- checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
593
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
592
594
  dependencies = [
593
595
  "proc-macro2",
594
596
  ]
@@ -620,9 +622,9 @@ dependencies = [
620
622
 
621
623
  [[package]]
622
624
  name = "serde"
623
- version = "1.0.228"
625
+ version = "1.0.229"
624
626
  source = "registry+https://github.com/rust-lang/crates.io-index"
625
- checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
627
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
626
628
  dependencies = [
627
629
  "serde_core",
628
630
  "serde_derive",
@@ -630,29 +632,29 @@ dependencies = [
630
632
 
631
633
  [[package]]
632
634
  name = "serde_core"
633
- version = "1.0.228"
635
+ version = "1.0.229"
634
636
  source = "registry+https://github.com/rust-lang/crates.io-index"
635
- checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
637
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
636
638
  dependencies = [
637
639
  "serde_derive",
638
640
  ]
639
641
 
640
642
  [[package]]
641
643
  name = "serde_derive"
642
- version = "1.0.228"
644
+ version = "1.0.229"
643
645
  source = "registry+https://github.com/rust-lang/crates.io-index"
644
- checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
646
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
645
647
  dependencies = [
646
648
  "proc-macro2",
647
649
  "quote",
648
- "syn",
650
+ "syn 3.0.3",
649
651
  ]
650
652
 
651
653
  [[package]]
652
654
  name = "serde_json"
653
- version = "1.0.150"
655
+ version = "1.0.151"
654
656
  source = "registry+https://github.com/rust-lang/crates.io-index"
655
- checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
657
+ checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
656
658
  dependencies = [
657
659
  "itoa",
658
660
  "memchr",
@@ -699,6 +701,17 @@ dependencies = [
699
701
  "unicode-ident",
700
702
  ]
701
703
 
704
+ [[package]]
705
+ name = "syn"
706
+ version = "3.0.3"
707
+ source = "registry+https://github.com/rust-lang/crates.io-index"
708
+ checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
709
+ dependencies = [
710
+ "proc-macro2",
711
+ "quote",
712
+ "unicode-ident",
713
+ ]
714
+
702
715
  [[package]]
703
716
  name = "tar"
704
717
  version = "0.4.46"
@@ -746,7 +759,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
746
759
  dependencies = [
747
760
  "proc-macro2",
748
761
  "quote",
749
- "syn",
762
+ "syn 2.0.119",
750
763
  ]
751
764
 
752
765
  [[package]]
@@ -775,9 +788,9 @@ dependencies = [
775
788
 
776
789
  [[package]]
777
790
  name = "toml_parser"
778
- version = "1.1.2+spec-1.1.0"
791
+ version = "1.1.3+spec-1.1.0"
779
792
  source = "registry+https://github.com/rust-lang/crates.io-index"
780
- checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
793
+ checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
781
794
  dependencies = [
782
795
  "winnow 1.0.4",
783
796
  ]
@@ -897,7 +910,7 @@ checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"
897
910
  dependencies = [
898
911
  "proc-macro2",
899
912
  "quote",
900
- "syn",
913
+ "syn 2.0.119",
901
914
  ]
902
915
 
903
916
  [[package]]
@@ -0,0 +1,79 @@
1
+ [package]
2
+ name = "beaconcrypt"
3
+ version = "0.4.0"
4
+ edition = "2024"
5
+ license-file = "LICENSE"
6
+ readme = "README.md"
7
+ description = "Cryptographic transport for C2 channels"
8
+ rust-version = "1.96"
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
+
20
+ [lib]
21
+ name = "beaconcrypt"
22
+ crate-type = ["cdylib", "staticlib", "rlib"]
23
+
24
+ [[example]]
25
+ name = "rust"
26
+ path = "examples/rust/main.rs"
27
+ required-features = ["pqxdh", "beacon", "server"]
28
+
29
+ [[test]]
30
+ name = "beacon"
31
+ path = "tests/beacon.rs"
32
+ required-features = ["pqxdh", "beacon", "server"]
33
+
34
+ [[test]]
35
+ name = "protocol"
36
+ path = "tests/protocol.rs"
37
+ required-features = ["pqxdh", "beacon", "server"]
38
+
39
+ [[test]]
40
+ name = "server"
41
+ path = "tests/server.rs"
42
+ required-features = ["pqxdh", "beacon", "server"]
43
+
44
+ [[test]]
45
+ name = "wycheproof"
46
+ path = "tests/wycheproof.rs"
47
+ required-features = ["pqxdh"]
48
+
49
+ [build-dependencies]
50
+ capnpc = "0.26"
51
+ cbindgen = "0.29"
52
+
53
+ [dependencies]
54
+ capnp = "0.26"
55
+ libsodium-rs = "0.2"
56
+ zeroize = "1.9"
57
+ pyo3 = { version = "0.29.0", features = ["abi3-py311", "experimental-inspect"], optional = true }
58
+ serde = { version = "1", features = ["derive"], optional = true }
59
+ serde_json = { version = "1", optional = true }
60
+
61
+ [features]
62
+ default = ["beacon", "server", "pqxdh"]
63
+ server = ["pqxdh", "dep:serde", "dep:serde_json"]
64
+ beacon = ["pqxdh"]
65
+ pqxdh = []
66
+ gobinds = ["cbinds"]
67
+ cbinds = ["beacon", "server", "pqxdh"]
68
+ pybinds = ["dep:pyo3", "beacon", "server", "pqxdh"]
69
+ all = ["gobinds", "pybinds", "cbinds"]
70
+
71
+ [profile.release]
72
+ strip = true
73
+ lto = true
74
+ codegen-units = 1
75
+ panic = "abort"
76
+
77
+ [package.metadata.maturin]
78
+ name = "beaconcrypt"
79
+ bindings = "pyo3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beaconcrypt
3
- Version: 0.3.11
3
+ Version: 0.4.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -48,7 +48,7 @@ I don't use rust a lot, so the code is probably fairly naive. It provides both a
48
48
 
49
49
  The reference implementation expects that all beacons are compiled with the server's public key, and that beaconcrypt is initialized with it.
50
50
 
51
- The server is currently not very usable as it doesn't support saving the state of any individual beacon. This means that if your server goes down, you will not be able to communicate with any previously-registered beacons anymore. The server doesn't support being initialized with an Ed25519 seed (32 random bytes). Users wishing to use the server in practical cases should use this interface to ensure their server keeps its identity across reboots.
51
+ The server is currently not very usable as it doesn't support saving the state of any individual beacon. This means that if your server goes down, you will not be able to communicate with any previously-registered beacons anymore. The server does support being initialized with an Ed25519 seed (32 random bytes). Users wishing to use the server in practical cases should use this interface to ensure their server keeps its identity across reboots.
52
52
 
53
53
  ## Building
54
54
  You will need [Capn'Proto](https://capnproto.org/install.html) (just the binaries) and a recent version of rust for every build.
@@ -58,7 +58,7 @@ For windows, I prefer building with stable-gnu for normal usage, and nightly-gnu
58
58
  Build and run all tests:
59
59
  ```bash
60
60
  cargo test
61
- cargo build --features gobinds --target x86_64-pc-windows-gnu
61
+ cargo build --features gobinds --release --target x86_64-pc-windows-gnu
62
62
  go test -a -count=1 .
63
63
  uv run maturin develop --uv
64
64
  uv run pytest tests
@@ -66,15 +66,49 @@ uv run pytest tests
66
66
 
67
67
  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.
68
68
 
69
- ## Profiles
70
- 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.
69
+ ### Reproducing known-answer test vectors
71
70
 
72
- **CNSA2 is currently completely broken**
71
+ The fixed cryptographic values used by the Rust known-answer tests can be
72
+ reproduced independently with Python and Go. Run both generators from the
73
+ repository root:
74
+
75
+ ```bash
76
+ uv run python scripts/generate_kat_vectors.py
77
+ go run scripts/generate_kat_vectors.go
78
+ ```
79
+
80
+ The Python generator uses PyCryptodome. The Go generator uses the Go team's
81
+ crypto packages from `golang.org/x/crypto`. Their output should be identical;
82
+ any difference indicates that the vectors or one of the generators has
83
+ diverged.
84
+
85
+ ### Wycheproof
86
+
87
+ The test suite includes pinned [C2SP Wycheproof](https://github.com/C2SP/wycheproof)
88
+ vectors for X25519, Ed25519, ChaCha20-Poly1305-IETF, HKDF-SHA-512 and
89
+ ML-KEM-768. After cloning, initialize the vector submodule before running the
90
+ normal test suite:
91
+
92
+ ```bash
93
+ git submodule update --init --recursive
94
+ cargo test
95
+ ```
96
+
97
+ See [the Wycheproof test documentation](doc/wycheproof.md) for the coverage
98
+ matrix, result semantics and update procedure.
73
99
 
74
100
  ## Usage
75
- 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.
101
+ 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 currently only tested 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.
102
+
103
+ From Rust, usage is mostly just instantiating `CryptoProvider` objects. See the [example](examples/rust/main.rs) for usage.
76
104
 
77
- 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. When using the C FFI, the caller is responsible for the buffers passed into the library. Assume the library does not do any copies, except for initialization functions, and never frees the buffers it is passed.
105
+ From python, you can just use the wheels published to pypi, see the [example](examples/python/main.py) for usage.
106
+
107
+ The [C interface](src/cbinds.rs) emulates the class interface, the caller is responsible for providing a valid state object to every function. See the [example](examples/c/main.c) for usage.
108
+
109
+ 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.
78
110
 
79
111
  # Copyright
80
112
  This work is dedicated to the public domain.
113
+
114
+ 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.