OpenNHP/opennhp · error
not support default cipher scheme
Error message
not support default cipher scheme %d
What it means
Raised by NewKGCImplFromConfig when config.toml's DefaultCipherScheme is any value other than 0 (the SM2 scheme). The config loader only implements scheme 0; any other configured value falls into the else branch and is rejected, so the KGC refuses to start rather than silently using an unintended curve.
Solutions
- Set DefaultCipherScheme = 0 in etc/config.toml (the only supported value)
- If a different scheme was intended, extend NewKGCImplFromConfig to construct the corresponding KGC implementation
- Re-run setup after correcting the config so key material matches the scheme
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at endpoints/kgc/kgc.go:254 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of OpenNHP/opennhp@6e04ca5ff0 (2026-09-07).
Data as JSON: /api/errors/6b800d2a94e4c6a9.
Report an issue: GitHub.
Appendix: source
Thrown at endpoints/kgc/kgc.go:254
if err != nil {
return nil, err
}
masterPublicKey, err := base64.StdEncoding.DecodeString(config.MasterPublicKeyBase64)
if err != nil {
return nil, err
}
if config.DefaultCipherScheme == 0 {
k := SM2.NewKGCImpl()
k.masterKey = &MasterKey{
Ms: new(big.Int).SetBytes(masterPrivateKey),
PpubX: new(big.Int).SetBytes(masterPublicKey[0:32]),
PpubY: new(big.Int).SetBytes(masterPublicKey[32:]),
}
return k, nil
} else {
return nil, fmt.Errorf("not support default cipher scheme %d", config.DefaultCipherScheme)
}
}
View on GitHub (pinned to 6e04ca5ff0)