@shieldfive/crypto 1.0.0-beta.3 → 1.0.0-beta.4
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.
- package/CHANGELOG.md +56 -0
- package/SECURITY.md +33 -9
- package/dist/identity/index.d.ts +1 -1
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +1 -1
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/sign.d.ts +73 -21
- package/dist/identity/sign.d.ts.map +1 -1
- package/dist/identity/sign.js +105 -35
- package/dist/identity/sign.js.map +1 -1
- package/dist/streams/aes-gcm-v1.d.ts +9 -5
- package/dist/streams/aes-gcm-v1.d.ts.map +1 -1
- package/dist/streams/aes-gcm-v1.js +26 -24
- package/dist/streams/aes-gcm-v1.js.map +1 -1
- package/dist/streams/pq-hybrid-v1.d.ts +4 -3
- package/dist/streams/pq-hybrid-v1.d.ts.map +1 -1
- package/dist/streams/pq-hybrid-v1.js +20 -18
- package/dist/streams/pq-hybrid-v1.js.map +1 -1
- package/dist/suites/aes-gcm-v1/api.d.ts +15 -2
- package/dist/suites/aes-gcm-v1/api.d.ts.map +1 -1
- package/dist/suites/aes-gcm-v1/api.js.map +1 -1
- package/dist/suites/pq-hybrid-v1/index.d.ts.map +1 -1
- package/dist/suites/pq-hybrid-v1/index.js +11 -4
- package/dist/suites/pq-hybrid-v1/index.js.map +1 -1
- package/dist/suites/xchacha-v1/api.d.ts +9 -0
- package/dist/suites/xchacha-v1/api.d.ts.map +1 -1
- package/dist/suites/xchacha-v1/api.js.map +1 -1
- package/package.json +2 -1
- package/spec/format-v1.md +59 -17
- package/spec/key-derivation.md +9 -2
- package/spec/threat-model.md +8 -2
- package/src/identity/index.ts +3 -2
- package/src/identity/sign.ts +118 -40
- package/src/streams/aes-gcm-v1.ts +37 -30
- package/src/streams/pq-hybrid-v1.ts +29 -21
- package/src/suites/aes-gcm-v1/api.ts +15 -2
- package/src/suites/pq-hybrid-v1/index.ts +14 -8
- package/src/suites/xchacha-v1/api.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,62 @@ All notable changes to `@shieldfive/crypto` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 1.0.0-beta.4 — 2026-07-13
|
|
9
|
+
|
|
10
|
+
### Security
|
|
11
|
+
|
|
12
|
+
- **Sender-attribution signatures now commit to ciphertext content, not just
|
|
13
|
+
AEAD tags.** The optional Ed25519 signature block previously signed
|
|
14
|
+
`header_unauthenticated_bytes || concat(per-chunk AEAD tags)`. Because an
|
|
15
|
+
AEAD tag (GHASH / Poly1305) is forgeable by a holder of the content key, a
|
|
16
|
+
recipient/collaborator could rewrite chunk ciphertext while keeping every
|
|
17
|
+
tag byte-identical, so `decrypt` returned attacker-modified plaintext while
|
|
18
|
+
`metadata.signature.verified` stayed `true` — a sender-attribution bypass
|
|
19
|
+
affecting both the `aes-256-gcm-v1` and `pq-hybrid-xchacha-mlkem1024-v1`
|
|
20
|
+
stream suites. Reported via the bug bounty program (Mudit Raj). The signed
|
|
21
|
+
message is now the SHA-256 digest of a domain-separated, length-framed
|
|
22
|
+
transcript over the header and **every chunk's full ciphertext** (see
|
|
23
|
+
`spec/format-v1.md § "Signature block"`), hashed incrementally so signing
|
|
24
|
+
stays O(1) in memory. `verified: true` now means the signer signed exactly
|
|
25
|
+
the ciphertext presented.
|
|
26
|
+
|
|
27
|
+
**Breaking (signature profile only):** this redefines what algorithm `0x01`
|
|
28
|
+
signs. Signatures produced by earlier versions no longer verify (they are
|
|
29
|
+
reported `verified: false`, fail-closed). Unsigned/legacy files are
|
|
30
|
+
unaffected and decrypt unchanged (`signature: null`); confidentiality,
|
|
31
|
+
`header_mac`, and per-chunk AEAD integrity are unchanged. The signing
|
|
32
|
+
feature was optional and unused by any production deployment, so no
|
|
33
|
+
interoperable signed files exist under the old transcript.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- `src/identity/sign.ts`: removed `signHeaderAndMacs` / `verifyHeaderAndMacs`
|
|
38
|
+
(which signed the tag-only transcript); added `SenderSigTranscript`,
|
|
39
|
+
`signSenderTranscript`, and `verifySenderTranscript`. New direct dependency
|
|
40
|
+
on `@noble/hashes` for the incremental SHA-256 transcript.
|
|
41
|
+
- `src/suites/pq-hybrid-v1/index.ts`: `decapsulateFromHeader` now folds a
|
|
42
|
+
failed classical unwrap into a single generic `decapsulate: unwrap failed`
|
|
43
|
+
error (catching the libsodium secretbox throw) and removes a previously
|
|
44
|
+
unreachable `if (!classicalShare)` guard. No behavior change on the happy
|
|
45
|
+
path. Hardening from a coordinated-disclosure report noting the throw-vs-no-
|
|
46
|
+
throw distinguishability between a wrong `envelopeKey` and a bad ML-KEM
|
|
47
|
+
ciphertext; not a reachable oracle in any shipped path (share recipients
|
|
48
|
+
take the `combinedKey` branch and bypass this function, and `envelopeKey`
|
|
49
|
+
is the owner's own client-side key).
|
|
50
|
+
|
|
51
|
+
### Documentation
|
|
52
|
+
|
|
53
|
+
- `spec/threat-model.md` and `spec/key-derivation.md`: corrected the claim
|
|
54
|
+
that the crypto layer "enforces fresh per-file content keys." The library
|
|
55
|
+
**defaults** to fresh `content_key`/`file_id` per file but cannot enforce
|
|
56
|
+
uniqueness when a caller supplies both overrides; pair-uniqueness across
|
|
57
|
+
distinct plaintexts is a caller obligation, documented as such. Added a
|
|
58
|
+
SECURITY note to the `contentKey`/`fileId` override params in the
|
|
59
|
+
`aes-gcm-v1` and `xchacha-v1` encrypt options. From a coordinated-disclosure
|
|
60
|
+
report on AEAD nonce reuse under caller-supplied key reuse (not reachable on
|
|
61
|
+
the default path or in the shipped application, which always uses fresh
|
|
62
|
+
material per file).
|
|
63
|
+
|
|
8
64
|
## 1.0.0-beta.3 — 2026-07-02
|
|
9
65
|
|
|
10
66
|
> Re-release of `1.0.0-beta.2` through the tag-triggered CI pipeline so the
|
package/SECURITY.md
CHANGED
|
@@ -31,12 +31,27 @@ follow up over an encrypted channel.
|
|
|
31
31
|
|
|
32
32
|
## Our commitments
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
These windows match the public program at
|
|
35
|
+
<https://shieldfive.com/security/bug-bounty>, which is the canonical
|
|
36
|
+
source; if the two ever differ, the public program governs. They reflect
|
|
37
|
+
the realistic capacity of a small team, not aspiration; we will explain
|
|
38
|
+
any slippage in writing.
|
|
39
|
+
|
|
40
|
+
| Step | Commitment |
|
|
41
|
+
| --------------------- | --------------- |
|
|
42
|
+
| Acknowledge receipt | within 72 hours |
|
|
43
|
+
| Initial triage reply | within 7 days |
|
|
44
|
+
| Critical patch target | 14 days |
|
|
45
|
+
| High patch target | 30 days |
|
|
46
|
+
| Medium patch target | 90 days |
|
|
47
|
+
| Low / informational | best effort |
|
|
48
|
+
|
|
49
|
+
Severity is assigned by the impact described in
|
|
50
|
+
[`spec/threat-model.md`](spec/threat-model.md): Critical = plaintext or
|
|
51
|
+
key recovery, or RCE; High = integrity bypass that returns mutated
|
|
52
|
+
plaintext as if authentic; Medium = exploitable implementation error or
|
|
53
|
+
spec-vs-implementation drift with security implications; Low =
|
|
54
|
+
defense-in-depth. We explain our severity assignment in every reply.
|
|
40
55
|
|
|
41
56
|
We will:
|
|
42
57
|
|
|
@@ -122,9 +137,18 @@ holding, please cite the specific paragraph.
|
|
|
122
137
|
|
|
123
138
|
## Acknowledgements
|
|
124
139
|
|
|
125
|
-
|
|
126
|
-
with their consent
|
|
140
|
+
With thanks to the researchers who have reported findings in good faith
|
|
141
|
+
(listed with their consent):
|
|
142
|
+
|
|
143
|
+
- **Mudit Raj** — the optional v1 sender-attribution signature committed
|
|
144
|
+
only to the per-chunk AEAD tags, not the ciphertext, letting a content-key
|
|
145
|
+
holder rewrite chunk ciphertext while `signature.verified` stayed `true`
|
|
146
|
+
(a sender-attribution bypass affecting both stream suites; High). Fixed by
|
|
147
|
+
signing a ciphertext-committing SHA-256 transcript (see CHANGELOG).
|
|
148
|
+
- **0xEr3n** ([x.com/0xEr3n](https://x.com/0xEr3n)) — reader-validation
|
|
149
|
+
consistency hardening in the Suite 0x03 combined-key stream decrypt
|
|
150
|
+
path (Low / defense-in-depth; fixed in 1.0.0-beta.3).
|
|
127
151
|
|
|
128
152
|
---
|
|
129
153
|
|
|
130
|
-
Last updated:
|
|
154
|
+
Last updated: 2026-07-05
|
package/dist/identity/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* want stronger identity (e.g. SAS verification, gossiped signatures),
|
|
18
18
|
* they wrap this module rather than modify it.
|
|
19
19
|
*/
|
|
20
|
-
export { SIGNATURE_ALGO_ED25519, SIGNATURE_ALGO_ML_DSA_65, ED25519_PUBLIC_KEY_LENGTH, ED25519_SECRET_KEY_LENGTH, ED25519_SIGNATURE_LENGTH, SignatureError, buildSignatureBlock, deriveEd25519PublicKey, parseSignatureBlock,
|
|
20
|
+
export { SIGNATURE_ALGO_ED25519, SIGNATURE_ALGO_ML_DSA_65, ED25519_PUBLIC_KEY_LENGTH, ED25519_SECRET_KEY_LENGTH, ED25519_SIGNATURE_LENGTH, SignatureError, buildSignatureBlock, deriveEd25519PublicKey, parseSignatureBlock, SenderSigTranscript, signSenderTranscript, verifySenderTranscript, } from './sign.js';
|
|
21
21
|
export type { SignatureBlock } from './sign.js';
|
|
22
22
|
export interface PublicIdentityBundle {
|
|
23
23
|
/** ML-KEM-1024 public key (1568 bytes) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,E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/D,iBAAiB,EAAE,UAAU,CAAA;IAC7B,yDAAyD;IACzD,cAAc,EAAE,UAAU,CAAA;CAC3B;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAuB1B;AAMD;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,WAAW,EAAE,UAAU,CAAA;IACvB,kCAAkC;IAClC,MAAM,EAAE,UAAU,CAAA;IAClB,0EAA0E;IAC1E,SAAS,EAAE,oBAAoB,CAAA;IAC/B,kDAAkD;IAClD,oBAAoB,EAAE,UAAU,CAAA;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC;IAAE,WAAW,EAAE,UAAU,CAAA;CAAE,CAAC,CAwDtC;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,WAAW,EAAE,UAAU,CAAA;IACvB,MAAM,EAAE,UAAU,CAAA;IAClB,kBAAkB,EAAE,UAAU,CAAA;IAC9B,oBAAoB,EAAE,UAAU,CAAA;CACjC,GAAG,OAAO,CAAC,UAAU,CAAC,CAwEtB"}
|
package/dist/identity/index.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* they wrap this module rather than modify it.
|
|
19
19
|
*/
|
|
20
20
|
import { ML_KEM_1024_PUBLIC_KEY_BYTES, ML_KEM_1024_SECRET_KEY_BYTES, deriveMlKemKeypair, generateMlKemKeypair, encapsulateForRecipient, decapsulateFromHeader, parsePqHybridV1SuitePayload, } from '../suites/pq-hybrid-v1/index.js';
|
|
21
|
-
export { SIGNATURE_ALGO_ED25519, SIGNATURE_ALGO_ML_DSA_65, ED25519_PUBLIC_KEY_LENGTH, ED25519_SECRET_KEY_LENGTH, ED25519_SIGNATURE_LENGTH, SignatureError, buildSignatureBlock, deriveEd25519PublicKey, parseSignatureBlock,
|
|
21
|
+
export { SIGNATURE_ALGO_ED25519, SIGNATURE_ALGO_ML_DSA_65, ED25519_PUBLIC_KEY_LENGTH, ED25519_SECRET_KEY_LENGTH, ED25519_SIGNATURE_LENGTH, SignatureError, buildSignatureBlock, deriveEd25519PublicKey, parseSignatureBlock, SenderSigTranscript, signSenderTranscript, verifySenderTranscript, } from './sign.js';
|
|
22
22
|
import { bytesToBase64, base64ToBytes, concatBytes, uint16BE, uint32BE, readUint16BE, readUint32BE, } from '../internal/encoding.js';
|
|
23
23
|
import { randomBytes } from '../internal/runtime.js';
|
|
24
24
|
import { getSodium } from '../internal/sodium.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,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
|
5
5
|
* key (`header_mac`) and per-chunk AEAD tags, so a recipient can be sure
|
|
6
|
-
* the file decrypts to bytes
|
|
7
|
-
* tell them is WHO
|
|
8
|
-
* written the file.
|
|
6
|
+
* the file decrypts to bytes *some* content-key holder produced. What it
|
|
7
|
+
* does NOT tell them is WHO produced it — anyone with the content key
|
|
8
|
+
* could have written the file.
|
|
9
9
|
*
|
|
10
|
-
* This module adds an optional detached signature
|
|
11
|
-
* `header_unauthenticated_bytes || concat(per-chunk MAC tags)` so that a
|
|
10
|
+
* This module adds an optional detached Ed25519 signature so that a
|
|
12
11
|
* recipient who trusts a sender's public key can verify authorship. The
|
|
13
|
-
*
|
|
12
|
+
* signed message is a domain-separated, length-framed SHA-256 transcript
|
|
13
|
+
* that commits to the header AND every chunk's full ciphertext (body +
|
|
14
|
+
* AEAD tag) — see {@link SenderSigTranscript}.
|
|
15
|
+
*
|
|
16
|
+
* It deliberately does NOT sign the AEAD tags alone. An AEAD tag (GHASH
|
|
17
|
+
* for AES-GCM, Poly1305 for the PQ suite) is a keyed polynomial MAC that
|
|
18
|
+
* a *content-key holder* can forge: knowing the key, they can rewrite
|
|
19
|
+
* chunk ciphertext while holding the 16-byte tag byte-identical. Since
|
|
20
|
+
* the entire point of attribution is to bind content against exactly such
|
|
21
|
+
* a holder (an outsider without the content key cannot decrypt at all),
|
|
22
|
+
* the signature must commit to the ciphertext bytes themselves, not to a
|
|
23
|
+
* value the holder can keep fixed under a chosen-plaintext change. The
|
|
24
|
+
* transcript is hashed incrementally, so signing/verifying stays O(1) in
|
|
25
|
+
* memory for multi-gigabyte streams.
|
|
26
|
+
*
|
|
27
|
+
* The signature lives in an optional trailing structure (see
|
|
14
28
|
* `spec/format-v1.md § "Signature block"`); legacy files without that
|
|
15
29
|
* structure continue to decrypt unchanged, with the receiving side
|
|
16
30
|
* reporting `signature: null`.
|
|
@@ -39,34 +53,72 @@ export declare class SignatureError extends Error {
|
|
|
39
53
|
constructor(code: string);
|
|
40
54
|
}
|
|
41
55
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
56
|
+
* Incremental transcript for the sender-attribution signature.
|
|
57
|
+
*
|
|
58
|
+
* The signed message commits to the file header (exactly the bytes under
|
|
59
|
+
* `header_mac`) and to EVERY chunk's full ciphertext field (body + AEAD
|
|
60
|
+
* tag), each length-framed and preceded by a domain separator:
|
|
61
|
+
*
|
|
62
|
+
* ```
|
|
63
|
+
* digest = SHA-256(
|
|
64
|
+
* SENDER_SIG_DOMAIN
|
|
65
|
+
* || u64be(len(header)) || header
|
|
66
|
+
* || u64be(total_chunks)
|
|
67
|
+
* || for each chunk i in order: u64be(i) || u64be(len(ct_i)) || ct_i
|
|
68
|
+
* )
|
|
69
|
+
* ```
|
|
44
70
|
*
|
|
45
|
-
*
|
|
46
|
-
* (
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* ciphertext
|
|
71
|
+
* The 32-byte digest is what Ed25519 signs. Because the transcript binds
|
|
72
|
+
* the ciphertext bytes (not just the malleable per-chunk AEAD tags), a
|
|
73
|
+
* content-key holder cannot alter plaintext while keeping a signature
|
|
74
|
+
* valid: any change to a ciphertext byte changes the digest, and forging
|
|
75
|
+
* an Ed25519 signature over the new digest requires the signing key.
|
|
76
|
+
* Length-framing the chunk index and each ciphertext also binds chunk
|
|
77
|
+
* order and count, so truncation/reorder/splice change the digest too.
|
|
78
|
+
*
|
|
79
|
+
* Only the running SHA-256 state is retained, never the ciphertext, so
|
|
80
|
+
* signing or verifying a multi-gigabyte file uses O(1) memory.
|
|
81
|
+
*/
|
|
82
|
+
export declare class SenderSigTranscript {
|
|
83
|
+
private readonly hash;
|
|
84
|
+
private headerAbsorbed;
|
|
85
|
+
constructor();
|
|
86
|
+
/**
|
|
87
|
+
* Absorb the header and the total chunk count. MUST be called exactly
|
|
88
|
+
* once, before any chunk. `header` MUST be the exact bytes covered by
|
|
89
|
+
* `header_mac` (`buildHeaderUnauthenticated` output /
|
|
90
|
+
* `parseHeader().unauthenticatedBytes`).
|
|
91
|
+
*/
|
|
92
|
+
absorbHeader(header: Uint8Array, totalChunks: number): void;
|
|
93
|
+
/**
|
|
94
|
+
* Absorb one chunk's FULL ciphertext field (body + tag), in chunk-index
|
|
95
|
+
* order. The index and length are framed alongside the bytes so
|
|
96
|
+
* reordering or splicing a chunk changes the digest.
|
|
97
|
+
*/
|
|
98
|
+
absorbChunk(chunkIndex: number, ciphertext: Uint8Array): void;
|
|
99
|
+
/** Finalize and return the 32-byte transcript digest. Single-use. */
|
|
100
|
+
digest(): Uint8Array;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Produce a detached Ed25519 signature over a {@link SenderSigTranscript}
|
|
104
|
+
* digest (see the class docstring for the transcript definition).
|
|
51
105
|
*
|
|
52
106
|
* Returns the raw 64-byte signature. Callers wrap it in a signature block
|
|
53
107
|
* via `buildSignatureBlock`.
|
|
54
108
|
*/
|
|
55
|
-
export declare function
|
|
109
|
+
export declare function signSenderTranscript(input: {
|
|
56
110
|
ed25519SecretKey: Uint8Array;
|
|
57
|
-
|
|
58
|
-
chunkMacs: ReadonlyArray<Uint8Array>;
|
|
111
|
+
transcriptDigest: Uint8Array;
|
|
59
112
|
}): Uint8Array;
|
|
60
113
|
/**
|
|
61
|
-
* Verify a detached Ed25519 signature produced by `
|
|
114
|
+
* Verify a detached Ed25519 signature produced by `signSenderTranscript`.
|
|
62
115
|
* Returns `true` on success, `false` on any failure (wrong length,
|
|
63
116
|
* malformed point, bad signature). Never throws on a verification
|
|
64
117
|
* mismatch — failures are not exceptional.
|
|
65
118
|
*/
|
|
66
|
-
export declare function
|
|
119
|
+
export declare function verifySenderTranscript(input: {
|
|
67
120
|
ed25519PublicKey: Uint8Array;
|
|
68
|
-
|
|
69
|
-
chunkMacs: ReadonlyArray<Uint8Array>;
|
|
121
|
+
transcriptDigest: Uint8Array;
|
|
70
122
|
signature: Uint8Array;
|
|
71
123
|
}): boolean;
|
|
72
124
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/identity/sign.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/identity/sign.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAYH,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,IAAO,CAAA;AAE1C,kFAAkF;AAClF,eAAO,MAAM,wBAAwB,IAAO,CAAA;AAE5C,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAA;IACjB,+DAA+D;IAC/D,SAAS,EAAE,UAAU,CAAA;IACrB,gDAAgD;IAChD,SAAS,EAAE,UAAU,CAAA;CACtB;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBACT,IAAI,EAAE,MAAM;CAKzB;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IACvC,OAAO,CAAC,cAAc,CAAQ;;IAM9B;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAU3D;;;;OAIG;IACH,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IAS7D,qEAAqE;IACrE,MAAM,IAAI,UAAU;CAMrB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,gBAAgB,EAAE,UAAU,CAAA;IAC5B,gBAAgB,EAAE,UAAU,CAAA;CAC7B,GAAG,UAAU,CAKb;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,gBAAgB,EAAE,UAAU,CAAA;IAC5B,gBAAgB,EAAE,UAAU,CAAA;IAC5B,SAAS,EAAE,UAAU,CAAA;CACtB,GAAG,OAAO,CAaV;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAKZ;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,UAAU,CAgCrE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,EACjB,MAAM,SAAI,GACT;IAAE,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAqC7C"}
|
package/dist/identity/sign.js
CHANGED
|
@@ -3,14 +3,28 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The v1 file format already authenticates with HMAC under the content
|
|
5
5
|
* key (`header_mac`) and per-chunk AEAD tags, so a recipient can be sure
|
|
6
|
-
* the file decrypts to bytes
|
|
7
|
-
* tell them is WHO
|
|
8
|
-
* written the file.
|
|
6
|
+
* the file decrypts to bytes *some* content-key holder produced. What it
|
|
7
|
+
* does NOT tell them is WHO produced it — anyone with the content key
|
|
8
|
+
* could have written the file.
|
|
9
9
|
*
|
|
10
|
-
* This module adds an optional detached signature
|
|
11
|
-
* `header_unauthenticated_bytes || concat(per-chunk MAC tags)` so that a
|
|
10
|
+
* This module adds an optional detached Ed25519 signature so that a
|
|
12
11
|
* recipient who trusts a sender's public key can verify authorship. The
|
|
13
|
-
*
|
|
12
|
+
* signed message is a domain-separated, length-framed SHA-256 transcript
|
|
13
|
+
* that commits to the header AND every chunk's full ciphertext (body +
|
|
14
|
+
* AEAD tag) — see {@link SenderSigTranscript}.
|
|
15
|
+
*
|
|
16
|
+
* It deliberately does NOT sign the AEAD tags alone. An AEAD tag (GHASH
|
|
17
|
+
* for AES-GCM, Poly1305 for the PQ suite) is a keyed polynomial MAC that
|
|
18
|
+
* a *content-key holder* can forge: knowing the key, they can rewrite
|
|
19
|
+
* chunk ciphertext while holding the 16-byte tag byte-identical. Since
|
|
20
|
+
* the entire point of attribution is to bind content against exactly such
|
|
21
|
+
* a holder (an outsider without the content key cannot decrypt at all),
|
|
22
|
+
* the signature must commit to the ciphertext bytes themselves, not to a
|
|
23
|
+
* value the holder can keep fixed under a chosen-plaintext change. The
|
|
24
|
+
* transcript is hashed incrementally, so signing/verifying stays O(1) in
|
|
25
|
+
* memory for multi-gigabyte streams.
|
|
26
|
+
*
|
|
27
|
+
* The signature lives in an optional trailing structure (see
|
|
14
28
|
* `spec/format-v1.md § "Signature block"`); legacy files without that
|
|
15
29
|
* structure continue to decrypt unchanged, with the receiving side
|
|
16
30
|
* reporting `signature: null`.
|
|
@@ -20,7 +34,8 @@
|
|
|
20
34
|
* implement it.
|
|
21
35
|
*/
|
|
22
36
|
import { ed25519 } from '@noble/curves/ed25519.js';
|
|
23
|
-
import {
|
|
37
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
38
|
+
import { concatBytes, readUint16BE, uint16BE, uint64BE, } from '../internal/encoding.js';
|
|
24
39
|
/** Signature algorithm: Ed25519 (RFC 8032). 32-byte key, 64-byte signature. */
|
|
25
40
|
export const SIGNATURE_ALGO_ED25519 = 0x01;
|
|
26
41
|
/** Signature algorithm reserved for ML-DSA-65 (FIPS 204). Not yet implemented. */
|
|
@@ -36,54 +51,109 @@ export class SignatureError extends Error {
|
|
|
36
51
|
this.code = code;
|
|
37
52
|
}
|
|
38
53
|
}
|
|
39
|
-
function buildSignedMessage(header, chunkMacs) {
|
|
40
|
-
let totalMacLen = 0;
|
|
41
|
-
for (const mac of chunkMacs)
|
|
42
|
-
totalMacLen += mac.length;
|
|
43
|
-
const out = new Uint8Array(header.length + totalMacLen);
|
|
44
|
-
out.set(header, 0);
|
|
45
|
-
let offset = header.length;
|
|
46
|
-
for (const mac of chunkMacs) {
|
|
47
|
-
out.set(mac, offset);
|
|
48
|
-
offset += mac.length;
|
|
49
|
-
}
|
|
50
|
-
return out;
|
|
51
|
-
}
|
|
52
54
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
+
* Domain separator for the sender-attribution signature transcript.
|
|
56
|
+
*
|
|
57
|
+
* Frozen wire constant: these exact bytes are hashed into every
|
|
58
|
+
* signature. Changing them changes every signature and invalidates
|
|
59
|
+
* verification of any previously signed file. Do not edit.
|
|
60
|
+
*/
|
|
61
|
+
const SENDER_SIG_DOMAIN = new TextEncoder().encode('shieldfive/crypto/v1/sender-sig');
|
|
62
|
+
/**
|
|
63
|
+
* Incremental transcript for the sender-attribution signature.
|
|
64
|
+
*
|
|
65
|
+
* The signed message commits to the file header (exactly the bytes under
|
|
66
|
+
* `header_mac`) and to EVERY chunk's full ciphertext field (body + AEAD
|
|
67
|
+
* tag), each length-framed and preceded by a domain separator:
|
|
68
|
+
*
|
|
69
|
+
* ```
|
|
70
|
+
* digest = SHA-256(
|
|
71
|
+
* SENDER_SIG_DOMAIN
|
|
72
|
+
* || u64be(len(header)) || header
|
|
73
|
+
* || u64be(total_chunks)
|
|
74
|
+
* || for each chunk i in order: u64be(i) || u64be(len(ct_i)) || ct_i
|
|
75
|
+
* )
|
|
76
|
+
* ```
|
|
55
77
|
*
|
|
56
|
-
*
|
|
57
|
-
* (
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* ciphertext
|
|
78
|
+
* The 32-byte digest is what Ed25519 signs. Because the transcript binds
|
|
79
|
+
* the ciphertext bytes (not just the malleable per-chunk AEAD tags), a
|
|
80
|
+
* content-key holder cannot alter plaintext while keeping a signature
|
|
81
|
+
* valid: any change to a ciphertext byte changes the digest, and forging
|
|
82
|
+
* an Ed25519 signature over the new digest requires the signing key.
|
|
83
|
+
* Length-framing the chunk index and each ciphertext also binds chunk
|
|
84
|
+
* order and count, so truncation/reorder/splice change the digest too.
|
|
85
|
+
*
|
|
86
|
+
* Only the running SHA-256 state is retained, never the ciphertext, so
|
|
87
|
+
* signing or verifying a multi-gigabyte file uses O(1) memory.
|
|
88
|
+
*/
|
|
89
|
+
export class SenderSigTranscript {
|
|
90
|
+
hash = sha256.create();
|
|
91
|
+
headerAbsorbed = false;
|
|
92
|
+
constructor() {
|
|
93
|
+
this.hash.update(SENDER_SIG_DOMAIN);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Absorb the header and the total chunk count. MUST be called exactly
|
|
97
|
+
* once, before any chunk. `header` MUST be the exact bytes covered by
|
|
98
|
+
* `header_mac` (`buildHeaderUnauthenticated` output /
|
|
99
|
+
* `parseHeader().unauthenticatedBytes`).
|
|
100
|
+
*/
|
|
101
|
+
absorbHeader(header, totalChunks) {
|
|
102
|
+
if (this.headerAbsorbed) {
|
|
103
|
+
throw new SignatureError('transcript_header_already_absorbed');
|
|
104
|
+
}
|
|
105
|
+
this.hash.update(uint64BE(header.length));
|
|
106
|
+
this.hash.update(header);
|
|
107
|
+
this.hash.update(uint64BE(totalChunks));
|
|
108
|
+
this.headerAbsorbed = true;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Absorb one chunk's FULL ciphertext field (body + tag), in chunk-index
|
|
112
|
+
* order. The index and length are framed alongside the bytes so
|
|
113
|
+
* reordering or splicing a chunk changes the digest.
|
|
114
|
+
*/
|
|
115
|
+
absorbChunk(chunkIndex, ciphertext) {
|
|
116
|
+
if (!this.headerAbsorbed) {
|
|
117
|
+
throw new SignatureError('transcript_header_not_absorbed');
|
|
118
|
+
}
|
|
119
|
+
this.hash.update(uint64BE(chunkIndex));
|
|
120
|
+
this.hash.update(uint64BE(ciphertext.length));
|
|
121
|
+
this.hash.update(ciphertext);
|
|
122
|
+
}
|
|
123
|
+
/** Finalize and return the 32-byte transcript digest. Single-use. */
|
|
124
|
+
digest() {
|
|
125
|
+
if (!this.headerAbsorbed) {
|
|
126
|
+
throw new SignatureError('transcript_header_not_absorbed');
|
|
127
|
+
}
|
|
128
|
+
return this.hash.digest();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Produce a detached Ed25519 signature over a {@link SenderSigTranscript}
|
|
133
|
+
* digest (see the class docstring for the transcript definition).
|
|
62
134
|
*
|
|
63
135
|
* Returns the raw 64-byte signature. Callers wrap it in a signature block
|
|
64
136
|
* via `buildSignatureBlock`.
|
|
65
137
|
*/
|
|
66
|
-
export function
|
|
138
|
+
export function signSenderTranscript(input) {
|
|
67
139
|
if (input.ed25519SecretKey.length !== ED25519_SECRET_KEY_LENGTH) {
|
|
68
140
|
throw new SignatureError('ed25519_secret_key_wrong_length');
|
|
69
141
|
}
|
|
70
|
-
|
|
71
|
-
return ed25519.sign(message, input.ed25519SecretKey);
|
|
142
|
+
return ed25519.sign(input.transcriptDigest, input.ed25519SecretKey);
|
|
72
143
|
}
|
|
73
144
|
/**
|
|
74
|
-
* Verify a detached Ed25519 signature produced by `
|
|
145
|
+
* Verify a detached Ed25519 signature produced by `signSenderTranscript`.
|
|
75
146
|
* Returns `true` on success, `false` on any failure (wrong length,
|
|
76
147
|
* malformed point, bad signature). Never throws on a verification
|
|
77
148
|
* mismatch — failures are not exceptional.
|
|
78
149
|
*/
|
|
79
|
-
export function
|
|
150
|
+
export function verifySenderTranscript(input) {
|
|
80
151
|
if (input.ed25519PublicKey.length !== ED25519_PUBLIC_KEY_LENGTH)
|
|
81
152
|
return false;
|
|
82
153
|
if (input.signature.length !== ED25519_SIGNATURE_LENGTH)
|
|
83
154
|
return false;
|
|
84
|
-
const message = buildSignedMessage(input.header, input.chunkMacs);
|
|
85
155
|
try {
|
|
86
|
-
return ed25519.verify(input.signature,
|
|
156
|
+
return ed25519.verify(input.signature, input.transcriptDigest, input.ed25519PublicKey);
|
|
87
157
|
}
|
|
88
158
|
catch {
|
|
89
159
|
// Malformed pubkey or sig encoding — noble throws; we treat as not-verified.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/identity/sign.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/identity/sign.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,QAAQ,GACT,MAAM,yBAAyB,CAAA;AAEhC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAA;AAE1C,kFAAkF;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAA;AAE5C,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAA;AAC3C,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAA;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAW1C,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,IAAI,CAAQ;IACrB,YAAY,IAAY;QACtB,KAAK,CAAC,uCAAuC,IAAI,EAAE,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAChD,iCAAiC,CAClC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,mBAAmB;IACb,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;IAC/B,cAAc,GAAG,KAAK,CAAA;IAE9B;QACE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,C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 +31,10 @@ export interface AesGcmV1EncryptStreamOptions {
|
|
|
31
31
|
suitePayloadOverride?: Uint8Array;
|
|
32
32
|
/**
|
|
33
33
|
* Optional 32-byte Ed25519 secret seed. When provided, the stream
|
|
34
|
-
* appends a signature block
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* appends a signature block after the final chunk, signing a transcript
|
|
35
|
+
* that commits to the header and every chunk's full ciphertext (see
|
|
36
|
+
* {@link SenderSigTranscript}). When omitted, no block is emitted and
|
|
37
|
+
* the file decrypts as unsigned (legacy behavior).
|
|
37
38
|
*/
|
|
38
39
|
ed25519SecretKey?: Uint8Array;
|
|
39
40
|
}
|
|
@@ -132,13 +133,16 @@ export declare function decryptStreamAesGcmV1(source: ReadableStream<Uint8Array>
|
|
|
132
133
|
* residual buffer, optionally verifying it against the caller's
|
|
133
134
|
* trusted public key.
|
|
134
135
|
*
|
|
136
|
+
* `transcriptDigest` is the {@link SenderSigTranscript} digest rebuilt
|
|
137
|
+
* over the header and every chunk's full ciphertext as it was decrypted,
|
|
138
|
+
* so `verified: true` means the signer signed exactly these bytes.
|
|
139
|
+
*
|
|
135
140
|
* Shared between the AES-GCM and PQ-hybrid stream decoders so the
|
|
136
141
|
* signature semantics live in one place.
|
|
137
142
|
*/
|
|
138
143
|
export declare function finalizeSignatureMetadata(input: {
|
|
139
144
|
trailingBytes: Uint8Array;
|
|
140
|
-
|
|
141
|
-
chunkMacs: ReadonlyArray<Uint8Array>;
|
|
145
|
+
transcriptDigest: Uint8Array;
|
|
142
146
|
expectedSignerPublicKey: Uint8Array | undefined;
|
|
143
147
|
}): VerifiedSignature | null;
|
|
144
148
|
//# sourceMappingURL=aes-gcm-v1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aes-gcm-v1.d.ts","sourceRoot":"","sources":["../../src/streams/aes-gcm-v1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file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