Skip to content
Merged
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
2 changes: 1 addition & 1 deletion ca/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ func GetRemoteCA(ctx context.Context, d digest.Digest, connBroker *connectionbro
io.Copy(verifier, bytes.NewReader(response.Certificate))

if !verifier.Verified() {
return RootCA{}, errors.Errorf("remote CA does not match fingerprint. Expected: %s", d.Hex())
return RootCA{}, errors.Errorf("remote CA does not match fingerprint. Expected: %s", d.Encoded())
}
}

Expand Down
6 changes: 3 additions & 3 deletions ca/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,16 @@ func GenerateJoinToken(rootCA *RootCA, fips bool) string {
panic(fmt.Errorf("failed to read random bytes: %v", err))
}

var nn, digest big.Int
var nn, dgst big.Int
nn.SetBytes(secretBytes[:])
digest.SetString(rootCA.Digest.Hex(), 16)
dgst.SetString(rootCA.Digest.Encoded(), 16)

fmtString := "SWMTKN-1-%0[1]*s-%0[3]*s"
if fips {
fmtString = "SWMTKN-2-1-%0[1]*s-%0[3]*s"
}
return fmt.Sprintf(fmtString, base36DigestLen,
digest.Text(joinTokenBase), maxGeneratedSecretLength, nn.Text(joinTokenBase))
dgst.Text(joinTokenBase), maxGeneratedSecretLength, nn.Text(joinTokenBase))
}

// DownloadRootCA tries to retrieve a remote root CA and matches the digest against the provided token.
Expand Down