GetBuffer() static private méthode

static private GetBuffer ( DefiniteLengthInputStream defIn, byte tmpBuffers ) : byte[]
defIn DefiniteLengthInputStream
tmpBuffers byte
Résultat byte[]
Exemple #1
0
        internal static Asn1Object CreatePrimitiveDerObject(int tagNo, DefiniteLengthInputStream defIn, byte[][] tmpBuffers)
        {
            if (tagNo == 1)
            {
                return(DerBoolean.FromOctetString(Asn1InputStream.GetBuffer(defIn, tmpBuffers)));
            }
            if (tagNo == 6)
            {
                return(DerObjectIdentifier.FromOctetString(Asn1InputStream.GetBuffer(defIn, tmpBuffers)));
            }
            if (tagNo != 10)
            {
                byte[] array = defIn.ToArray();
                switch (tagNo)
                {
                case 2:
                    return(new DerInteger(array));

                case 3:
                    return(DerBitString.FromAsn1Octets(array));

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

                case 5:
                    return(DerNull.Instance);

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

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

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

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

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

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

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

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

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

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

                case 30:
                    return(new DerBmpString(array));
                }
                throw new IOException("unknown tag " + tagNo + " encountered");
            }
            return(DerEnumerated.FromOctetString(Asn1InputStream.GetBuffer(defIn, tmpBuffers)));
        }