confium 0.3.4 → 0.4.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/Cargo.lock +12 -432
- data/README.adoc +6 -10
- data/ext/confium_native/Cargo.toml +0 -4
- data/ext/confium_native/src/lib.rs +0 -2
- data/lib/confium/openpgp.rb +138 -16
- data/lib/confium/version.rb +1 -1
- data/lib/confium.rb +7 -0
- metadata +2 -3
- data/ext/confium_native/src/openpgp.rs +0 -55
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 322f29b8f4f4e0ad02bec82cbb5a99ea45852fc618f09344c35fb1d42319afbb
|
|
4
|
+
data.tar.gz: e1050278065503030b8f82dd10047eda3363ac3b875456cfe7b2c2ce17573975
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cdc24b0b728d4f8afc59d6f5e63e9f4a4c328aab34dca675b51391f340699b33b9d216baf2c433bac7fe6ee29f24aca134323b8cda0c5904b498621debd82ed
|
|
7
|
+
data.tar.gz: 71a1d6c636f88a80f31bcd7682cfc6762d99882a3eeed12ba5315ce81225068e280069a3ab2a3b2378d30abc928842c9561cf451ddfeda2038dda94768525ab7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.0] — 2026-08-23
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **The native extension is pure Rust — the vendored RNP stack
|
|
8
|
+
(librnp + Botan + json-c, a full C/C++ build) is gone.** It was
|
|
9
|
+
compiled into every install but used only for ASCII armor, which
|
|
10
|
+
is now implemented in pure Ruby (RFC 9580 §6, byte-for-byte
|
|
11
|
+
compatible with the previous output; differential vectors in
|
|
12
|
+
spec/fixtures/openpgp_armor_vectors.json). Source builds now need
|
|
13
|
+
only a Rust toolchain — no C compiler, no cmake, and no network
|
|
14
|
+
fetch of C sources — and compile in ~2 minutes instead of ~15.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **Windows (`x64-mingw-ucrt`) and musl Linux
|
|
19
|
+
(`x86_64-linux-musl`, `aarch64-linux-musl`) platform gems**,
|
|
20
|
+
unblocked by the dependency removal: pure Rust builds natively
|
|
21
|
+
under mingw and in Alpine containers (aarch64 under QEMU). All
|
|
22
|
+
are install-checked on every supported Ruby before publishing,
|
|
23
|
+
and Windows joins the test matrix.
|
|
24
|
+
- `Confium::OpenPGP.dearmor` now verifies the CRC-24 checksum and
|
|
25
|
+
raises `Confium::ParseError` on malformed blocks (previously a
|
|
26
|
+
bare rnp failure).
|
|
27
|
+
|
|
3
28
|
## [0.3.4] — 2026-08-23
|
|
4
29
|
|
|
5
30
|
### Fixed
|
data/Cargo.lock
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
# It is not intended for manual editing.
|
|
3
3
|
version = 4
|
|
4
4
|
|
|
5
|
-
[[package]]
|
|
6
|
-
name = "adler2"
|
|
7
|
-
version = "2.0.1"
|
|
8
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
-
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
|
10
|
-
|
|
11
5
|
[[package]]
|
|
12
6
|
name = "aead"
|
|
13
7
|
version = "0.5.2"
|
|
@@ -79,12 +73,6 @@ version = "0.2.0"
|
|
|
79
73
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
74
|
checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
|
|
81
75
|
|
|
82
|
-
[[package]]
|
|
83
|
-
name = "base64"
|
|
84
|
-
version = "0.22.1"
|
|
85
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
86
|
-
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
|
87
|
-
|
|
88
76
|
[[package]]
|
|
89
77
|
name = "base64ct"
|
|
90
78
|
version = "1.8.3"
|
|
@@ -101,8 +89,6 @@ dependencies = [
|
|
|
101
89
|
"cexpr",
|
|
102
90
|
"clang-sys",
|
|
103
91
|
"itertools",
|
|
104
|
-
"log",
|
|
105
|
-
"prettyplease",
|
|
106
92
|
"proc-macro2",
|
|
107
93
|
"quote",
|
|
108
94
|
"regex",
|
|
@@ -138,29 +124,12 @@ dependencies = [
|
|
|
138
124
|
"generic-array",
|
|
139
125
|
]
|
|
140
126
|
|
|
141
|
-
[[package]]
|
|
142
|
-
name = "botan-src"
|
|
143
|
-
version = "0.31200.0"
|
|
144
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
145
|
-
checksum = "dce062ff9328d757ea205177cab939e6ce2aeb7a64bb559263fbe9251c5b1f5b"
|
|
146
|
-
dependencies = [
|
|
147
|
-
"lzma-rs",
|
|
148
|
-
"sha2",
|
|
149
|
-
"tar",
|
|
150
|
-
]
|
|
151
|
-
|
|
152
127
|
[[package]]
|
|
153
128
|
name = "bumpalo"
|
|
154
129
|
version = "3.20.3"
|
|
155
130
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
156
131
|
checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
|
|
157
132
|
|
|
158
|
-
[[package]]
|
|
159
|
-
name = "byteorder"
|
|
160
|
-
version = "1.5.0"
|
|
161
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
162
|
-
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
|
163
|
-
|
|
164
133
|
[[package]]
|
|
165
134
|
name = "bytes"
|
|
166
135
|
version = "1.12.1"
|
|
@@ -227,15 +196,6 @@ dependencies = [
|
|
|
227
196
|
"libloading",
|
|
228
197
|
]
|
|
229
198
|
|
|
230
|
-
[[package]]
|
|
231
|
-
name = "cmake"
|
|
232
|
-
version = "0.1.58"
|
|
233
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
234
|
-
checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"
|
|
235
|
-
dependencies = [
|
|
236
|
-
"cc",
|
|
237
|
-
]
|
|
238
|
-
|
|
239
199
|
[[package]]
|
|
240
200
|
name = "confium-api"
|
|
241
201
|
version = "0.3.0"
|
|
@@ -294,7 +254,7 @@ dependencies = [
|
|
|
294
254
|
"serde",
|
|
295
255
|
"serde_json",
|
|
296
256
|
"sha2",
|
|
297
|
-
"snafu
|
|
257
|
+
"snafu",
|
|
298
258
|
"thiserror",
|
|
299
259
|
"tracing",
|
|
300
260
|
"zeroize",
|
|
@@ -310,7 +270,7 @@ dependencies = [
|
|
|
310
270
|
"inventory",
|
|
311
271
|
"libloading",
|
|
312
272
|
"rand",
|
|
313
|
-
"snafu
|
|
273
|
+
"snafu",
|
|
314
274
|
"zeroize",
|
|
315
275
|
]
|
|
316
276
|
|
|
@@ -363,7 +323,7 @@ dependencies = [
|
|
|
363
323
|
"data-encoding",
|
|
364
324
|
"serde",
|
|
365
325
|
"serde_json",
|
|
366
|
-
"snafu
|
|
326
|
+
"snafu",
|
|
367
327
|
"thiserror",
|
|
368
328
|
"toml",
|
|
369
329
|
"url",
|
|
@@ -388,7 +348,7 @@ checksum = "98a17fd08f3f04772fa0227e0855d38d7de0637996fb44e058da098e069fab28"
|
|
|
388
348
|
dependencies = [
|
|
389
349
|
"confium-api",
|
|
390
350
|
"inventory",
|
|
391
|
-
"snafu
|
|
351
|
+
"snafu",
|
|
392
352
|
"url",
|
|
393
353
|
]
|
|
394
354
|
|
|
@@ -419,7 +379,7 @@ dependencies = [
|
|
|
419
379
|
"serde",
|
|
420
380
|
"serde_json",
|
|
421
381
|
"sha2",
|
|
422
|
-
"snafu
|
|
382
|
+
"snafu",
|
|
423
383
|
"spki",
|
|
424
384
|
"thiserror",
|
|
425
385
|
"x509-cert",
|
|
@@ -453,7 +413,7 @@ checksum = "66f760cf6182b532f7746b95842e2b4599ab78a5bbe35af2992df309417e5975"
|
|
|
453
413
|
dependencies = [
|
|
454
414
|
"confium-api",
|
|
455
415
|
"inventory",
|
|
456
|
-
"snafu
|
|
416
|
+
"snafu",
|
|
457
417
|
]
|
|
458
418
|
|
|
459
419
|
[[package]]
|
|
@@ -482,7 +442,7 @@ dependencies = [
|
|
|
482
442
|
"serde",
|
|
483
443
|
"serde_json",
|
|
484
444
|
"sha2",
|
|
485
|
-
"snafu
|
|
445
|
+
"snafu",
|
|
486
446
|
"subtle",
|
|
487
447
|
"thiserror",
|
|
488
448
|
"tracing",
|
|
@@ -507,7 +467,7 @@ dependencies = [
|
|
|
507
467
|
"p256",
|
|
508
468
|
"rand",
|
|
509
469
|
"sha2",
|
|
510
|
-
"snafu
|
|
470
|
+
"snafu",
|
|
511
471
|
"zeroize",
|
|
512
472
|
]
|
|
513
473
|
|
|
@@ -530,7 +490,7 @@ dependencies = [
|
|
|
530
490
|
"serde",
|
|
531
491
|
"serde_json",
|
|
532
492
|
"sha2",
|
|
533
|
-
"snafu
|
|
493
|
+
"snafu",
|
|
534
494
|
"subtle",
|
|
535
495
|
"thiserror",
|
|
536
496
|
"tracing",
|
|
@@ -579,7 +539,7 @@ dependencies = [
|
|
|
579
539
|
"inventory",
|
|
580
540
|
"p256",
|
|
581
541
|
"sha2",
|
|
582
|
-
"snafu
|
|
542
|
+
"snafu",
|
|
583
543
|
"zeroize",
|
|
584
544
|
]
|
|
585
545
|
|
|
@@ -613,7 +573,7 @@ dependencies = [
|
|
|
613
573
|
"serde",
|
|
614
574
|
"serde_json",
|
|
615
575
|
"sha2",
|
|
616
|
-
"snafu
|
|
576
|
+
"snafu",
|
|
617
577
|
"thiserror",
|
|
618
578
|
]
|
|
619
579
|
|
|
@@ -644,7 +604,6 @@ dependencies = [
|
|
|
644
604
|
"p256",
|
|
645
605
|
"rand_core",
|
|
646
606
|
"rb-sys",
|
|
647
|
-
"rnp-rs",
|
|
648
607
|
"serde_json",
|
|
649
608
|
"sha2",
|
|
650
609
|
"subtle",
|
|
@@ -671,30 +630,6 @@ dependencies = [
|
|
|
671
630
|
"libc",
|
|
672
631
|
]
|
|
673
632
|
|
|
674
|
-
[[package]]
|
|
675
|
-
name = "crc"
|
|
676
|
-
version = "3.4.0"
|
|
677
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
678
|
-
checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d"
|
|
679
|
-
dependencies = [
|
|
680
|
-
"crc-catalog",
|
|
681
|
-
]
|
|
682
|
-
|
|
683
|
-
[[package]]
|
|
684
|
-
name = "crc-catalog"
|
|
685
|
-
version = "2.5.0"
|
|
686
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
687
|
-
checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853"
|
|
688
|
-
|
|
689
|
-
[[package]]
|
|
690
|
-
name = "crc32fast"
|
|
691
|
-
version = "1.5.0"
|
|
692
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
693
|
-
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
|
694
|
-
dependencies = [
|
|
695
|
-
"cfg-if",
|
|
696
|
-
]
|
|
697
|
-
|
|
698
633
|
[[package]]
|
|
699
634
|
name = "crypto-bigint"
|
|
700
635
|
version = "0.5.5"
|
|
@@ -880,16 +815,6 @@ version = "1.0.2"
|
|
|
880
815
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
881
816
|
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
882
817
|
|
|
883
|
-
[[package]]
|
|
884
|
-
name = "errno"
|
|
885
|
-
version = "0.3.14"
|
|
886
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
887
|
-
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
|
888
|
-
dependencies = [
|
|
889
|
-
"libc",
|
|
890
|
-
"windows-sys 0.61.2",
|
|
891
|
-
]
|
|
892
|
-
|
|
893
818
|
[[package]]
|
|
894
819
|
name = "ff"
|
|
895
820
|
version = "0.13.1"
|
|
@@ -906,16 +831,6 @@ version = "0.2.9"
|
|
|
906
831
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
907
832
|
checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
|
|
908
833
|
|
|
909
|
-
[[package]]
|
|
910
|
-
name = "filetime"
|
|
911
|
-
version = "0.2.29"
|
|
912
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
913
|
-
checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"
|
|
914
|
-
dependencies = [
|
|
915
|
-
"cfg-if",
|
|
916
|
-
"libc",
|
|
917
|
-
]
|
|
918
|
-
|
|
919
834
|
[[package]]
|
|
920
835
|
name = "find-msvc-tools"
|
|
921
836
|
version = "0.1.9"
|
|
@@ -928,16 +843,6 @@ version = "0.4.7"
|
|
|
928
843
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
929
844
|
checksum = "b7ac824320a75a52197e8f2d787f6a38b6718bb6897a35142d749af3c0e8f4fe"
|
|
930
845
|
|
|
931
|
-
[[package]]
|
|
932
|
-
name = "flate2"
|
|
933
|
-
version = "1.1.9"
|
|
934
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
935
|
-
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
|
|
936
|
-
dependencies = [
|
|
937
|
-
"crc32fast",
|
|
938
|
-
"miniz_oxide",
|
|
939
|
-
]
|
|
940
|
-
|
|
941
846
|
[[package]]
|
|
942
847
|
name = "foldhash"
|
|
943
848
|
version = "0.1.5"
|
|
@@ -1070,22 +975,6 @@ dependencies = [
|
|
|
1070
975
|
"digest",
|
|
1071
976
|
]
|
|
1072
977
|
|
|
1073
|
-
[[package]]
|
|
1074
|
-
name = "http"
|
|
1075
|
-
version = "1.5.0"
|
|
1076
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1077
|
-
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
|
|
1078
|
-
dependencies = [
|
|
1079
|
-
"bytes",
|
|
1080
|
-
"itoa",
|
|
1081
|
-
]
|
|
1082
|
-
|
|
1083
|
-
[[package]]
|
|
1084
|
-
name = "httparse"
|
|
1085
|
-
version = "1.10.1"
|
|
1086
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1087
|
-
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
|
1088
|
-
|
|
1089
978
|
[[package]]
|
|
1090
979
|
name = "iana-time-zone"
|
|
1091
980
|
version = "0.1.65"
|
|
@@ -1289,12 +1178,6 @@ dependencies = [
|
|
|
1289
1178
|
"windows-link",
|
|
1290
1179
|
]
|
|
1291
1180
|
|
|
1292
|
-
[[package]]
|
|
1293
|
-
name = "linux-raw-sys"
|
|
1294
|
-
version = "0.12.1"
|
|
1295
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1296
|
-
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
|
1297
|
-
|
|
1298
1181
|
[[package]]
|
|
1299
1182
|
name = "litemap"
|
|
1300
1183
|
version = "0.8.2"
|
|
@@ -1316,16 +1199,6 @@ dependencies = [
|
|
|
1316
1199
|
"hashbrown 0.15.5",
|
|
1317
1200
|
]
|
|
1318
1201
|
|
|
1319
|
-
[[package]]
|
|
1320
|
-
name = "lzma-rs"
|
|
1321
|
-
version = "0.3.0"
|
|
1322
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1323
|
-
checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e"
|
|
1324
|
-
dependencies = [
|
|
1325
|
-
"byteorder",
|
|
1326
|
-
"crc",
|
|
1327
|
-
]
|
|
1328
|
-
|
|
1329
1202
|
[[package]]
|
|
1330
1203
|
name = "magnus"
|
|
1331
1204
|
version = "0.8.2"
|
|
@@ -1362,16 +1235,6 @@ version = "0.2.1"
|
|
|
1362
1235
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1363
1236
|
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
1364
1237
|
|
|
1365
|
-
[[package]]
|
|
1366
|
-
name = "miniz_oxide"
|
|
1367
|
-
version = "0.8.9"
|
|
1368
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1369
|
-
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
|
1370
|
-
dependencies = [
|
|
1371
|
-
"adler2",
|
|
1372
|
-
"simd-adler32",
|
|
1373
|
-
]
|
|
1374
|
-
|
|
1375
1238
|
[[package]]
|
|
1376
1239
|
name = "nom"
|
|
1377
1240
|
version = "7.1.3"
|
|
@@ -1494,12 +1357,6 @@ dependencies = [
|
|
|
1494
1357
|
"spki",
|
|
1495
1358
|
]
|
|
1496
1359
|
|
|
1497
|
-
[[package]]
|
|
1498
|
-
name = "pkg-config"
|
|
1499
|
-
version = "0.3.33"
|
|
1500
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1501
|
-
checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"
|
|
1502
|
-
|
|
1503
1360
|
[[package]]
|
|
1504
1361
|
name = "polyval"
|
|
1505
1362
|
version = "0.6.2"
|
|
@@ -1530,16 +1387,6 @@ dependencies = [
|
|
|
1530
1387
|
"zerocopy",
|
|
1531
1388
|
]
|
|
1532
1389
|
|
|
1533
|
-
[[package]]
|
|
1534
|
-
name = "prettyplease"
|
|
1535
|
-
version = "0.2.37"
|
|
1536
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1537
|
-
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
|
1538
|
-
dependencies = [
|
|
1539
|
-
"proc-macro2",
|
|
1540
|
-
"syn 2.0.119",
|
|
1541
|
-
]
|
|
1542
|
-
|
|
1543
1390
|
[[package]]
|
|
1544
1391
|
name = "primeorder"
|
|
1545
1392
|
version = "0.13.6"
|
|
@@ -1673,45 +1520,6 @@ dependencies = [
|
|
|
1673
1520
|
"subtle",
|
|
1674
1521
|
]
|
|
1675
1522
|
|
|
1676
|
-
[[package]]
|
|
1677
|
-
name = "ring"
|
|
1678
|
-
version = "0.17.14"
|
|
1679
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1680
|
-
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
|
|
1681
|
-
dependencies = [
|
|
1682
|
-
"cc",
|
|
1683
|
-
"cfg-if",
|
|
1684
|
-
"getrandom",
|
|
1685
|
-
"libc",
|
|
1686
|
-
"untrusted",
|
|
1687
|
-
"windows-sys 0.52.0",
|
|
1688
|
-
]
|
|
1689
|
-
|
|
1690
|
-
[[package]]
|
|
1691
|
-
name = "rnp-rs"
|
|
1692
|
-
version = "0.1.10"
|
|
1693
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1694
|
-
checksum = "2a2d89cee37da7283f21f7856fca63727d5e50d2d150d8f8b124d4fcd8c6a60b"
|
|
1695
|
-
dependencies = [
|
|
1696
|
-
"bindgen",
|
|
1697
|
-
"pkg-config",
|
|
1698
|
-
"rnp-src",
|
|
1699
|
-
"snafu 0.9.2",
|
|
1700
|
-
]
|
|
1701
|
-
|
|
1702
|
-
[[package]]
|
|
1703
|
-
name = "rnp-src"
|
|
1704
|
-
version = "0.1.2"
|
|
1705
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1706
|
-
checksum = "852eede0415d60b1b5b586a330b94ce014bd83df69f7388205f8cfee62840f49"
|
|
1707
|
-
dependencies = [
|
|
1708
|
-
"botan-src",
|
|
1709
|
-
"cmake",
|
|
1710
|
-
"flate2",
|
|
1711
|
-
"tar",
|
|
1712
|
-
"ureq",
|
|
1713
|
-
]
|
|
1714
|
-
|
|
1715
1523
|
[[package]]
|
|
1716
1524
|
name = "rustc-hash"
|
|
1717
1525
|
version = "2.1.3"
|
|
@@ -1727,54 +1535,6 @@ dependencies = [
|
|
|
1727
1535
|
"semver",
|
|
1728
1536
|
]
|
|
1729
1537
|
|
|
1730
|
-
[[package]]
|
|
1731
|
-
name = "rustix"
|
|
1732
|
-
version = "1.1.4"
|
|
1733
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1734
|
-
checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
|
|
1735
|
-
dependencies = [
|
|
1736
|
-
"bitflags",
|
|
1737
|
-
"errno",
|
|
1738
|
-
"libc",
|
|
1739
|
-
"linux-raw-sys",
|
|
1740
|
-
"windows-sys 0.61.2",
|
|
1741
|
-
]
|
|
1742
|
-
|
|
1743
|
-
[[package]]
|
|
1744
|
-
name = "rustls"
|
|
1745
|
-
version = "0.23.43"
|
|
1746
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1747
|
-
checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
|
|
1748
|
-
dependencies = [
|
|
1749
|
-
"log",
|
|
1750
|
-
"once_cell",
|
|
1751
|
-
"ring",
|
|
1752
|
-
"rustls-pki-types",
|
|
1753
|
-
"rustls-webpki",
|
|
1754
|
-
"subtle",
|
|
1755
|
-
"zeroize",
|
|
1756
|
-
]
|
|
1757
|
-
|
|
1758
|
-
[[package]]
|
|
1759
|
-
name = "rustls-pki-types"
|
|
1760
|
-
version = "1.15.1"
|
|
1761
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1762
|
-
checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
|
|
1763
|
-
dependencies = [
|
|
1764
|
-
"zeroize",
|
|
1765
|
-
]
|
|
1766
|
-
|
|
1767
|
-
[[package]]
|
|
1768
|
-
name = "rustls-webpki"
|
|
1769
|
-
version = "0.103.13"
|
|
1770
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1771
|
-
checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
|
|
1772
|
-
dependencies = [
|
|
1773
|
-
"ring",
|
|
1774
|
-
"rustls-pki-types",
|
|
1775
|
-
"untrusted",
|
|
1776
|
-
]
|
|
1777
|
-
|
|
1778
1538
|
[[package]]
|
|
1779
1539
|
name = "rustversion"
|
|
1780
1540
|
version = "1.0.23"
|
|
@@ -1920,12 +1680,6 @@ dependencies = [
|
|
|
1920
1680
|
"rand_core",
|
|
1921
1681
|
]
|
|
1922
1682
|
|
|
1923
|
-
[[package]]
|
|
1924
|
-
name = "simd-adler32"
|
|
1925
|
-
version = "0.3.10"
|
|
1926
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1927
|
-
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
|
|
1928
|
-
|
|
1929
1683
|
[[package]]
|
|
1930
1684
|
name = "slab"
|
|
1931
1685
|
version = "0.4.12"
|
|
@@ -1944,16 +1698,7 @@ version = "0.8.9"
|
|
|
1944
1698
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1945
1699
|
checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2"
|
|
1946
1700
|
dependencies = [
|
|
1947
|
-
"snafu-derive
|
|
1948
|
-
]
|
|
1949
|
-
|
|
1950
|
-
[[package]]
|
|
1951
|
-
name = "snafu"
|
|
1952
|
-
version = "0.9.2"
|
|
1953
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1954
|
-
checksum = "e45cb604038abb7b926b679887b3226d8d0f23874b66623625a0454be425a4b7"
|
|
1955
|
-
dependencies = [
|
|
1956
|
-
"snafu-derive 0.9.2",
|
|
1701
|
+
"snafu-derive",
|
|
1957
1702
|
]
|
|
1958
1703
|
|
|
1959
1704
|
[[package]]
|
|
@@ -1968,18 +1713,6 @@ dependencies = [
|
|
|
1968
1713
|
"syn 2.0.119",
|
|
1969
1714
|
]
|
|
1970
1715
|
|
|
1971
|
-
[[package]]
|
|
1972
|
-
name = "snafu-derive"
|
|
1973
|
-
version = "0.9.2"
|
|
1974
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1975
|
-
checksum = "287f59010008f0d7cf5e3b03196d666c1acc46c8d3e9cf34c28a1a7157601e72"
|
|
1976
|
-
dependencies = [
|
|
1977
|
-
"heck",
|
|
1978
|
-
"proc-macro2",
|
|
1979
|
-
"quote",
|
|
1980
|
-
"syn 2.0.119",
|
|
1981
|
-
]
|
|
1982
|
-
|
|
1983
1716
|
[[package]]
|
|
1984
1717
|
name = "spki"
|
|
1985
1718
|
version = "0.7.3"
|
|
@@ -2041,17 +1774,6 @@ version = "1.0.1"
|
|
|
2041
1774
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2042
1775
|
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
|
2043
1776
|
|
|
2044
|
-
[[package]]
|
|
2045
|
-
name = "tar"
|
|
2046
|
-
version = "0.4.46"
|
|
2047
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2048
|
-
checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
|
|
2049
|
-
dependencies = [
|
|
2050
|
-
"filetime",
|
|
2051
|
-
"libc",
|
|
2052
|
-
"xattr",
|
|
2053
|
-
]
|
|
2054
|
-
|
|
2055
1777
|
[[package]]
|
|
2056
1778
|
name = "thiserror"
|
|
2057
1779
|
version = "1.0.69"
|
|
@@ -2197,41 +1919,6 @@ dependencies = [
|
|
|
2197
1919
|
"subtle",
|
|
2198
1920
|
]
|
|
2199
1921
|
|
|
2200
|
-
[[package]]
|
|
2201
|
-
name = "untrusted"
|
|
2202
|
-
version = "0.9.0"
|
|
2203
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2204
|
-
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
|
2205
|
-
|
|
2206
|
-
[[package]]
|
|
2207
|
-
name = "ureq"
|
|
2208
|
-
version = "3.3.0"
|
|
2209
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2210
|
-
checksum = "dea7109cdcd5864d4eeb1b58a1648dc9bf520360d7af16ec26d0a9354bafcfc0"
|
|
2211
|
-
dependencies = [
|
|
2212
|
-
"base64",
|
|
2213
|
-
"flate2",
|
|
2214
|
-
"log",
|
|
2215
|
-
"percent-encoding",
|
|
2216
|
-
"rustls",
|
|
2217
|
-
"rustls-pki-types",
|
|
2218
|
-
"ureq-proto",
|
|
2219
|
-
"utf8-zero",
|
|
2220
|
-
"webpki-roots",
|
|
2221
|
-
]
|
|
2222
|
-
|
|
2223
|
-
[[package]]
|
|
2224
|
-
name = "ureq-proto"
|
|
2225
|
-
version = "0.6.0"
|
|
2226
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2227
|
-
checksum = "e994ba84b0bd1b1b0cf92878b7ef898a5c1760108fe7b6010327e274917a808c"
|
|
2228
|
-
dependencies = [
|
|
2229
|
-
"base64",
|
|
2230
|
-
"http",
|
|
2231
|
-
"httparse",
|
|
2232
|
-
"log",
|
|
2233
|
-
]
|
|
2234
|
-
|
|
2235
1922
|
[[package]]
|
|
2236
1923
|
name = "url"
|
|
2237
1924
|
version = "2.5.8"
|
|
@@ -2244,12 +1931,6 @@ dependencies = [
|
|
|
2244
1931
|
"serde",
|
|
2245
1932
|
]
|
|
2246
1933
|
|
|
2247
|
-
[[package]]
|
|
2248
|
-
name = "utf8-zero"
|
|
2249
|
-
version = "0.8.1"
|
|
2250
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2251
|
-
checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e"
|
|
2252
|
-
|
|
2253
1934
|
[[package]]
|
|
2254
1935
|
name = "utf8_iter"
|
|
2255
1936
|
version = "1.0.4"
|
|
@@ -2313,15 +1994,6 @@ dependencies = [
|
|
|
2313
1994
|
"unicode-ident",
|
|
2314
1995
|
]
|
|
2315
1996
|
|
|
2316
|
-
[[package]]
|
|
2317
|
-
name = "webpki-roots"
|
|
2318
|
-
version = "1.0.9"
|
|
2319
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2320
|
-
checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a"
|
|
2321
|
-
dependencies = [
|
|
2322
|
-
"rustls-pki-types",
|
|
2323
|
-
]
|
|
2324
|
-
|
|
2325
1997
|
[[package]]
|
|
2326
1998
|
name = "windows-core"
|
|
2327
1999
|
version = "0.62.2"
|
|
@@ -2381,88 +2053,6 @@ dependencies = [
|
|
|
2381
2053
|
"windows-link",
|
|
2382
2054
|
]
|
|
2383
2055
|
|
|
2384
|
-
[[package]]
|
|
2385
|
-
name = "windows-sys"
|
|
2386
|
-
version = "0.52.0"
|
|
2387
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2388
|
-
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
|
2389
|
-
dependencies = [
|
|
2390
|
-
"windows-targets",
|
|
2391
|
-
]
|
|
2392
|
-
|
|
2393
|
-
[[package]]
|
|
2394
|
-
name = "windows-sys"
|
|
2395
|
-
version = "0.61.2"
|
|
2396
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2397
|
-
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
|
2398
|
-
dependencies = [
|
|
2399
|
-
"windows-link",
|
|
2400
|
-
]
|
|
2401
|
-
|
|
2402
|
-
[[package]]
|
|
2403
|
-
name = "windows-targets"
|
|
2404
|
-
version = "0.52.6"
|
|
2405
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2406
|
-
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
|
2407
|
-
dependencies = [
|
|
2408
|
-
"windows_aarch64_gnullvm",
|
|
2409
|
-
"windows_aarch64_msvc",
|
|
2410
|
-
"windows_i686_gnu",
|
|
2411
|
-
"windows_i686_gnullvm",
|
|
2412
|
-
"windows_i686_msvc",
|
|
2413
|
-
"windows_x86_64_gnu",
|
|
2414
|
-
"windows_x86_64_gnullvm",
|
|
2415
|
-
"windows_x86_64_msvc",
|
|
2416
|
-
]
|
|
2417
|
-
|
|
2418
|
-
[[package]]
|
|
2419
|
-
name = "windows_aarch64_gnullvm"
|
|
2420
|
-
version = "0.52.6"
|
|
2421
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2422
|
-
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
|
2423
|
-
|
|
2424
|
-
[[package]]
|
|
2425
|
-
name = "windows_aarch64_msvc"
|
|
2426
|
-
version = "0.52.6"
|
|
2427
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2428
|
-
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
|
2429
|
-
|
|
2430
|
-
[[package]]
|
|
2431
|
-
name = "windows_i686_gnu"
|
|
2432
|
-
version = "0.52.6"
|
|
2433
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2434
|
-
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
|
2435
|
-
|
|
2436
|
-
[[package]]
|
|
2437
|
-
name = "windows_i686_gnullvm"
|
|
2438
|
-
version = "0.52.6"
|
|
2439
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2440
|
-
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
|
2441
|
-
|
|
2442
|
-
[[package]]
|
|
2443
|
-
name = "windows_i686_msvc"
|
|
2444
|
-
version = "0.52.6"
|
|
2445
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2446
|
-
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
|
2447
|
-
|
|
2448
|
-
[[package]]
|
|
2449
|
-
name = "windows_x86_64_gnu"
|
|
2450
|
-
version = "0.52.6"
|
|
2451
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2452
|
-
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
|
2453
|
-
|
|
2454
|
-
[[package]]
|
|
2455
|
-
name = "windows_x86_64_gnullvm"
|
|
2456
|
-
version = "0.52.6"
|
|
2457
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2458
|
-
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
|
2459
|
-
|
|
2460
|
-
[[package]]
|
|
2461
|
-
name = "windows_x86_64_msvc"
|
|
2462
|
-
version = "0.52.6"
|
|
2463
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2464
|
-
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
2465
|
-
|
|
2466
2056
|
[[package]]
|
|
2467
2057
|
name = "winnow"
|
|
2468
2058
|
version = "0.7.15"
|
|
@@ -2501,16 +2091,6 @@ dependencies = [
|
|
|
2501
2091
|
"tls_codec",
|
|
2502
2092
|
]
|
|
2503
2093
|
|
|
2504
|
-
[[package]]
|
|
2505
|
-
name = "xattr"
|
|
2506
|
-
version = "1.6.1"
|
|
2507
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2508
|
-
checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"
|
|
2509
|
-
dependencies = [
|
|
2510
|
-
"libc",
|
|
2511
|
-
"rustix",
|
|
2512
|
-
]
|
|
2513
|
-
|
|
2514
2094
|
[[package]]
|
|
2515
2095
|
name = "yoke"
|
|
2516
2096
|
version = "0.8.3"
|
data/README.adoc
CHANGED
|
@@ -10,7 +10,7 @@ Confium supports three deployment modes:
|
|
|
10
10
|
* **Mode 2 — TC PKI replacement**: drop-in for existing PKI consumers (PKCS#11 server, OpenSSL 3.0 provider, JCE)
|
|
11
11
|
* **Mode 3 — TC Certificate PKI**: institutional deployments with custom certificate formats (OIML CNML, BIPM, pharma, accreditation)
|
|
12
12
|
|
|
13
|
-
This gem wraps the high-value Confium subsystems via a Rust native extension. Pre-compiled platform gems are published for Linux
|
|
13
|
+
This gem wraps the high-value Confium subsystems via a pure-Rust native extension (`rb_sys` + `magnus`, no C dependencies). Pre-compiled platform gems are published for Linux (glibc + musl), macOS, and Windows, so `gem install` needs no Rust toolchain there; other platforms build from source at install time.
|
|
14
14
|
|
|
15
15
|
== Installation
|
|
16
16
|
|
|
@@ -32,17 +32,13 @@ $ gem install confium
|
|
|
32
32
|
|
|
33
33
|
* Ruby ≥ 3.1
|
|
34
34
|
* Nothing else on the pre-compiled platforms: `x86_64-linux`,
|
|
35
|
-
`aarch64-linux`, `x86_64-
|
|
36
|
-
|
|
35
|
+
`aarch64-linux`, `x86_64-linux-musl`, `aarch64-linux-musl`,
|
|
36
|
+
`x86_64-darwin`, `arm64-darwin`, `x64-mingw-ucrt` (each gem
|
|
37
|
+
carries one extension per Ruby C-ABI window)
|
|
37
38
|
|
|
38
39
|
Source builds (other platforms, or installing from the repo) also
|
|
39
|
-
need
|
|
40
|
-
|
|
41
|
-
* Rust stable toolchain (`rustup default stable`)
|
|
42
|
-
* C toolchain (clang/gcc/Xcode CLT)
|
|
43
|
-
|
|
44
|
-
There is no separate `libconfium` to install — the extension
|
|
45
|
-
statically links everything.
|
|
40
|
+
need the Rust stable toolchain (`rustup default stable`) — and
|
|
41
|
+
nothing else: the extension has no C dependencies to satisfy.
|
|
46
42
|
|
|
47
43
|
== Quick start
|
|
48
44
|
|
|
@@ -55,9 +55,5 @@ chrono = "0.4"
|
|
|
55
55
|
hex = "0.4"
|
|
56
56
|
serde_json = "1"
|
|
57
57
|
|
|
58
|
-
# RNP (OpenPGP, RFC 9580) — hard-bundled with vendored feature so
|
|
59
|
-
# librnp is compiled from source via rnp-src. No system librnp needed.
|
|
60
|
-
rnp = { package = "rnp-rs", version = "0.1.10", features = ["vendored"] }
|
|
61
|
-
|
|
62
58
|
[profile.release]
|
|
63
59
|
lto = "off"
|
|
@@ -9,7 +9,6 @@ mod attributes;
|
|
|
9
9
|
mod composite;
|
|
10
10
|
mod deployment;
|
|
11
11
|
mod ers;
|
|
12
|
-
mod openpgp;
|
|
13
12
|
mod path;
|
|
14
13
|
mod pki;
|
|
15
14
|
mod tc;
|
|
@@ -51,6 +50,5 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
51
50
|
tc::init(ruby, confium)?;
|
|
52
51
|
audit::init(ruby, confium)?;
|
|
53
52
|
ers::init(ruby, confium)?;
|
|
54
|
-
openpgp::init(ruby, confium)?;
|
|
55
53
|
Ok(())
|
|
56
54
|
}
|
data/lib/confium/openpgp.rb
CHANGED
|
@@ -1,33 +1,155 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Confium::OpenPGP — OpenPGP (RFC 9580) via bundled rnp-rs.
|
|
4
|
-
#
|
|
5
|
-
# The native extension provides _native_armor / _native_dearmor.
|
|
6
|
-
# This file adds the idiomatic Ruby wrappers with default args.
|
|
7
|
-
#
|
|
8
|
-
# Architecture: RNP is HARD-BUNDLED in the native extension. No
|
|
9
|
-
# external gem dependency. Users get OpenPGP armor encode/decode
|
|
10
|
-
# out of the box.
|
|
11
|
-
|
|
12
3
|
module Confium
|
|
4
|
+
# OpenPGP ASCII armor (RFC 9580 §6) — Radix-64 framing with a
|
|
5
|
+
# CRC-24 checksum, implemented in pure Ruby.
|
|
6
|
+
#
|
|
7
|
+
# This replaced the earlier native wrapper around librnp, which
|
|
8
|
+
# pulled a full vendored Botan/json-c C/C++ build into every
|
|
9
|
+
# install just to do armor framing. The wire format is unchanged;
|
|
10
|
+
# spec/fixtures/openpgp_armor_vectors.json holds differential
|
|
11
|
+
# vectors captured from the native implementation.
|
|
13
12
|
module OpenPGP
|
|
13
|
+
MESSAGE = 'message'
|
|
14
|
+
PUBLIC_KEY = 'public key'
|
|
15
|
+
SECRET_KEY = 'secret key'
|
|
16
|
+
SIGNATURE = 'signature'
|
|
17
|
+
CLEARTEXT = 'cleartext signed message'
|
|
18
|
+
|
|
19
|
+
LABELS = {
|
|
20
|
+
nil => 'MESSAGE',
|
|
21
|
+
MESSAGE => 'MESSAGE',
|
|
22
|
+
'public key' => 'PUBLIC KEY BLOCK',
|
|
23
|
+
SECRET_KEY => 'PRIVATE KEY BLOCK',
|
|
24
|
+
'private key' => 'PRIVATE KEY BLOCK',
|
|
25
|
+
SIGNATURE => 'SIGNATURE',
|
|
26
|
+
# Raw bytes cannot form a cleartext-signed message (that
|
|
27
|
+
# requires a signature packet); armor them as a plain message.
|
|
28
|
+
CLEARTEXT => 'MESSAGE',
|
|
29
|
+
'cleartext' => 'MESSAGE'
|
|
30
|
+
}.freeze
|
|
31
|
+
|
|
32
|
+
CRC_POLY = 0x1864CFB
|
|
33
|
+
CRC_INIT = 0xB704CE
|
|
34
|
+
B64_CHARS = [('A'..'Z').to_a, ('a'..'z').to_a, ('0'..'9').to_a, %w[+ /]].flatten.freeze
|
|
35
|
+
CRC_TABLE = (0..255).map do |i|
|
|
36
|
+
c = i << 16
|
|
37
|
+
8.times do
|
|
38
|
+
c = c.nobits?(0x800_000) ? c << 1 : ((c << 1) ^ CRC_POLY)
|
|
39
|
+
c &= 0xFFFFFF
|
|
40
|
+
end
|
|
41
|
+
c
|
|
42
|
+
end.freeze
|
|
43
|
+
|
|
44
|
+
private_constant :LABELS, :CRC_POLY, :CRC_INIT, :B64_CHARS, :CRC_TABLE
|
|
45
|
+
|
|
14
46
|
class << self
|
|
15
|
-
# ASCII-armor encode raw bytes.
|
|
47
|
+
# ASCII-armor encode raw bytes. Output uses CRLF line endings
|
|
48
|
+
# and 76-character data lines, byte-for-byte matching the
|
|
49
|
+
# earlier native (rnp) implementation.
|
|
16
50
|
#
|
|
17
51
|
# @param data [String] Binary data to encode.
|
|
18
|
-
# @param type [String]
|
|
19
|
-
#
|
|
52
|
+
# @param type [String] One of MESSAGE, PUBLIC_KEY, SECRET_KEY,
|
|
53
|
+
# SIGNATURE, CLEARTEXT (armored as a plain message). Defaults
|
|
54
|
+
# to MESSAGE.
|
|
20
55
|
# @return [String] Armored ASCII string.
|
|
56
|
+
# @raise [ArgumentError] if +type+ is not a known armor type.
|
|
21
57
|
def armor(data, type = MESSAGE)
|
|
22
|
-
|
|
58
|
+
label = LABELS[type]
|
|
59
|
+
raise ArgumentError, "unknown armor type: #{type.inspect}" unless label
|
|
60
|
+
|
|
61
|
+
bytes = data.to_s.b
|
|
62
|
+
b64 = [bytes].pack('m0')
|
|
63
|
+
lines = b64.scan(/.{1,76}/)
|
|
64
|
+
<<~ARMOR.gsub("\n", "\r\n")
|
|
65
|
+
-----BEGIN PGP #{label}-----
|
|
66
|
+
|
|
67
|
+
#{lines.join("\n")}
|
|
68
|
+
=#{crc24_armor(bytes)}
|
|
69
|
+
-----END PGP #{label}-----
|
|
70
|
+
ARMOR
|
|
23
71
|
end
|
|
24
72
|
|
|
25
|
-
# Decode ASCII-armored data to raw bytes.
|
|
73
|
+
# Decode ASCII-armored data to raw bytes. Accepts LF or CRLF
|
|
74
|
+
# line endings, arbitrary line widths, and Armor Headers
|
|
75
|
+
# (Comment:, Version:, ...) between the BEGIN line and the
|
|
76
|
+
# blank line. The CRC-24 checksum line is verified when
|
|
77
|
+
# present.
|
|
26
78
|
#
|
|
27
79
|
# @param data [String] Armored ASCII string.
|
|
28
|
-
# @return [String] Raw binary data.
|
|
80
|
+
# @return [String] Raw binary data (ASCII-8BIT).
|
|
81
|
+
# @raise [Confium::ParseError] on missing delimiters, non-base64
|
|
82
|
+
# content, or a CRC mismatch.
|
|
29
83
|
def dearmor(data)
|
|
30
|
-
|
|
84
|
+
b64, crc_line = extract_body(data.to_s)
|
|
85
|
+
# @type var bytes: String
|
|
86
|
+
bytes = b64.unpack1('m0')
|
|
87
|
+
return ''.b if crc_line == crc24_armor(''.b) && b64.empty?
|
|
88
|
+
|
|
89
|
+
raise ParseError, 'armor CRC-24 checksum mismatch' if crc_line && crc24_armor(bytes) != crc_line.to_s
|
|
90
|
+
|
|
91
|
+
bytes
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
private
|
|
95
|
+
|
|
96
|
+
# Locate the armored block, skip the BEGIN line and any Armor
|
|
97
|
+
# Headers, and split the remaining lines into the joined
|
|
98
|
+
# Radix-64 data and the checksum line (if present).
|
|
99
|
+
def extract_body(text)
|
|
100
|
+
lines = block_lines(text)
|
|
101
|
+
b64, crc_line = collect_data(lines)
|
|
102
|
+
raise ParseError, 'armored block has no data' if b64.empty? && crc_line.nil?
|
|
103
|
+
|
|
104
|
+
[b64, crc_line]
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# The lines of the armored block between BEGIN and END, with
|
|
108
|
+
# the BEGIN line and any Armor Headers removed.
|
|
109
|
+
def block_lines(text)
|
|
110
|
+
slice = block_slice(text.gsub("\r\n", "\n"))
|
|
111
|
+
lines = slice.split("\n")
|
|
112
|
+
lines.shift # BEGIN
|
|
113
|
+
lines.shift while lines.first&.match?(/^\s|^[A-Za-z0-9-]+: /)
|
|
114
|
+
lines.shift if lines.first == ''
|
|
115
|
+
lines
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# The text between the BEGIN and END delimiter lines.
|
|
119
|
+
def block_slice(normalized)
|
|
120
|
+
begin_line = normalized.index(/^-----BEGIN PGP [A-Z ]+-----$/)
|
|
121
|
+
raise ParseError, 'not an ASCII-armored block (no BEGIN line)' unless begin_line
|
|
122
|
+
|
|
123
|
+
end_match = normalized.match(/^-----END PGP [A-Z ]+-----$/)
|
|
124
|
+
raise ParseError, 'not an ASCII-armored block (no END line)' unless end_match
|
|
125
|
+
|
|
126
|
+
normalized[begin_line...end_match.begin(0)].to_s
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def collect_data(lines)
|
|
130
|
+
b64 = +''
|
|
131
|
+
crc_line = nil
|
|
132
|
+
lines.each do |line|
|
|
133
|
+
next if line.empty?
|
|
134
|
+
|
|
135
|
+
if line.start_with?('=')
|
|
136
|
+
crc_line = line[1..]
|
|
137
|
+
elsif line.match?(%r{\A[A-Za-z0-9+/]+={0,2}\z})
|
|
138
|
+
b64 << line
|
|
139
|
+
else
|
|
140
|
+
raise ParseError, "invalid armor data line: #{line[0, 20].inspect}"
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
[b64, crc_line]
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# CRC-24 (RFC 9580 §6.1), encoded as the four Radix-64
|
|
147
|
+
# characters of the 24-bit value as three big-endian bytes.
|
|
148
|
+
def crc24_armor(bytes)
|
|
149
|
+
crc = CRC_INIT
|
|
150
|
+
bytes.each_byte { |b| crc = ((crc << 8) & 0xFFFFFF) ^ CRC_TABLE[((crc >> 16) ^ b) & 0xFF] }
|
|
151
|
+
three_bytes = [crc >> 16, (crc >> 8) & 0xFF, crc & 0xFF].pack('C3')
|
|
152
|
+
[three_bytes].pack('m0')
|
|
31
153
|
end
|
|
32
154
|
end
|
|
33
155
|
end
|
data/lib/confium/version.rb
CHANGED
data/lib/confium.rb
CHANGED
|
@@ -22,6 +22,13 @@ begin
|
|
|
22
22
|
begin
|
|
23
23
|
require_relative "confium_native/#{window}/confium_native"
|
|
24
24
|
rescue LoadError
|
|
25
|
+
# Fall back to the flat source-build path only when the windowed
|
|
26
|
+
# binary is absent; a present-but-unloadable binary must raise its
|
|
27
|
+
# real dlopen error instead of masquerading as "not built".
|
|
28
|
+
dlext = RbConfig::CONFIG['DLEXT'] || 'so'
|
|
29
|
+
windowed = File.expand_path("confium_native/#{window}/confium_native.#{dlext}", __dir__ || '.')
|
|
30
|
+
raise if File.exist?(windowed)
|
|
31
|
+
|
|
25
32
|
require_relative 'confium_native/confium_native'
|
|
26
33
|
end
|
|
27
34
|
rescue LoadError => e
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: confium
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Open
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rb_sys
|
|
@@ -121,7 +121,6 @@ files:
|
|
|
121
121
|
- ext/confium_native/src/deployment.rs
|
|
122
122
|
- ext/confium_native/src/ers.rs
|
|
123
123
|
- ext/confium_native/src/lib.rs
|
|
124
|
-
- ext/confium_native/src/openpgp.rs
|
|
125
124
|
- ext/confium_native/src/path.rs
|
|
126
125
|
- ext/confium_native/src/pki.rs
|
|
127
126
|
- ext/confium_native/src/tc.rs
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//! Confium::OpenPGP — OpenPGP (RFC 9580) operations via bundled rnp-rs.
|
|
2
|
-
//!
|
|
3
|
-
//! Confium ships RNP functionality baked into the native extension.
|
|
4
|
-
|
|
5
|
-
use magnus::{function, prelude::*, Error, Module, RModule, Ruby, TryConvert, Value};
|
|
6
|
-
use rnp::ops::ArmorType;
|
|
7
|
-
use rnp::{armor_bytes, dearmor_bytes};
|
|
8
|
-
|
|
9
|
-
use crate::util::{bytes_from_value, bytes_to_rstring};
|
|
10
|
-
|
|
11
|
-
/// Native: `Confium::OpenPGP._native_armor(data, type_str)` — 2 args.
|
|
12
|
-
/// The Ruby wrapper `Confium::OpenPGP.armor(data, type = MESSAGE)`
|
|
13
|
-
/// provides the default.
|
|
14
|
-
fn native_armor(ruby: &Ruby, data: Value, type_str: Value) -> Result<magnus::RString, Error> {
|
|
15
|
-
let bytes = bytes_from_value(data)?;
|
|
16
|
-
let ty = if type_str.is_nil() {
|
|
17
|
-
ArmorType::Message
|
|
18
|
-
} else {
|
|
19
|
-
let s: String = TryConvert::try_convert(type_str)?;
|
|
20
|
-
match s.as_str() {
|
|
21
|
-
"public key" => ArmorType::PublicKey,
|
|
22
|
-
"secret key" => ArmorType::SecretKey,
|
|
23
|
-
"signature" => ArmorType::Signature,
|
|
24
|
-
"cleartext signed message" | "cleartext" => ArmorType::Cleartext,
|
|
25
|
-
_ => ArmorType::Message,
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
let armored = armor_bytes(&bytes, ty)
|
|
29
|
-
.map_err(|e| crate::util::parse_error(e.to_string(), "OpenPGP.armor", Some("openpgp"), None))?;
|
|
30
|
-
Ok(bytes_to_rstring(ruby, &armored))
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/// Native: `Confium::OpenPGP._native_dearmor(data)` — 1 arg.
|
|
34
|
-
fn native_dearmor(ruby: &Ruby, data: Value) -> Result<magnus::RString, Error> {
|
|
35
|
-
let bytes = bytes_from_value(data)?;
|
|
36
|
-
let raw = dearmor_bytes(&bytes)
|
|
37
|
-
.map_err(|e| crate::util::parse_error(e.to_string(), "OpenPGP.dearmor", Some("openpgp"), None))?;
|
|
38
|
-
Ok(bytes_to_rstring(ruby, &raw))
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/// Initialize the `Confium::OpenPGP` module.
|
|
42
|
-
pub fn init(_ruby: &Ruby, parent: RModule) -> Result<(), Error> {
|
|
43
|
-
let openpgp = parent.define_module("OpenPGP")?;
|
|
44
|
-
|
|
45
|
-
openpgp.define_singleton_method("_native_armor", function!(native_armor, 2))?;
|
|
46
|
-
openpgp.define_singleton_method("_native_dearmor", function!(native_dearmor, 1))?;
|
|
47
|
-
|
|
48
|
-
openpgp.const_set("MESSAGE", "message")?;
|
|
49
|
-
openpgp.const_set("PUBLIC_KEY", "public key")?;
|
|
50
|
-
openpgp.const_set("SECRET_KEY", "secret key")?;
|
|
51
|
-
openpgp.const_set("SIGNATURE", "signature")?;
|
|
52
|
-
openpgp.const_set("CLEARTEXT", "cleartext signed message")?;
|
|
53
|
-
|
|
54
|
-
Ok(())
|
|
55
|
-
}
|