{"record":{"id":"b8b900c3cbc3ee25","repo":"slackhq/nebula","slug":"unsupported-encryption-algorithm-s","errorCode":null,"errorMessage":"unsupported encryption algorithm: %s","messagePattern":"unsupported encryption algorithm: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cert/crypto.go","lineNumber":285,"sourceCode":"\t\tcurve = Curve_P256\n\tdefault:\n\t\treturn curve, nil, r, fmt.Errorf(\"bytes did not contain a proper nebula encrypted Ed25519/ECDSA private key banner\")\n\t}\n\n\tned, err := UnmarshalNebulaEncryptedData(k.Bytes)\n\tif err != nil {\n\t\treturn curve, nil, r, err\n\t}\n\n\tvar bytes []byte\n\tswitch ned.EncryptionMetadata.EncryptionAlgorithm {\n\tcase \"AES-256-GCM\":\n\t\tbytes, err = aes256Decrypt(passphrase, &ned.EncryptionMetadata.Argon2Parameters, ned.Ciphertext)\n\t\tif err != nil {\n\t\t\treturn curve, nil, r, err\n\t\t}\n\tdefault:\n\t\treturn curve, nil, r, fmt.Errorf(\"unsupported encryption algorithm: %s\", ned.EncryptionMetadata.EncryptionAlgorithm)\n\t}\n\n\tswitch curve {\n\tcase Curve_CURVE25519:\n\t\tif len(bytes) != ed25519.PrivateKeySize {\n\t\t\treturn curve, nil, r, fmt.Errorf(\"key was not %d bytes, is invalid ed25519 private key\", ed25519.PrivateKeySize)\n\t\t}\n\tcase Curve_P256:\n\t\tif len(bytes) != 32 {\n\t\t\treturn curve, nil, r, fmt.Errorf(\"key was not 32 bytes, is invalid ECDSA P256 private key\")\n\t\t}\n\t}\n\n\treturn curve, bytes, r, nil\n}\n","sourceCodeStart":267,"sourceCodeEnd":301,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/cert/crypto.go#L267-L301","documentation":"The decrypted payload's EncryptionMetadata.EncryptionAlgorithm is not 'AES-256-GCM', the only algorithm this version of the library supports. After parsing the NebulaEncryptedData structure, the switch over the algorithm falls into the default branch and errors.","triggerScenarios":"Decrypting a key file whose embedded EncryptionAlgorithm field is something other than 'AES-256-GCM' — typically a file written by a newer nebula version, a different implementation, or a hand-edited key blob.","commonSituations":"Forward-compatibility issue: key material created by a newer nebula-cert with a new cipher being read by an older library version; hand-crafted or migrated key files.","solutions":["Inspect the key blob's EncryptionMetadata.EncryptionAlgorithm field and re-encrypt the key with AES-256-GCM (EncryptAndMarshalSigningPrivateKey from a version supporting it)","Upgrade this library to a version that supports the algorithm used in the key file","Regenerate the key with a matching nebula-cert version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"func isSupportedAlgorithm(b []byte) bool {\n\tblk, _ := pem.Decode(b)\n\tif blk == nil {\n\t\treturn false\n\t}\n\tned, err := cert.UnmarshalNebulaEncryptedData(blk.Bytes)\n\treturn err == nil && ned.EncryptionMetadata.EncryptionAlgorithm == \"AES-256-GCM\"\n}","typeGuard":null,"tryCatchPattern":"curve, key, rest, err := cert.DecryptAndUnmarshalSigningPrivateKey(pass, b)\nif err != nil {\n\tif strings.Contains(err.Error(), \"unsupported encryption algorithm\") {\n\t\treturn fmt.Errorf(\"key file uses an algorithm this library version does not support; upgrade the library: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Keep the library and nebula-cert versions aligned across your tooling","Re-encrypt keys with AES-256-GCM when migrating from other tools","Pin tooling versions so keys are not produced by newer versions with unsupported ciphers"],"tags":["encryption","algorithm-support","key-management","go"],"backgroundTag":"unsupported-encryption-algorithm","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"}