Skip to content

Commit 750dfad

Browse files
committed
trust_config: fix typo and improve test case comments
1 parent 3dce136 commit 750dfad

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

std/security/trust_config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ func (tc *TrustConfig) handleSelfSignedCert(args TrustConfigValidateArgs, keyLoc
455455
return
456456
}
457457

458-
// If already an trust anchor
458+
// If already a trust anchor
459459
if tc.isTrustedAnchorKey(anchorKeyName) {
460460
args.Callback(true, nil)
461461
return
@@ -592,7 +592,7 @@ func (tc *TrustConfig) processCertList(args certListArgs, listData ndn.Data, lis
592592

593593
func (tc *TrustConfig) tryListedCerts(args certListArgs, names []enc.Name, idx int) {
594594
if idx >= len(names) {
595-
args.args.Callback(false, fmt.Errorf("no chain to trusted anchor"))
595+
args.args.Callback(false, fmt.Errorf("no chain to trusted anchor %s (tried %d certs from CertList)", args.anchorKey, len(names)))
596596
return
597597
}
598598

std/security/trust_config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,22 +449,22 @@ func testTrustConfigIntra(t *testing.T, schema ndn.TrustSchema) {
449449
name: "/test/alice/data4",
450450
signer: mAliceSigner,
451451
}))
452-
require.Equal(t, 6, tcTestFetchCount) // invalid cert not in store (+ CertList)
452+
require.Equal(t, 6, tcTestFetchCount) // invalid cert not in store: 3 more fetches (includes CertList)
453453
require.False(t, validateSync(ValidateSyncOptions{
454454
name: "/test/alice/data3",
455455
signer: malloryRootSigner,
456456
}))
457-
require.Equal(t, 7, tcTestFetchCount) // fetch 1x mallory cert (+ CertList)
457+
require.Equal(t, 7, tcTestFetchCount) // fetch 1x mallory cert
458458
require.False(t, validateSync(ValidateSyncOptions{
459459
name: "/test/alice/data/extra",
460460
signer: mallorySigner,
461461
}))
462-
require.Equal(t, 8, tcTestFetchCount) // don't bother fetching mallory root because of schema miss (+ CertList)
462+
require.Equal(t, 8, tcTestFetchCount) // only CertList fetched; mallory root skipped by schema
463463
require.False(t, validateSync(ValidateSyncOptions{
464464
name: "/test/mallory/data4",
465465
signer: mallorySigner,
466466
}))
467-
require.Equal(t, 11, tcTestFetchCount) // schema hit, fetch 2x mallory certs (+ CertList)
467+
require.Equal(t, 11, tcTestFetchCount) // schema hit, 3 fetches: 2x mallory certs + 1x CertList
468468

469469
// Sign with mallory's malicious keys (root 2)
470470
// In this case the root certificate name is the same, so that cert should not be fetched

0 commit comments

Comments
 (0)