public static void GetEnumeratedBytes_Throws(PublicEncodingRules ruleSet, string inputHex) { byte[] inputData = inputHex.HexToByteArray(); AsnReader reader = new AsnReader(inputData, (AsnEncodingRules)ruleSet); Assert.Throws <CryptographicException>(() => reader.GetEnumeratedBytes()); }
public static void GetEnumeratedBytes(PublicEncodingRules ruleSet) { const string Payload = "0102030405060708090A0B0C0D0E0F10"; // ENUMERATED (payload) followed by INTEGER (0) byte[] data = ("0A10" + Payload + "020100").HexToByteArray(); AsnReader reader = new AsnReader(data, (AsnEncodingRules)ruleSet); ReadOnlyMemory <byte> contents = reader.GetEnumeratedBytes(); Assert.Equal(0x10, contents.Length); Assert.Equal(Payload, contents.ByteArrayToHex()); }