Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and improved error output for tests #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fetcher/scion_cppki_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func verifyTopologySignature(cfg *config.Config) error {

// verify the AS certificate chain (but not the payload signature) back to the TRCs of the ISD follows the
// SCION CP PKI rules about cert type, key usage:
if err = spkiCertVerify(ctx, sortedTRCsPaths, asCertChainPath); err != nil {
return fmt.Errorf("unable to validate certificate chain: %w", err)
if stdoutStderr, err := spkiCertVerify(ctx, sortedTRCsPaths, asCertChainPath); err != nil {
return fmt.Errorf("unable to validate certificate chain: %s %w", stdoutStderr, err)
}

var unvalidatedTopologyPath string
Expand Down
2 changes: 1 addition & 1 deletion fetcher/scion_cppki_verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func TestExtractSignerInfo(t *testing.T) {
if err != nil {
log.Error("Failed to create signed file", "signedPayloadPath", signedPayloadPath, "err", err)
}
signerTRCid, signerIA, asCertChainPath, err := extractSignerInfo(context.WithValue(context.TODO(), "openssl", false), signedPayloadPath, tmpDir)
signerTRCid, signerIA, asCertChainPath, err := extractSignerInfo(context.WithValue(context.TODO(), "nativeCrypto", false), signedPayloadPath, tmpDir)
if err != nil {
log.Error("Getting signer info failed: extractSignerInfo", "err", err)
t.FailNow()
Expand Down
4 changes: 2 additions & 2 deletions fetcher/scion_pki_tool_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func spkiTRCExtractCerts(ctx context.Context, trustAnchorTRC, rootCertsBundlePat

// spkiCertVerify verifies the AS certificate asCertChainPath
// against the sorted TRCs in the update chain trcsUpdateChain.
func spkiCertVerify(ctx context.Context, trcsUpdateChain []string, asCertChainPath string) error {
func spkiCertVerify(ctx context.Context, trcsUpdateChain []string, asCertChainPath string) ([]byte, error) {
return exec.CommandContext(ctx, "scion-pki", "certificate", "verify",
"--trc", strings.Join(trcsUpdateChain, ","), asCertChainPath).Run()
"--trc", strings.Join(trcsUpdateChain, ","), asCertChainPath).CombinedOutput()
}

// spkiTRCVerify verifies the TRC update chain for candidateTRCPath anchored in the TRCs trcUpdateChainPaths
Expand Down