void Test(string pubKeyStr) { byte[] publicKey = StrUtils.Base64Decode(pubKeyStr); Logger.Debug("Raw public key:" + BinConvert.ToHex(publicKey)); Asn1Tlv tlv = Asn1Tlv.Unserialize(publicKey); DumpTlv(tlv); }
void DumpTlv(Asn1Tlv tlv, int depth = 0) { string lineHeader = ""; for (int i = 0; i < depth; i++) { lineHeader += "\t"; } Logger.Debug("{0}Tag={1:X02}, L={2}, V={3}", lineHeader, tlv.T_AsByte, tlv.L, BinConvert.ToHex(tlv.V)); if (tlv.T_AsByte == 0x30) { /* Sequence */ byte[] buffer = tlv.V; while ((buffer != null) && (buffer.Length != 0)) { Asn1Tlv childTlv = Asn1Tlv.Unserialize(buffer, out buffer); if (childTlv == null) { break; } DumpTlv(childTlv, depth + 1); } } }