{"record":{"id":"93dd57468f3c3a62","repo":"slackhq/nebula","slug":"curve-of-in-pub-does-not-match-ca","errorCode":null,"errorMessage":"curve of in-pub does not match ca","messagePattern":"curve of in-pub does not match ca","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/nebula-cert/sign.go","lineNumber":288,"sourceCode":"\t}\n\n\tif fips140.Enforced() && curve == cert.Curve_CURVE25519 {\n\t\treturn errors.New(\"use of Curve25519 is not allowed in FIPS 140-only mode\")\n\t}\n\n\tif *sf.inPubPath != \"\" {\n\t\tvar pubCurve cert.Curve\n\t\trawPub, err := readInput(\"in-pub\", *sf.inPubPath, &claims)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error while reading in-pub: %s\", err)\n\t\t}\n\n\t\tpub, _, pubCurve, err = cert.UnmarshalPublicKeyFromPEM(rawPub)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error while parsing in-pub: %s\", err)\n\t\t}\n\t\tif pubCurve != curve {\n\t\t\treturn fmt.Errorf(\"curve of in-pub does not match ca\")\n\t\t}\n\t} else if isP11 {\n\t\tpub, err = p11Client.GetPubKey()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error while getting public key with PKCS#11: %w\", err)\n\t\t}\n\t} else {\n\t\tpub, rawPriv = newKeypair(curve)\n\t}\n\n\tif !isStdio(*sf.outCertPath) {\n\t\tif _, err := os.Stat(*sf.outCertPath); err == nil {\n\t\t\treturn fmt.Errorf(\"refusing to overwrite existing cert: %s\", *sf.outCertPath)\n\t\t}\n\t}\n\n\tvar crts []cert.Certificate\n","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/cmd/nebula-cert/sign.go#L270-L306","documentation":"nebula-cert sign verifies that the public key supplied via -in-pub was generated on the same elliptic curve as the CA that will sign the new certificate. cert.UnmarshalPublicKeyFromPEM reports the curve embedded in the PEM; when pubCurve != curve (the curve derived from the CA key) the command aborts so the signed cert is not issued with a mismatched key/CA pair. This is a deliberate fail-fast: a cert whose key curve differs from the CA cannot be verified by nebula.","triggerScenarios":"Running `nebula-cert sign -in-pub pub.pem ...` where the PEM in -in-pub contains a public key on a different curve than the CA key (e.g. CA is P-256 but the public key is Curve25519, or vice versa).","commonSituations":"Mixing keys across CAs; regenerating a keypair with a different -curve flag than the CA used; copying a pub file from another nebula deployment; scripts that default to one curve while the CA was created with another.","solutions":["Check the CA's curve (`nebula-cert print -path ca.pem`) and regenerate the public key with the matching -curve flag (`nebula-cert keygen -curve <same-as-ca>`), then rerun sign","If you meant to use a different CA, sign against a CA whose curve matches the in-pub key","Verify you are pointing -in-pub at the right file and not a key/cert from another environment"],"exampleFix":"// before\nnebula-cert sign -ca ca.pem -name host -ip 10.0.0.2/24 -in-pub pub.pem  # pub is Curve25519, CA is P-256\n// after\nnebula-cert keygen -curve P256 -out-key host.key -out-pub pub.pem\nnebula-cert sign -ca ca.pem -name host -ip 10.0.0.2/24 -in-pub pub.pem","handlingStrategy":"validation","validationCode":"// shell: verify curve match before signing\nca_curve=$(nebula-cert print -path ca.pem | grep -i curve)\npub_curve=$(openssl pkey -pubin -in pub.pem -text -noout | grep -E 'ASN1 OID|NIST CURVE')\n# generate the key with the CA's curve so they always match\nnebula-cert keygen -curve P256 -out-pub pub.pem -out-key host.key","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always keygen with the same -curve as the CA","Script a pre-check comparing `nebula-cert print` curve output against the keygen curve","Keep per-CA directories so pub keys can't be mixed across deployments"],"tags":["pki","certificate-signing","curve-mismatch","nebula"],"backgroundTag":"key-curve-mismatch","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}