slackhq/nebula · error

error while parsing in-pub: %s

Error message

error while parsing in-pub: %s

What it means

Wrapping error in signCert: cert.UnmarshalPublicKeyFromPEM could not parse the -in-pub bytes as a public key, or it succeeded but pubCurve differs from the requested signing curve. Cause appended via %s.

Source

Thrown at cmd/nebula-cert/sign.go:285

		defer func(client *pkclient.PKClient) {
			_ = client.Close()
		}(p11Client)
	}

	if fips140.Enforced() && curve == cert.Curve_CURVE25519 {
		return errors.New("use of Curve25519 is not allowed in FIPS 140-only mode")
	}

	if *sf.inPubPath != "" {
		var pubCurve cert.Curve
		rawPub, err := readInput("in-pub", *sf.inPubPath, &claims)
		if err != nil {
			return fmt.Errorf("error while reading in-pub: %s", err)
		}

		pub, _, pubCurve, err = cert.UnmarshalPublicKeyFromPEM(rawPub)
		if err != nil {
			return fmt.Errorf("error while parsing in-pub: %s", err)
		}
		if pubCurve != curve {
			return fmt.Errorf("curve of in-pub does not match ca")
		}
	} else if isP11 {
		pub, err = p11Client.GetPubKey()
		if err != nil {
			return fmt.Errorf("error while getting public key with PKCS#11: %w", err)
		}
	} else {
		pub, rawPriv = newKeypair(curve)
	}

	if !isStdio(*sf.outCertPath) {
		if _, err := os.Stat(*sf.outCertPath); err == nil {
			return fmt.Errorf("refusing to overwrite existing cert: %s", *sf.outCertPath)
		}
	}

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Supply a valid public key PEM from nebula-cert keygen
  2. Generate the key on the same curve as the CA (or pass the matching -curve)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/nebula-cert/sign.go:285 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03). Data as JSON: /api/errors/42cd5e7bfb3be499. Report an issue: GitHub.