{"record":{"id":"0c32cf39879ad13d","repo":"XTLS/Xray-core","slug":"the-highest-bit-of-the-last-byte-of-the-peer-sent","errorCode":null,"errorMessage":"the highest bit of the last byte of the peer-sent X25519 public key is not 0","messagePattern":"the highest bit of the last byte of the peer-sent X25519 public key is not 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/vless/encryption/server.go","lineNumber":151,"sourceCode":"\tvar lastCTR cipher.Stream\n\tfor j, k := range i.NfsSKeys {\n\t\tif lastCTR != nil {\n\t\t\tlastCTR.XORKeyStream(relays, relays[:32]) // recover this relay\n\t\t}\n\t\tindex := 32\n\t\tif _, ok := k.(*mlkem.DecapsulationKey768); ok {\n\t\t\tindex = 1088\n\t\t}\n\t\tif i.XorMode > 0 {\n\t\t\tNewCTR(i.NfsPKeysBytes[j], iv).XORKeyStream(relays, relays[:index]) // we don't use buggy elligator2, because we have PSK :)\n\t\t}\n\t\tif k, ok := k.(*ecdh.PrivateKey); ok {\n\t\t\tpublicKey, err := ecdh.X25519().NewPublicKey(relays[:index])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif publicKey.Bytes()[31] > 127 { // we just don't want the observer can change even one bit without breaking the connection, though it has nothing to do with security\n\t\t\t\treturn nil, errors.New(\"the highest bit of the last byte of the peer-sent X25519 public key is not 0\")\n\t\t\t}\n\t\t\tnfsKey, err = k.ECDH(publicKey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tif k, ok := k.(*mlkem.DecapsulationKey768); ok {\n\t\t\tvar err error\n\t\t\tnfsKey, err = k.Decapsulate(relays[:index])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tif j == len(i.NfsSKeys)-1 {\n\t\t\tbreak\n\t\t}\n\t\trelays = relays[index:]\n\t\tlastCTR = NewCTR(nfsKey, iv)","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/vless/encryption/server.go#L133-L169","documentation":"Error \"the highest bit of the last byte of the peer-sent X25519 public key is not 0\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/vless/encryption/server.go:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}