Read capsule format 2 of spec v0.9
Syncs testdata with datekeys-go at spec-v0.9 (7e2d83c) and moves the
reader to the DateKeys Protocol Specification v0.9. Both capsule formats
are read; a format 1 capsule keeps the verdict v0.8.2 gave it.
- framing: the VERSION of the prelude is the capsule format, 1 or 2
(Prelude.format, FORMAT_1, FORMAT_2, isFormat).
- control: decodeControl and encodeControl take the format; schema
version 2 adds payload_length (8 bytes, at most L_MAX) and padding
(1 or 2).
- padding.ts: the rules bloque256 and reforzado of spec §29.1, exact up
to L_MAX with BigInt bit lengths and ceil roundings, and the length of
PAYLOAD_AGE.
- open: exactly 16 stanzas in INNER_ACCESS_AGE of format 2 (step 12), P
at step 16, and at step 17 a plaintext of exactly P bytes whose
padding is zero; only the first L bytes are delivered, never the
padding. Step 17 is recorded when it passes, and step 18 gives the
bytes of content, as the reference does. Opened reports the format, L
and, in format 2, the rule and P.
- inspect: the JSON view carries format, as datekeys inspect -json.
- The page shows the format, warns about format 1, and gives the
padding rule and P once a format 2 capsule opens.
Tests: the twelve fixtures, the 125 mutation cases through open from
memory and from a Blob, the 4380 differential cases, padding.json, the
format 2 CBOR vectors, and padding.test.ts against a BigInt statement of
§29.1. The error texts of the 125 corpus cases were compared with
capsule.Open at spec-v0.9. ibe-vectors.json gains the seven format 2
fixtures from scripts/ibe-go-vectors.go; its frozen values are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 week ago
{
Format 3, step 3: read capsule format 3 of spec v0.10
Syncs testdata with datekeys-go at the tag spec-v0.10 (cc35d2c) and
moves the reader to the DateKeys Protocol Specification v0.10. The
three capsule formats are read.
- framing: FORMAT_3, and isPadded for formats 2 and 3. control: schema
version 3, with the keys 6 and 7 of version 2. SPEC_VERSION is 0.10.
- open: OpenOptions.sink receives the files of a format 3 capsule
(sink.ts: Sink with begin, create, commit and abort, as capsule.Sink,
and MemorySink). Without one, open rejects with a TypeError right
after step 2, before any request, as ErrSinkRequired. Opened gains
head, verdicts, areaLen and unusableHeadExtensions.
- open3.ts: step 17 of format 3 in its substeps 17.2 to 17.8, as
openBody of the reference: a failure of age or a plaintext whose
length is not P prevails, the first failing substep decides, and the
codes other than ERR_INTEGRITY are reported only after reading
PAYLOAD_AGE to its end. Reads grow with the bytes received, never
with the lengths BODY declares. A failure of the sink is ERR_INTEGRITY
with its text, and the sink is aborted once after begin.
- The page: opener.ts opens the fixtures of format 3 into a
MemorySink; the open panel says that it does not deliver their files
yet, and the glosses of the steps name format 3. check-build.mjs
refuses to ship the heads, salts, comments and paths of the format 3
fixtures.
Tests: the 21 fixtures, format 3 laid out byte by byte from its record
and opened into a sink with its files and verdicts; the 209 cases of
the corpus from memory and from a Blob, with the code, the step and,
new, the exact text of capsule.Open, frozen by
scripts/mutation-go-texts.go in testing/mutation-texts.json, which
replays the corpus as internal/testkit does (its extension validator
texts included); the 5110 differential cases over 14 bases; paths,
path_fold, head_schema and security vectors; the control of schema
version 3 in cbor.json; and step 17 on crafted plaintexts sealed again
to I_PAYLOAD, whose texts capsule.Open gives on the same plaintexts.
ibe-vectors.json gains the nine format 3 fixtures from
scripts/ibe-go-vectors.go; the twelve before are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 week ago
"spec" : "0.10" ,
Read capsule format 2 of spec v0.9
Syncs testdata with datekeys-go at spec-v0.9 (7e2d83c) and moves the
reader to the DateKeys Protocol Specification v0.9. Both capsule formats
are read; a format 1 capsule keeps the verdict v0.8.2 gave it.
- framing: the VERSION of the prelude is the capsule format, 1 or 2
(Prelude.format, FORMAT_1, FORMAT_2, isFormat).
- control: decodeControl and encodeControl take the format; schema
version 2 adds payload_length (8 bytes, at most L_MAX) and padding
(1 or 2).
- padding.ts: the rules bloque256 and reforzado of spec §29.1, exact up
to L_MAX with BigInt bit lengths and ceil roundings, and the length of
PAYLOAD_AGE.
- open: exactly 16 stanzas in INNER_ACCESS_AGE of format 2 (step 12), P
at step 16, and at step 17 a plaintext of exactly P bytes whose
padding is zero; only the first L bytes are delivered, never the
padding. Step 17 is recorded when it passes, and step 18 gives the
bytes of content, as the reference does. Opened reports the format, L
and, in format 2, the rule and P.
- inspect: the JSON view carries format, as datekeys inspect -json.
- The page shows the format, warns about format 1, and gives the
padding rule and P once a format 2 capsule opens.
Tests: the twelve fixtures, the 125 mutation cases through open from
memory and from a Blob, the 4380 differential cases, padding.json, the
format 2 CBOR vectors, and padding.test.ts against a BigInt statement of
§29.1. The error texts of the 125 corpus cases were compared with
capsule.Open at spec-v0.9. ibe-vectors.json gains the seven format 2
fixtures from scripts/ibe-go-vectors.go; its frozen values are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 week ago
"description" : "Padding rules of the payload of a format 2 capsule (spec §29.1): for each content length L, P with code 1 (bloque256) and code 2 (reforzado), and the length of PAYLOAD_AGE for each. e, s and last_bits are informative. Generated by the reference implementation. See testdata/README.md." ,
"l_max" : 8936830510563328 ,
"vectors" : [
{
"l" : 0 ,
"bloque256" : 256 ,
"reforzado" : 256 ,
"payload_age_bloque256" : 456 ,
"payload_age_reforzado" : 456
} ,
{
"l" : 1 ,
"bloque256" : 256 ,
"reforzado" : 256 ,
"payload_age_bloque256" : 456 ,
"payload_age_reforzado" : 456
} ,
{
"l" : 40 ,
"bloque256" : 256 ,
"reforzado" : 256 ,
"payload_age_bloque256" : 456 ,
"payload_age_reforzado" : 456
} ,
{
"l" : 255 ,
"bloque256" : 256 ,
"reforzado" : 256 ,
"payload_age_bloque256" : 456 ,
"payload_age_reforzado" : 456
} ,
{
"l" : 256 ,
"bloque256" : 256 ,
"reforzado" : 256 ,
"payload_age_bloque256" : 456 ,
"payload_age_reforzado" : 456
} ,
{
"l" : 257 ,
"bloque256" : 512 ,
"reforzado" : 512 ,
"payload_age_bloque256" : 712 ,
"payload_age_reforzado" : 712 ,
"e" : 8 ,
"s" : 4 ,
"last_bits" : 4
} ,
{
"l" : 1000 ,
"bloque256" : 1024 ,
"reforzado" : 1024 ,
"payload_age_bloque256" : 1224 ,
"payload_age_reforzado" : 1224 ,
"e" : 9 ,
"s" : 4 ,
"last_bits" : 5
} ,
{
"l" : 4096 ,
"bloque256" : 4096 ,
"reforzado" : 4096 ,
"payload_age_bloque256" : 4296 ,
"payload_age_reforzado" : 4296 ,
"e" : 12 ,
"s" : 4 ,
"last_bits" : 8
} ,
{
"l" : 8192 ,
"bloque256" : 8192 ,
"reforzado" : 8192 ,
"payload_age_bloque256" : 8392 ,
"payload_age_reforzado" : 8392 ,
"e" : 13 ,
"s" : 4 ,
"last_bits" : 9
} ,
{
"l" : 8193 ,
"bloque256" : 8448 ,
"reforzado" : 8704 ,
"payload_age_bloque256" : 8648 ,
"payload_age_reforzado" : 8904 ,
"e" : 13 ,
"s" : 4 ,
"last_bits" : 9
} ,
{
"l" : 10000 ,
"bloque256" : 10240 ,
"reforzado" : 10240 ,
"payload_age_bloque256" : 10440 ,
"payload_age_reforzado" : 10440 ,
"e" : 13 ,
"s" : 4 ,
"last_bits" : 9
} ,
{
"l" : 65536 ,
"bloque256" : 65536 ,
"reforzado" : 65536 ,
"payload_age_bloque256" : 65736 ,
"payload_age_reforzado" : 65736 ,
"e" : 16 ,
"s" : 5 ,
"last_bits" : 11
} ,
{
"l" : 65537 ,
"bloque256" : 65792 ,
"reforzado" : 67584 ,
"payload_age_bloque256" : 66008 ,
"payload_age_reforzado" : 67800 ,
"e" : 16 ,
"s" : 5 ,
"last_bits" : 11
} ,
{
"l" : 78000 ,
"bloque256" : 78080 ,
"reforzado" : 79872 ,
"payload_age_bloque256" : 78296 ,
"payload_age_reforzado" : 80088 ,
"e" : 16 ,
"s" : 5 ,
"last_bits" : 11
} ,
{
"l" : 1000000 ,
"bloque256" : 1000192 ,
"reforzado" : 1015808 ,
"payload_age_bloque256" : 1000632 ,
"payload_age_reforzado" : 1016248 ,
"e" : 19 ,
"s" : 5 ,
"last_bits" : 14
} ,
{
"l" : 3000000 ,
"bloque256" : 3000064 ,
"reforzado" : 3014656 ,
"payload_age_bloque256" : 3000984 ,
"payload_age_reforzado" : 3015576 ,
"e" : 21 ,
"s" : 5 ,
"last_bits" : 16
} ,
{
"l" : 600000000 ,
"bloque256" : 600000000 ,
"reforzado" : 603979776 ,
"payload_age_bloque256" : 600146680 ,
"payload_age_reforzado" : 604127416 ,
"e" : 29 ,
"s" : 5 ,
"last_bits" : 24
} ,
{
"l" : 1000000000 ,
"bloque256" : 1000000000 ,
"reforzado" : 1006632960 ,
"payload_age_bloque256" : 1000244328 ,
"payload_age_reforzado" : 1006878904 ,
"e" : 29 ,
"s" : 5 ,
"last_bits" : 24
} ,
{
"l" : 2113929216 ,
"bloque256" : 2113929216 ,
"reforzado" : 2113929216 ,
"payload_age_bloque256" : 2114445496 ,
"payload_age_reforzado" : 2114445496 ,
"e" : 30 ,
"s" : 5 ,
"last_bits" : 25
} ,
{
"l" : 2113929217 ,
"bloque256" : 2113929472 ,
"reforzado" : 2147483648 ,
"payload_age_bloque256" : 2114445768 ,
"payload_age_reforzado" : 2148008120 ,
"e" : 30 ,
"s" : 5 ,
"last_bits" : 25
} ,
{
"l" : 4227858432 ,
"bloque256" : 4227858432 ,
"reforzado" : 4227858432 ,
"payload_age_bloque256" : 4228890808 ,
"payload_age_reforzado" : 4228890808 ,
"e" : 31 ,
"s" : 5 ,
"last_bits" : 26
} ,
{
"l" : 4227858433 ,
"bloque256" : 4227858688 ,
"reforzado" : 4294967296 ,
"payload_age_bloque256" : 4228891080 ,
"payload_age_reforzado" : 4296016056 ,
"e" : 31 ,
"s" : 5 ,
"last_bits" : 26
} ,
{
"l" : 4294967295 ,
"bloque256" : 4294967296 ,
"reforzado" : 4294967296 ,
"payload_age_bloque256" : 4296016056 ,
"payload_age_reforzado" : 4296016056 ,
"e" : 31 ,
"s" : 5 ,
"last_bits" : 26
} ,
{
"l" : 4294967297 ,
"bloque256" : 4294967552 ,
"reforzado" : 4362076160 ,
"payload_age_bloque256" : 4296016328 ,
"payload_age_reforzado" : 4363141304 ,
"e" : 32 ,
"s" : 6 ,
"last_bits" : 26
} ,
{
"l" : 5000000000 ,
"bloque256" : 5000000000 ,
"reforzado" : 5033164800 ,
"payload_age_bloque256" : 5001220888 ,
"payload_age_reforzado" : 5034393784 ,
"e" : 32 ,
"s" : 6 ,
"last_bits" : 26
} ,
{
"l" : 1000000000000 ,
"bloque256" : 1000000000000 ,
"reforzado" : 1005022347264 ,
"payload_age_bloque256" : 1000244140824 ,
"payload_age_reforzado" : 1005267714232 ,
"e" : 39 ,
"s" : 6 ,
"last_bits" : 33
} ,
{
"l" : 562949953421311 ,
"bloque256" : 562949953421312 ,
"reforzado" : 562949953421312 ,
"payload_age_bloque256" : 563087392374968 ,
"payload_age_reforzado" : 563087392374968 ,
"e" : 48 ,
"s" : 6 ,
"last_bits" : 42
} ,
{
"l" : 4503599627370497 ,
"bloque256" : 4503599627370752 ,
"reforzado" : 4573968371548160 ,
"payload_age_bloque256" : 4504699138998728 ,
"payload_age_reforzado" : 4575085063045304 ,
"e" : 52 ,
"s" : 6 ,
"last_bits" : 46
} ,
{
"l" : 8936830510563328 ,
"bloque256" : 8936830510563328 ,
"reforzado" : 8936830510563328 ,
"payload_age_bloque256" : 8939012353949880 ,
"payload_age_reforzado" : 8939012353949880 ,
"e" : 52 ,
"s" : 6 ,
"last_bits" : 46
}
] ,
"rejected" : [
8936830510563329 ,
9007199254740992
]
}