internal static Asn1Object CreatePrimitiveDerObject(int tagNo, DefiniteLengthInputStream defIn, byte[][] tmpBuffers)
    {
        switch (tagNo)
        {
        case 1:
            return(DerBoolean.FromOctetString(GetBuffer(defIn, tmpBuffers)));

        case 10:
            return(DerEnumerated.FromOctetString(GetBuffer(defIn, tmpBuffers)));

        case 6:
            return(DerObjectIdentifier.FromOctetString(GetBuffer(defIn, tmpBuffers)));

        default:
        {
            byte[] array = defIn.ToArray();
            switch (tagNo)
            {
            case 3:
                return(DerBitString.FromAsn1Octets(array));

            case 30:
                return(new DerBmpString(array));

            case 24:
                return(new DerGeneralizedTime(array));

            case 27:
                return(new DerGeneralString(array));

            case 25:
                return(new DerGraphicString(array));

            case 22:
                return(new DerIA5String(array));

            case 2:
                return(new DerInteger(array));

            case 5:
                return(DerNull.Instance);

            case 18:
                return(new DerNumericString(array));

            case 4:
                return(new DerOctetString(array));

            case 19:
                return(new DerPrintableString(array));

            case 20:
                return(new DerT61String(array));

            case 28:
                return(new DerUniversalString(array));

            case 23:
                return(new DerUtcTime(array));

            case 12:
                return(new DerUtf8String(array));

            case 21:
                return(new DerVideotexString(array));

            case 26:
                return(new DerVisibleString(array));

            default:
                throw new IOException("unknown tag " + tagNo + " encountered");
            }
        }
        }
    }