public BerTlvPacket[] GetEncapsulatedPackets() { if (structureType == BerStructureType.Constructed) { List <BerTlvPacket> lst = new List <BerTlvPacket>(); int iLen = contentLength; int iStart = contentStartIndex; int iEnd = iStart + iLen; int octetcounter = iStart; while (iStart < iEnd) { BerTlvPacket tmppacket = new BerTlvPacket(packet, iStart); lst.Add(tmppacket); iStart = iStart + tmppacket.PacketSize; } return(lst.ToArray()); } else { return(null); // only constructed packets contain further BerTlvPackets } }
static void Main(string[] args) { // TEST IA5String, value = "*****@*****.**" // DER encoding byte[] ia5stringBytes1 = { 0x16, 0x0d, 0x74, 0x65, 0x73, 0x74, 0x31, 0x40, 0x72, 0x73, 0x61, 0x2e, 0x63, 0x6f, 0x6d }; // BER encoding with long form of length octets byte[] ia5stringBytes2 = { 0x16, 0x81, 0x0d, 0x74, 0x65, 0x73, 0x74, 0x31, 0x40, 0x72, 0x73, 0x61, 0x2e, 0x63, 0x6f, 0x6d}; // constructed encoding. "test1" + "@" + "rsa.com" byte[] ia5stringBytes3 = { 0x36, 0x13, 0x16, 0x05, 0x74, 0x65, 0x73, 0x74, 0x31, 0x16, 0x01, 0x40, 0x16, 0x07, 0x72, 0x73, 0x61, 0x2e, 0x63, 0x6f, 0x6d}; BerTlvPacket ia5string1 = new BerTlvPacket(ia5stringBytes1, 0); BerTlvPacket ia5string2 = new BerTlvPacket(ia5stringBytes2, 0); BerTlvPacket ia5string3 = new BerTlvPacket(ia5stringBytes3, 0); return; }
public BerTlvPacket[] GetEncapsulatedPackets() { if (structureType == BerStructureType.Constructed) { List<BerTlvPacket> lst = new List<BerTlvPacket>(); int iLen = contentLength; int iStart = contentStartIndex; int iEnd = iStart + iLen; int octetcounter = iStart; while (iStart < iEnd) { BerTlvPacket tmppacket = new BerTlvPacket(packet, iStart); lst.Add(tmppacket); iStart = iStart + tmppacket.PacketSize; } return lst.ToArray(); } else return null; // only constructed packets contain further BerTlvPackets }