{"record":{"id":"1e185a152d4e246d","repo":"peass-ng/PEASS-ng","slug":"no-tagged-object-found-in-vector-structure-doesn","errorCode":null,"errorMessage":"No tagged object found in vector. Structure doesn't seem to be of type External","messagePattern":"No tagged object found in vector\\. Structure doesn't seem to be of type External","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerExternal.cs","lineNumber":47,"sourceCode":"\t\t\t}\n\t\t\tif (enc is DerInteger)\n\t\t\t{\n\t\t\t\tindirectReference = (DerInteger)enc;\n\t\t\t\toffset++;\n\t\t\t\tenc = GetObjFromVector(vector, offset);\n\t\t\t}\n\t\t\tif (!(enc is Asn1TaggedObject))\n\t\t\t{\n\t\t\t\tdataValueDescriptor = enc;\n\t\t\t\toffset++;\n\t\t\t\tenc = GetObjFromVector(vector, offset);\n\t\t\t}\n\n\t\t\tif (vector.Count != offset + 1)\n\t\t\t\tthrow new ArgumentException(\"input vector too large\", \"vector\");\n\n\t\t\tif (!(enc is Asn1TaggedObject))\n\t\t\t\tthrow new ArgumentException(\"No tagged object found in vector. Structure doesn't seem to be of type External\", \"vector\");\n\n\t\t\tAsn1TaggedObject obj = (Asn1TaggedObject)enc;\n\n\t\t\t// Use property accessor to include check on value\n\t\t\tEncoding = obj.TagNo;\n\n\t\t\tif (encoding < 0 || encoding > 2)\n\t\t\t\tthrow new InvalidOperationException(\"invalid encoding value\");\n\n\t\t\texternalContent = obj.GetObject();\n\t\t}\n\n\t\t/**\n\t\t* Creates a new instance of DerExternal\n\t\t* See X.690 for more informations about the meaning of these parameters\n\t\t* @param directReference The direct reference or <code>null</code> if not set.\n\t\t* @param indirectReference The indirect reference or <code>null</code> if not set.\n\t\t* @param dataValueDescriptor The data value descriptor or <code>null</code> if not set.","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerExternal.cs#L29-L65","documentation":"A DER External's encoding field must be an explicitly tagged object (tag 0, 1, or 2) holding the content. After the constructor consumes optional reference/descriptor fields, the remaining element must be an Asn1TaggedObject; if it is not, the structure is not a valid External and ArgumentException is thrown.","triggerScenarios":"Calling DerExternal(Asn1EncodableVector, int) where the final element of the vector (at position offset) is a plain Asn1Object (e.g. DerSequence or DerOctetString) rather than an Asn1TaggedObject.","commonSituations":"Parsing BER data where an EXTERNAL element was encoded without the required tagging; passing the wrong vector (contents of some other sequence type) into DerExternal; hand-assembled vectors missing the tagged encoding field.","solutions":["Ensure the last vector element is an Asn1TaggedObject with TagNo 0-2 before constructing","Validate with a type check: if (!(vector[offset] is Asn1TaggedObject)) reject the input","Re-parse the source bytes — the input likely is not actually a DER External structure"],"exampleFix":"// before\nvar ext = new DerExternal(vector, 0);\n// after\nif (!(vector[0] is Asn1TaggedObject))\n    throw new FormatException(\"External encoding must be tagged\");\nvar ext = new DerExternal(vector, 0);","handlingStrategy":"type-guard","validationCode":"var last = vector != null && vector.Count == offset + 1 ? vector[offset] : null;\nif (last is Asn1TaggedObject tagged && tagged.TagNo >= 0 && tagged.TagNo <= 2) {\n    var ext = new DerExternal(vector, offset);\n}","typeGuard":"static bool HasTaggedEncoding(Asn1EncodableVector v, int i) =>\n    v != null && v.Count > i && v[i] is Asn1TaggedObject;","tryCatchPattern":"try { var ext = new DerExternal(vector, offset); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No tagged object\")) {\n    // structure is not a DER External\n}","preventionTips":["Always encode the External encoding field as an explicit Asn1TaggedObject (tag 0-2)","Confirm the source structure really is EXTERNAL before parsing it as one","Use GetInstance on a DerSequence rather than manually slicing vectors"],"tags":["asn1","bouncycastle","der-encoding","argument-validation"],"backgroundTag":"invalid-asn1-encoding","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}