public bool SaveData(Stream xdata) { bool flag = true; long childNodeCount = this.ChildNodeCount; xdata.WriteByte(this.tag); Asn1Util.DERLengthEncode(xdata, (ulong)this.dataLength); if (this.tag == (byte)3) { xdata.WriteByte(this.unusedBits); } if (childNodeCount == 0L) { if (this.data != null) { xdata.Write(this.data, 0, this.data.Length); } } else { for (int index = 0; (long)index < childNodeCount; ++index) { flag = this.GetChildNode(index).SaveData(xdata); } } return(flag); }
protected static void ResetDataLengthFieldWidth(Asn1Node node) { MemoryStream memoryStream = new MemoryStream(); Asn1Util.DERLengthEncode((Stream)memoryStream, (ulong)node.dataLength); node.lengthFieldBytes = memoryStream.Length; memoryStream.Close(); }