{"record":{"id":"6b800d2a94e4c6a9","repo":"OpenNHP/opennhp","slug":"not-support-default-cipher-scheme-d","errorCode":null,"errorMessage":"not support default cipher scheme %d","messagePattern":"not support default cipher scheme (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"endpoints/kgc/kgc.go","lineNumber":254,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmasterPublicKey, err := base64.StdEncoding.DecodeString(config.MasterPublicKeyBase64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif config.DefaultCipherScheme == 0 {\n\t\tk := SM2.NewKGCImpl()\n\t\tk.masterKey = &MasterKey{\n\t\t\tMs:    new(big.Int).SetBytes(masterPrivateKey),\n\t\t\tPpubX: new(big.Int).SetBytes(masterPublicKey[0:32]),\n\t\t\tPpubY: new(big.Int).SetBytes(masterPublicKey[32:]),\n\t\t}\n\t\treturn k, nil\n\t} else {\n\t\treturn nil, fmt.Errorf(\"not support default cipher scheme %d\", config.DefaultCipherScheme)\n\t}\n}\n","sourceCodeStart":236,"sourceCodeEnd":257,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/endpoints/kgc/kgc.go#L236-L257","documentation":"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.","triggerScenarios":"Thrown at endpoints/kgc/kgc.go:254 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}