You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dateKeys-dart/test/security_vm_test.dart

232 lines
8.2 KiB

Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
// The security area against Go, on the VM: every case of
// test/vectors/security_vectors.json, which tool/security_go_vectors.go
// writes with package capsule of the reference, of which
// security_vectors.g.dart holds a part; testdata/vectors/security.json; and
// the security area of every fixture of format 3, with the commitments, the
// message, the signature and the seal that its record gives.
@TestOn('vm')
library;
import 'dart:convert';
import 'dart:io';
import 'package:datekeys/datekeys.dart';
import 'package:datekeys/src/bech32.dart' show bech32Encode;
import 'package:datekeys/src/curve25519.dart' show verifyStrict;
import 'package:test/test.dart';
import 'open_vectors_support.dart';
import 'security_support.dart';
import 'vectors/security_vectors.g.dart';
Json readJson(String path) => jsonDecode(File(path).readAsStringSync()) as Json;
void main() {
final vectors = readJson('test/vectors/security_vectors.json');
final evaluations = (vectors['evaluate']! as List).cast<Json>();
test('security_vectors.json is of this spec, with every kind of case', () {
expect(vectors['spec'], specVersion);
expect(vectors['generator'], 'tool/security_go_vectors.go');
expect(evaluations, hasLength(greaterThan(1500)));
final verdicts = {
for (final c in evaluations) '${c['signature']} ${c['seal']}',
};
for (final v in ['X X', 'F0 S0', 'F1 S1', 'F2 S0', 'F3 S0', 'F4 S0']) {
expect(verdicts, contains(v));
}
for (final v in ['F0 S2', 'F2 S2', 'F3 S2', 'F4 S1']) {
expect(verdicts, contains(v));
}
final cms = [
for (final c in evaluations) ...((c['cms'] as List?) ?? const []),
];
expect(cms.where((p) => p == 'signature'), hasLength(greaterThan(20)));
expect(cms.where((p) => p == 'seal'), hasLength(greaterThan(20)));
expect(
evaluations.where((c) => c['context'] == null),
hasLength(greaterThan(100)),
);
});
test('security_vectors.g.dart holds a part of the file', () {
final part = jsonDecode(securityVectorsJson) as Json;
for (final k in [
'spec',
'generator',
'contexts',
'texts',
'bases',
'commitments',
'encode',
'lines',
'holder',
]) {
expect(canonical(part[k]), canonical(vectors[k]), reason: k);
}
final all = [for (final c in evaluations) canonical(c)];
final some = (part['evaluate']! as List).cast<Json>();
expect(some, isNotEmpty);
var at = 0;
for (final c in some) {
final k = canonical(c);
while (at < all.length && all[at] != k) {
at++;
}
expect(at, lessThan(all.length), reason: k);
}
});
test('every evaluation, with the verdicts and lines of Go', () {
final contexts = contextsOf(vectors);
final texts = (vectors['texts']! as List).cast<String>();
final bases = [
for (final b in (vectors['bases']! as List).cast<String>()) fromHex(b),
];
for (final c in evaluations) {
final security = securityOf(c, bases);
expect(
evaluateDifferences(c, security, contexts, texts),
isEmpty,
reason: canonical(c),
);
}
});
test('security.json: the verdicts and the lines of each area in its '
Stage 5c: the verdicts of alg 2 and seal_type 2, and the opening gives them securitycms.dart ports evaluateCMS, signerLine and evaluateSeal of signature2.go of Go at the draft v0.12, on the reader of CMS of stage 5a, with the same order of checks: SIGNERS with its profile and at most 16 entries, then the SignedData; each required signer in the order of SIGNERS and each foreign one in the order of the encoding, valid, invalid, absent, not verifiable, without seal, with an invalid seal or out of validity at the time of its seal; F2, F5 and F6 with their detail; and the seal over SEAL_SUBJECT, S1 to S5 with the authority and t. A round time at Go's zero time is no round time, as IsZero, and Verdicts.sealedAt skips a seal at that time, as SealedAt. cmsReader is the default CmsEvaluator of evaluateSecurity, and so of evaluateSecurityInput and the opening: nothing that Go evaluates is left not evaluated; a caller that passes cms: null still gets the parts without CMS alone. encodeSigners and maxSigners are exported, as EncodeSigners and MaxSigners of Go. The tests compare every part with Go: the 135 cases of security_cms.json with the result of each signer, the 24 of security.json, the 56 signatures of alg 2 and 105 seals of seal_type 2 of security_vectors.json, the 755 cases of securitycms_vectors.json with their detail and earliest seal, the fixtures format3_signed_cms and format3_sealed, and their openings in open_cases.json. On Node.js, a part of the vectors and the two fixtures opened in full. 1572 tests on the VM and 332 on Node.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
'context', () {
Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
final f = readJson('testdata/vectors/security.json');
expect(f['spec'], specVersion);
final ctx = f['context']! as Json;
final context = SecurityContext(
controlCommit: fromHex(str(ctx, 'control_commit')),
headDigest: fromHex(str(ctx, 'head_digest')),
roundTime: parseRfc3339(str(ctx, 'round_time')),
);
final cases = (f['vectors']! as List).cast<Json>();
expect(cases, hasLength(24));
var cms = 0;
for (final c in cases) {
final security = fromHex(str(c, 'hex'));
final parts = cmsParts(security);
if (parts.signature || parts.seal) cms++;
final v = evaluateSecurity(security, context: context);
// The key of F4 is in its line.
expect(
Stage 5c: the verdicts of alg 2 and seal_type 2, and the opening gives them securitycms.dart ports evaluateCMS, signerLine and evaluateSeal of signature2.go of Go at the draft v0.12, on the reader of CMS of stage 5a, with the same order of checks: SIGNERS with its profile and at most 16 entries, then the SignedData; each required signer in the order of SIGNERS and each foreign one in the order of the encoding, valid, invalid, absent, not verifiable, without seal, with an invalid seal or out of validity at the time of its seal; F2, F5 and F6 with their detail; and the seal over SEAL_SUBJECT, S1 to S5 with the authority and t. A round time at Go's zero time is no round time, as IsZero, and Verdicts.sealedAt skips a seal at that time, as SealedAt. cmsReader is the default CmsEvaluator of evaluateSecurity, and so of evaluateSecurityInput and the opening: nothing that Go evaluates is left not evaluated; a caller that passes cms: null still gets the parts without CMS alone. encodeSigners and maxSigners are exported, as EncodeSigners and MaxSigners of Go. The tests compare every part with Go: the 135 cases of security_cms.json with the result of each signer, the 24 of security.json, the 56 signatures of alg 2 and 105 seals of seal_type 2 of security_vectors.json, the 755 cases of securitycms_vectors.json with their detail and earliest seal, the fixtures format3_signed_cms and format3_sealed, and their openings in open_cases.json. On Node.js, a part of the vectors and the two fixtures opened in full. 1572 tests on the VM and 332 on Node.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
verdictDifferences(c, v, keys: false),
Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
isEmpty,
reason: str(c, 'name'),
);
Stage 5c: the verdicts of alg 2 and seal_type 2, and the opening gives them securitycms.dart ports evaluateCMS, signerLine and evaluateSeal of signature2.go of Go at the draft v0.12, on the reader of CMS of stage 5a, with the same order of checks: SIGNERS with its profile and at most 16 entries, then the SignedData; each required signer in the order of SIGNERS and each foreign one in the order of the encoding, valid, invalid, absent, not verifiable, without seal, with an invalid seal or out of validity at the time of its seal; F2, F5 and F6 with their detail; and the seal over SEAL_SUBJECT, S1 to S5 with the authority and t. A round time at Go's zero time is no round time, as IsZero, and Verdicts.sealedAt skips a seal at that time, as SealedAt. cmsReader is the default CmsEvaluator of evaluateSecurity, and so of evaluateSecurityInput and the opening: nothing that Go evaluates is left not evaluated; a caller that passes cms: null still gets the parts without CMS alone. encodeSigners and maxSigners are exported, as EncodeSigners and MaxSigners of Go. The tests compare every part with Go: the 135 cases of security_cms.json with the result of each signer, the 24 of security.json, the 56 signatures of alg 2 and 105 seals of seal_type 2 of security_vectors.json, the 755 cases of securitycms_vectors.json with their detail and earliest seal, the fixtures format3_signed_cms and format3_sealed, and their openings in open_cases.json. On Node.js, a part of the vectors and the two fixtures opened in full. 1572 tests on the VM and 332 on Node.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
expect(v.evaluated, isTrue, reason: str(c, 'name'));
Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
}
// A seal of seal_type 2 whose token is not DER: S2, from the reader of
// CMS.
expect(cms, 1);
});
group('the security area of each fixture of format 3', () {
final names =
Directory('testdata/fixtures')
.listSync()
.map((f) => f.uri.pathSegments.last)
.where((n) => n.startsWith('format3_') && n.endsWith('.json'))
.where((n) => !n.endsWith('.inspect.json') && !n.contains('.dkk'))
.toList()
..sort();
test('there are 14, 3 signed and 1 sealed', () {
expect(names, hasLength(14));
final records = [for (final n in names) readJson('testdata/fixtures/$n')];
expect(records.where((r) => r['signature'] != null), hasLength(3));
expect(records.where((r) => r['seal'] != null), hasLength(1));
});
for (final n in names) {
test(n, () {
final r = readJson('testdata/fixtures/$n');
final control = decodeControl(
fromHex(str(r, 'control_cbor')),
CapsuleFormat.format3,
);
final head = fromHex(str(r, 'head_cbor'));
final security = fromHex(str(r, 'security_cbor'));
final cc = controlCommit(control, CapsuleFormat.format3);
final hd = headDigest(head);
final w = decodeSecurity(security);
final sig = r['signature'] as Json?;
if (sig != null) {
expect(toHex(cc), sig['control_commit']);
expect(toHex(hd), sig['head_digest']);
expect(toHex(w!.signature!), sig['security_key_2']);
final a = decodeAuthorSignature(w.signature!)!;
expect([a.alg, toHex(a.value)], [sig['alg'], sig['signature']]);
final sd = a.alg == algEd25519
? signersDigest(algEd25519)
: signersDigest(algCms, a.key);
expect(toHex(sd), sig['signers_digest']);
final m = authorMessage(cc, hd, sd);
expect(String.fromCharCodes(m), sig['author_message']);
expect(authorCode(m), sig['author_code']);
if (a.alg == algEd25519) {
expect(bech32Encode('dkauthor', a.key), sig['author_key']);
expect(verifyStrict(a.key, m, a.value), isTrue);
} else {
expect(toHex(a.key), sig['signers']);
}
}
final seal = r['seal'] as Json?;
if (seal != null) {
final s = decodeSeal(w!.seal!)!;
expect(
[s.sealType, toHex(s.token)],
[seal['seal_type'], seal['token']],
);
expect(
toHex(sealSubject(cc, hd, sigPart(w.signature))),
seal['seal_subject'],
);
}
Stage 5c: the verdicts of alg 2 and seal_type 2, and the opening gives them securitycms.dart ports evaluateCMS, signerLine and evaluateSeal of signature2.go of Go at the draft v0.12, on the reader of CMS of stage 5a, with the same order of checks: SIGNERS with its profile and at most 16 entries, then the SignedData; each required signer in the order of SIGNERS and each foreign one in the order of the encoding, valid, invalid, absent, not verifiable, without seal, with an invalid seal or out of validity at the time of its seal; F2, F5 and F6 with their detail; and the seal over SEAL_SUBJECT, S1 to S5 with the authority and t. A round time at Go's zero time is no round time, as IsZero, and Verdicts.sealedAt skips a seal at that time, as SealedAt. cmsReader is the default CmsEvaluator of evaluateSecurity, and so of evaluateSecurityInput and the opening: nothing that Go evaluates is left not evaluated; a caller that passes cms: null still gets the parts without CMS alone. encodeSigners and maxSigners are exported, as EncodeSigners and MaxSigners of Go. The tests compare every part with Go: the 135 cases of security_cms.json with the result of each signer, the 24 of security.json, the 56 signatures of alg 2 and 105 seals of seal_type 2 of security_vectors.json, the 755 cases of securitycms_vectors.json with their detail and earliest seal, the fixtures format3_signed_cms and format3_sealed, and their openings in open_cases.json. On Node.js, a part of the vectors and the two fixtures opened in full. 1572 tests on the VM and 332 on Node.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
// The verdicts of the record, in the context of the capsule, with
// the results of the signers of alg 2 and the authority and t of a
// seal of seal_type 2, which are also the earliest seal.
Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
final context = SecurityContext(
controlCommit: cc,
headDigest: hd,
roundTime: parseRfc3339(str(r, 'unlock_at')),
);
Stage 5c: the verdicts of alg 2 and seal_type 2, and the opening gives them securitycms.dart ports evaluateCMS, signerLine and evaluateSeal of signature2.go of Go at the draft v0.12, on the reader of CMS of stage 5a, with the same order of checks: SIGNERS with its profile and at most 16 entries, then the SignedData; each required signer in the order of SIGNERS and each foreign one in the order of the encoding, valid, invalid, absent, not verifiable, without seal, with an invalid seal or out of validity at the time of its seal; F2, F5 and F6 with their detail; and the seal over SEAL_SUBJECT, S1 to S5 with the authority and t. A round time at Go's zero time is no round time, as IsZero, and Verdicts.sealedAt skips a seal at that time, as SealedAt. cmsReader is the default CmsEvaluator of evaluateSecurity, and so of evaluateSecurityInput and the opening: nothing that Go evaluates is left not evaluated; a caller that passes cms: null still gets the parts without CMS alone. encodeSigners and maxSigners are exported, as EncodeSigners and MaxSigners of Go. The tests compare every part with Go: the 135 cases of security_cms.json with the result of each signer, the 24 of security.json, the 56 signatures of alg 2 and 105 seals of seal_type 2 of security_vectors.json, the 755 cases of securitycms_vectors.json with their detail and earliest seal, the fixtures format3_signed_cms and format3_sealed, and their openings in open_cases.json. On Node.js, a part of the vectors and the two fixtures opened in full. 1572 tests on the VM and 332 on Node.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
final v = evaluateSecurity(security, context: context);
final want = r['verdicts']! as Json;
expect(verdictDifferences(want, v, keys: false), isEmpty);
final key = v.authorKey;
Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
expect(
Stage 5c: the verdicts of alg 2 and seal_type 2, and the opening gives them securitycms.dart ports evaluateCMS, signerLine and evaluateSeal of signature2.go of Go at the draft v0.12, on the reader of CMS of stage 5a, with the same order of checks: SIGNERS with its profile and at most 16 entries, then the SignedData; each required signer in the order of SIGNERS and each foreign one in the order of the encoding, valid, invalid, absent, not verifiable, without seal, with an invalid seal or out of validity at the time of its seal; F2, F5 and F6 with their detail; and the seal over SEAL_SUBJECT, S1 to S5 with the authority and t. A round time at Go's zero time is no round time, as IsZero, and Verdicts.sealedAt skips a seal at that time, as SealedAt. cmsReader is the default CmsEvaluator of evaluateSecurity, and so of evaluateSecurityInput and the opening: nothing that Go evaluates is left not evaluated; a caller that passes cms: null still gets the parts without CMS alone. encodeSigners and maxSigners are exported, as EncodeSigners and MaxSigners of Go. The tests compare every part with Go: the 135 cases of security_cms.json with the result of each signer, the 24 of security.json, the 56 signatures of alg 2 and 105 seals of seal_type 2 of security_vectors.json, the 755 cases of securitycms_vectors.json with their detail and earliest seal, the fixtures format3_signed_cms and format3_sealed, and their openings in open_cases.json. On Node.js, a part of the vectors and the two fixtures opened in full. 1572 tests on the VM and 332 on Node.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
key == null ? null : bech32Encode('dkauthor', key),
want['author_key'],
);
final d = v.detail;
final results = sig?['signer_results'] as List?;
expect(
canonical(
d == null || d.signers.isEmpty ? null : signerResults(d.signers),
Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
),
Stage 5c: the verdicts of alg 2 and seal_type 2, and the opening gives them securitycms.dart ports evaluateCMS, signerLine and evaluateSeal of signature2.go of Go at the draft v0.12, on the reader of CMS of stage 5a, with the same order of checks: SIGNERS with its profile and at most 16 entries, then the SignedData; each required signer in the order of SIGNERS and each foreign one in the order of the encoding, valid, invalid, absent, not verifiable, without seal, with an invalid seal or out of validity at the time of its seal; F2, F5 and F6 with their detail; and the seal over SEAL_SUBJECT, S1 to S5 with the authority and t. A round time at Go's zero time is no round time, as IsZero, and Verdicts.sealedAt skips a seal at that time, as SealedAt. cmsReader is the default CmsEvaluator of evaluateSecurity, and so of evaluateSecurityInput and the opening: nothing that Go evaluates is left not evaluated; a caller that passes cms: null still gets the parts without CMS alone. encodeSigners and maxSigners are exported, as EncodeSigners and MaxSigners of Go. The tests compare every part with Go: the 135 cases of security_cms.json with the result of each signer, the 24 of security.json, the 56 signatures of alg 2 and 105 seals of seal_type 2 of security_vectors.json, the 755 cases of securitycms_vectors.json with their detail and earliest seal, the fixtures format3_signed_cms and format3_sealed, and their openings in open_cases.json. On Node.js, a part of the vectors and the two fixtures opened in full. 1572 tests on the VM and 332 on Node.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
canonical(results),
Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
);
Stage 5c: the verdicts of alg 2 and seal_type 2, and the opening gives them securitycms.dart ports evaluateCMS, signerLine and evaluateSeal of signature2.go of Go at the draft v0.12, on the reader of CMS of stage 5a, with the same order of checks: SIGNERS with its profile and at most 16 entries, then the SignedData; each required signer in the order of SIGNERS and each foreign one in the order of the encoding, valid, invalid, absent, not verifiable, without seal, with an invalid seal or out of validity at the time of its seal; F2, F5 and F6 with their detail; and the seal over SEAL_SUBJECT, S1 to S5 with the authority and t. A round time at Go's zero time is no round time, as IsZero, and Verdicts.sealedAt skips a seal at that time, as SealedAt. cmsReader is the default CmsEvaluator of evaluateSecurity, and so of evaluateSecurityInput and the opening: nothing that Go evaluates is left not evaluated; a caller that passes cms: null still gets the parts without CMS alone. encodeSigners and maxSigners are exported, as EncodeSigners and MaxSigners of Go. The tests compare every part with Go: the 135 cases of security_cms.json with the result of each signer, the 24 of security.json, the 56 signatures of alg 2 and 105 seals of seal_type 2 of security_vectors.json, the 755 cases of securitycms_vectors.json with their detail and earliest seal, the fixtures format3_signed_cms and format3_sealed, and their openings in open_cases.json. On Node.js, a part of the vectors and the two fixtures opened in full. 1572 tests on the VM and 332 on Node.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
expect(d?.foreign ?? const <SignerLine>[], isEmpty);
final sealedAt = <Instant>[
if (seal != null) parseRfc3339(str(seal, 'time')),
for (final s in (results ?? const []).cast<Json>())
if (s['result'] == 'valid') parseRfc3339(str(s, 'seal_time')),
]..sort(compareInstants);
if (seal != null) {
expect(
[d?.sealHolder, timeText(d?.sealTime)],
[seal['holder'], seal['time']],
);
}
expect(v.sealedAt, sealedAt.firstOrNull);
Stage 5b: the commitments, SECURITY_CBOR and the verdicts of alg 1 author.dart ports what an author signs and a seal seals from signature.go of datekeys-go: payload_commit, control_commit over CONTROL_SIG in each format, head_digest, signers_digest, AUTHOR_MESSAGE with its prefix and its 99 bytes, its code taken byte by byte as Go takes it, SIG_PART and SEAL_SUBJECT. security.dart ports SECURITY_CBOR and EvaluateSecurityIn: the outer map, author-signature and seal with the schema and the limits of Go, their encoders, and an evaluation that never throws. X for an outer map that fails its layer 2 or 3, version 2 among them; F0 to F4 for the signature, with verifyStrict for alg 1 and the key matched against the saved ones by its dkauthor1 string; S0 to S2 for the seal; and a failure inside one part fails that part only, as Go recovers a panic. Without a context it reads as a reader of v0.10. securityContext is newSecurityContext with the head digest, control_commit at zero when CONTROL_SIG cannot be encoded, and holderText the rule of a name of a certificate. The signature of alg 2 and the seal of seal_type 2 belong to the reader of CMS of stage 5c, behind the interface CmsEvaluator: without one their verdict is null, not evaluated, never guessed. verdicts.dart gains the texts of Go at the draft v0.12, Verdicts.lines and sealedAt, Detail, SignerLine and SignerResult, and verdicts that may be evaluated in part. The tests check every case of security_vectors.json, security.json in its context, the commitments, the signature and the seal of each fixture of format 3, and the boundary with a reader of CMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
});
}
});
}

Powered by TurnKey Linux.