{"record":{"id":"adae9a44acda300b","repo":"peass-ng/PEASS-ng","slug":"unknown-s-box-possible-types-default-e-test","errorCode":null,"errorMessage":"Unknown S-Box - possible types: \"Default\", \"E-Test\", \"E-A\", \"E-B\", \"E-C\", \"E-D\", \"D-Test\", \"D-A\".","messagePattern":"Unknown S-Box - possible types: \"Default\", \"E-Test\", \"E-A\", \"E-B\", \"E-C\", \"E-D\", \"D-Test\", \"D-A\"\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/engines/Gost28147Engine.cs","lineNumber":360,"sourceCode":"\t\t\toutBytes[outOff + 3] = (byte)(num >> 24);\n\t\t\toutBytes[outOff + 2] = (byte)(num >> 16);\n\t\t\toutBytes[outOff + 1] = (byte)(num >> 8);\n\t\t\toutBytes[outOff] = (byte)num;\n\t\t}\n\n\t\t/**\n\t\t* Return the S-Box associated with SBoxName\n\t\t* @param sBoxName name of the S-Box\n\t\t* @return byte array representing the S-Box\n\t\t*/\n\t\tpublic static byte[] GetSBox(\n\t\t\tstring sBoxName)\n\t\t{\n\t\t\tbyte[] sBox = (byte[])sBoxes[Platform.ToUpperInvariant(sBoxName)];\n\n\t\t\tif (sBox == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentException(\"Unknown S-Box - possible types: \"\n\t\t\t\t\t+ \"\\\"Default\\\", \\\"E-Test\\\", \\\"E-A\\\", \\\"E-B\\\", \\\"E-C\\\", \\\"E-D\\\", \\\"D-Test\\\", \\\"D-A\\\".\");\n\t\t\t}\n\n\t\t\treturn Arrays.Clone(sBox);\n\t\t}\n\n\t\tpublic static string GetSBoxName(byte[] sBox)\n\t\t{\n\t\t\tforeach (string name in sBoxes.Keys)\n\t\t\t{\n\t\t\t\tbyte[] sb = (byte[])sBoxes[name];\n\t\t\t\tif (Arrays.AreEqual(sb, sBox))\n\t\t\t\t{\n\t\t\t\t\treturn name;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthrow new ArgumentException(\"SBOX provided did not map to a known one\");","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/engines/Gost28147Engine.cs#L342-L378","documentation":"Gost28147Engine.GetSBox looks up the requested S-Box by uppercase name in its static sBoxes table and throws ArgumentException when the name is not one of the eight supported identifiers (Default, E-Test, E-A, E-B, E-C, E-D, D-Test, D-A).","triggerScenarios":"Calling GetSBox(\"E-TEST\"), GetSBox(\"Default \") with whitespace, GetSBox(\"id-tc26-gost...\") or any misspelled/unsupported S-Box name.","commonSituations":"Using RFC/TC-26 S-Box parameter set names that this older BouncyCastle port does not support; copy-pasting names with wrong case handled by caller, trailing spaces, or hyphen/underscore confusion.","solutions":["Use one of the exact names: Default, E-Test, E-A, E-B, E-C, E-D, D-Test, D-A","Normalize the parameter-set identifier to one of the supported names before lookup","Normalize your own input with ToUpperInvariant and trim, since lookup is case-insensitive via Platform.ToUpperInvariant but exact-match on content"],"exampleFix":"// before\nbyte[] sbox = Gost28147Engine.GetSBox(\"tc26\");\n// after\nbyte[] sbox = Gost28147Engine.GetSBox(\"E-A\");","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> ValidSBoxes = new HashSet<string>{\"Default\",\"E-Test\",\"E-A\",\"E-B\",\"E-C\",\"E-D\",\"D-Test\",\"D-A\"};\nif (!ValidSBoxes.Contains(sBoxName)) throw new ArgumentException(\"Unsupported S-Box: \" + sBoxName);","typeGuard":"bool IsKnownSBoxName(string name) => name != null && new[]{\"Default\",\"E-Test\",\"E-A\",\"E-B\",\"E-C\",\"E-D\",\"D-Test\",\"D-A\"}.Contains(name, StringComparer.OrdinalIgnoreCase);","tryCatchPattern":"try { byte[] sbox = Gost28147Engine.GetSBox(name); }\ncatch (ArgumentException ex) { /* fall back to \"Default\" or surface config error */ }","preventionTips":["Centralize S-Box names in an enum or constants class","Trim and normalize external config values before lookup","Validate S-Box config at startup, not at first use"],"tags":["csharp","cryptography","gost","sbox"],"backgroundTag":"unknown-cipher-parameter-name","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}