projectdiscovery/nuclei · error
failed to parse ecdsa public key from cert
Error message
failed to parse ecdsa public key from cert
What it means
Error "failed to parse ecdsa public key from cert" thrown in projectdiscovery/nuclei.
Source
Thrown at pkg/templates/signer/handler.go:96
// ParseUserCert parses the user certificate and returns the public key
func (k *KeyHandler) ParseUserCert() error {
block, _ := pem.Decode(k.UserCert)
if block == nil {
return fmt.Errorf("failed to parse PEM block containing the certificate")
}
cert, err := x509.ParseCertificate(block.Bytes)
if err != nil {
return err
}
if cert.Subject.CommonName == "" {
return fmt.Errorf("invalid certificate: expected common name to be set")
}
k.cert = cert
var ok bool
k.ecdsaPubKey, ok = cert.PublicKey.(*ecdsa.PublicKey)
if !ok {
return fmt.Errorf("failed to parse ecdsa public key from cert")
}
return nil
}
// ParsePrivateKey parses the private key and returns the private key
func (k *KeyHandler) ParsePrivateKey() error {
block, _ := pem.Decode(k.PrivateKey)
if block == nil {
return fmt.Errorf("failed to parse PEM block containing the private key")
}
// if pem block is encrypted , decrypt it
if x509.IsEncryptedPEMBlock(block) { // nolint: all
gologger.Info().Msgf("Private Key is encrypted with passphrase")
fmt.Printf("[*] Enter passphrase (exit to abort): ")
bin, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return err
}View on GitHub (pinned to 265b3a3dec)
When it happens
Trigger: Thrown at pkg/templates/signer/handler.go:96 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15).
Data as JSON: /api/errors/e97a79577ef075d0.
Report an issue: GitHub.