// Note: Recursive protected void Decode(byte[] asn1, ref int anPos, int anLength) { byte nTag; int nLength; byte[] aValue; // minimum is 2 bytes (tag + length of 0) while (anPos < anLength - 1) { DecodeTLV(asn1, ref anPos, out nTag, out nLength, out aValue); // sometimes we get trailing 0 if (nTag == 0) { continue; } ASN1 elm = Add(new ASN1(nTag, aValue)); if ((nTag & 0x20) == 0x20) { int nConstructedPos = anPos; elm.Decode(asn1, ref nConstructedPos, nConstructedPos + nLength); } anPos += nLength; // value length } }
protected void Decode(byte[] asn1, ref int anPos, int anLength) { while (anPos < anLength - 1) { DecodeTLV(asn1, ref anPos, out byte tag, out int length, out byte[] content); if (tag != 0) { ASN1 aSN = Add(new ASN1(tag, content)); if ((tag & 0x20) == 32) { int anPos2 = anPos; aSN.Decode(asn1, ref anPos2, anPos2 + length); } anPos += length; } } }
protected void Decode(byte[] asn1, ref int anPos, int anLength) { while (anPos < (anLength - 1)) { this.DecodeTLV(asn1, ref anPos, out byte num, out int num2, out byte[] buffer); if (num != 0) { ASN1 asn = this.Add(new ASN1(num, buffer)); if ((num & 0x20) == 0x20) { int num3 = anPos; asn.Decode(asn1, ref num3, num3 + num2); } anPos += num2; } } }
// Note: Recursive protected void Decode(byte[] asn1, ref int anPos, int anLength) { byte[] aTag; int nTagLength = 0; int nLength; byte[] aValue; // Check for multi byte tags if ((asn1[anPos + nTagLength++] & 0x1f) == 0x1f) { // Tag number is encoded in the following bytes as a sequence of seven bit bytes // The high bit of these bytes is used as a flag to indicate whether there's more tag available while ((asn1[anPos + nTagLength++] & 0x80) == 0x80) { } } aTag = new byte[nTagLength]; Buffer.BlockCopy(asn1, anPos, aTag, 0, nTagLength); // Minimum is 2 bytes (tag + length of 0) while (anPos < anLength - 1) { DecodeTLV(asn1, ref anPos, out aTag, out nLength, out aValue); // Sometimes we get trailing 0 if (aTag[0] == 0) { continue; } ASN1 elm = Add(new ASN1(aTag, aValue)); if ((aTag[0] & 0x20) == 0x20) { int nConstructedPos = anPos; elm.Decode(asn1, ref nConstructedPos, nConstructedPos + nLength); } anPos += nLength; // Value length } }
protected void Decode(byte[] asn1, ref int anPos, int anLength) { while (anPos < anLength - 1) { byte b; int num; byte[] data; this.DecodeTLV(asn1, ref anPos, out b, out num, out data); if (b != 0) { ASN1 asn2 = this.Add(new ASN1(b, data)); if ((b & 32) == 32) { int num2 = anPos; asn2.Decode(asn1, ref num2, num2 + num); } anPos += num; } } }