private static string outputApplicationSpecific( string type, string indent, bool verbose, DerApplicationSpecific app) { StringBuilder buf = new StringBuilder(); if (app.IsConstructed()) { try { Asn1Sequence s = Asn1Sequence.GetInstance(app.GetObject(Asn1Tags.Sequence)); buf.Append(indent + type + " ApplicationSpecific[" + app.ApplicationTag + "]" + NewLine); foreach (Asn1Encodable ae in s) { AsString(indent + Tab, verbose, ae.ToAsn1Object(), buf); } } catch (IOException e) { buf.Append(e); } return(buf.ToString()); } return(indent + type + " ApplicationSpecific[" + app.ApplicationTag + "] (" + Hex.ToHexString(app.GetContents()) + ")" + NewLine); }
public override void PerformTest() { DerInteger val = new DerInteger(9); DerApplicationSpecific tagged = new DerApplicationSpecific(false, 3, val); if (!AreEqual(impData, tagged.GetEncoded())) { Fail("implicit encoding failed"); } DerInteger recVal = (DerInteger) tagged.GetObject(Asn1Tags.Integer); if (!val.Equals(recVal)) { Fail("implicit read back failed"); } DerApplicationSpecific certObj = (DerApplicationSpecific) Asn1Object.FromByteArray(certData); if (!certObj.IsConstructed() || certObj.ApplicationTag != 33) { Fail("parsing of certificate data failed"); } byte[] encoded = certObj.GetDerEncoded(); if (!Arrays.AreEqual(certData, encoded)) { Console.WriteLine(Encoding.ASCII.GetString(certData, 0, certData.Length).Substring(0, 20)); Console.WriteLine(Encoding.ASCII.GetString(encoded, 0, encoded.Length).Substring(0, 20)); Fail("re-encoding of certificate data failed"); } }
public override void PerformTest() { DerInteger val = new DerInteger(9); DerApplicationSpecific tagged = new DerApplicationSpecific(false, 3, val); if (!AreEqual(impData, tagged.GetEncoded())) { Fail("implicit encoding failed"); } DerInteger recVal = (DerInteger)tagged.GetObject(Asn1Tags.Integer); if (!val.Equals(recVal)) { Fail("implicit read back failed"); } DerApplicationSpecific certObj = (DerApplicationSpecific) Asn1Object.FromByteArray(certData); if (!certObj.IsConstructed() || certObj.ApplicationTag != 33) { Fail("parsing of certificate data failed"); } byte[] encoded = certObj.GetDerEncoded(); if (!Arrays.AreEqual(certData, encoded)) { Console.WriteLine(Encoding.ASCII.GetString(certData, 0, certData.Length).Substring(0, 20)); Console.WriteLine(Encoding.ASCII.GetString(encoded, 0, encoded.Length).Substring(0, 20)); Fail("re-encoding of certificate data failed"); } }
private static string outputApplicationSpecific(string type, string indent, bool verbose, DerApplicationSpecific app) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_00bb: Expected O, but got Unknown StringBuilder val = new StringBuilder(); if (app.IsConstructed()) { try { Asn1Sequence instance = Asn1Sequence.GetInstance(app.GetObject(16)); val.Append(string.Concat(new object[6] { indent, type, " ApplicationSpecific[", app.ApplicationTag, "]", NewLine })); global::System.Collections.IEnumerator enumerator = instance.GetEnumerator(); try { while (enumerator.MoveNext()) { Asn1Encodable asn1Encodable = (Asn1Encodable)enumerator.get_Current(); AsString(indent + " ", verbose, asn1Encodable.ToAsn1Object(), val); } } finally { global::System.IDisposable disposable = enumerator as global::System.IDisposable; if (disposable != null) { disposable.Dispose(); } } } catch (IOException val2) { IOException val3 = val2; val.Append((object)val3); } return(val.ToString()); } return(string.Concat(new object[8] { indent, type, " ApplicationSpecific[", app.ApplicationTag, "] (", Hex.ToHexString(app.GetContents()), ")", NewLine })); }
public override void PerformTest() { TestTaggedObject(); DerApplicationSpecific appSpec = (DerApplicationSpecific)Asn1Object.FromByteArray(sampleData); if (1 != appSpec.ApplicationTag) { Fail("wrong tag detected"); } DerInteger val = new DerInteger(9); DerApplicationSpecific tagged = new DerApplicationSpecific(false, 3, val); if (!AreEqual(impData, tagged.GetEncoded())) { Fail("implicit encoding failed"); } DerInteger recVal = (DerInteger)tagged.GetObject(Asn1Tags.Integer); if (!val.Equals(recVal)) { Fail("implicit read back failed"); } DerApplicationSpecific certObj = (DerApplicationSpecific) Asn1Object.FromByteArray(certData); if (!certObj.IsConstructed() || certObj.ApplicationTag != 33) { Fail("parsing of certificate data failed"); } byte[] encoded = certObj.GetDerEncoded(); if (!Arrays.AreEqual(certData, encoded)) { Fail("re-encoding of certificate data failed"); } }
private static string outputApplicationSpecific(string type, string indent, bool verbose, DerApplicationSpecific app) { StringBuilder stringBuilder = new StringBuilder(); if (app.IsConstructed()) { try { Asn1Sequence instance = Asn1Sequence.GetInstance(app.GetObject(16)); stringBuilder.Append(string.Concat(new object[] { indent, type, " ApplicationSpecific[", app.ApplicationTag, "]", Asn1Dump.NewLine })); foreach (Asn1Encodable asn1Encodable in instance) { Asn1Dump.AsString(indent + " ", verbose, asn1Encodable.ToAsn1Object(), stringBuilder); } } catch (IOException value) { stringBuilder.Append(value); } return(stringBuilder.ToString()); } return(string.Concat(new object[] { indent, type, " ApplicationSpecific[", app.ApplicationTag, "] (", Hex.ToHexString(app.GetContents()), ")", Asn1Dump.NewLine })); }
private static string outputApplicationSpecific(string type, string indent, bool verbose, DerApplicationSpecific app) { StringBuilder stringBuilder = new StringBuilder(); if (app.IsConstructed()) { try { Asn1Sequence instance = Asn1Sequence.GetInstance(app.GetObject(16)); stringBuilder.Append(indent + type + " ApplicationSpecific[" + app.ApplicationTag + "]" + NewLine); foreach (Asn1Encodable item in instance) { AsString(indent + " ", verbose, item.ToAsn1Object(), stringBuilder); } } catch (IOException value) { stringBuilder.Append(value); } return(stringBuilder.ToString()); } return(indent + type + " ApplicationSpecific[" + app.ApplicationTag + "] (" + Hex.ToHexString(app.GetContents()) + ")" + NewLine); }
private static string outputApplicationSpecific(string type, string indent, bool verbose, DerApplicationSpecific app) { StringBuilder buf = new StringBuilder(); if (app.IsConstructed()) { try { Asn1Sequence instance = Asn1Sequence.GetInstance(app.GetObject(0x10)); buf.Append(string.Concat(new object[] { indent, type, " ApplicationSpecific[", app.ApplicationTag, "]", NewLine })); IEnumerator enumerator = instance.GetEnumerator(); try { while (enumerator.MoveNext()) { AsString(indent + " ", verbose, ((Asn1Encodable)enumerator.Current).ToAsn1Object(), buf); } } finally { if (enumerator is IDisposable disposable) { IDisposable disposable; disposable.Dispose(); } } } catch (IOException exception) { buf.Append(exception); } return(buf.ToString()); } object[] objArray2 = new object[] { indent, type, " ApplicationSpecific[", app.ApplicationTag, "] (", Hex.ToHexString(app.GetContents()), ")", NewLine }; return(string.Concat(objArray2)); }
private static string outputApplicationSpecific( string type, string indent, bool verbose, DerApplicationSpecific app) { StringBuilder buf = new StringBuilder(); if (app.IsConstructed()) { try { Asn1Sequence s = Asn1Sequence.GetInstance(app.GetObject(Asn1Tags.Sequence)); buf.Append(indent + type + " ApplicationSpecific[" + app.ApplicationTag + "]" + NewLine); foreach (Asn1Encodable ae in s) { AsString(indent + Tab, verbose, ae.ToAsn1Object(), buf); } } catch (IOException e) { buf.Append(e); } return buf.ToString(); } return indent + type + " ApplicationSpecific[" + app.ApplicationTag + "] (" + Hex.ToHexString(app.GetContents()) + ")" + NewLine; }
public override void PerformTest() { TestTaggedObject(); DerApplicationSpecific appSpec = (DerApplicationSpecific)Asn1Object.FromByteArray(sampleData); if (1 != appSpec.ApplicationTag) { Fail("wrong tag detected"); } DerInteger val = new DerInteger(9); DerApplicationSpecific tagged = new DerApplicationSpecific(false, 3, val); if (!AreEqual(impData, tagged.GetEncoded())) { Fail("implicit encoding failed"); } DerInteger recVal = (DerInteger) tagged.GetObject(Asn1Tags.Integer); if (!val.Equals(recVal)) { Fail("implicit read back failed"); } DerApplicationSpecific certObj = (DerApplicationSpecific) Asn1Object.FromByteArray(certData); if (!certObj.IsConstructed() || certObj.ApplicationTag != 33) { Fail("parsing of certificate data failed"); } byte[] encoded = certObj.GetDerEncoded(); if (!Arrays.AreEqual(certData, encoded)) { Fail("re-encoding of certificate data failed"); } }