Beispiel #1
0
        public void TestAccountingPacketRequestAuthenticatorFail()
        {
            var packetBytes = "0404002711019c27d4e00cbc523b3e2fc834baf401066e656d6f2806000000012c073230303234";
            var secret      = "foo";

            var radiusPacketParser   = new RadiusPacketParser(NullLogger <RadiusPacketParser> .Instance, GetDictionary());
            var requestAuthenticator = radiusPacketParser.CalculateRequestAuthenticator(Encoding.UTF8.GetBytes(secret), Utils.StringToByteArray(packetBytes));

            Assert.That(() => radiusPacketParser.Parse(Utils.StringToByteArray(packetBytes), Encoding.UTF8.GetBytes(secret)),
                        Throws.TypeOf <InvalidOperationException>());
        }
Beispiel #2
0
        public void TestAccountingPacketRequestAuthenticatorSuccess()
        {
            var packetBytes = "0404002711019c27d4e00cbc523b3e2fc834baf401066e656d6f2806000000012c073230303234";
            var secret      = "xyzzy5461";

            var radiusPacketParser   = new RadiusPacketParser(NullLogger <RadiusPacketParser> .Instance, GetDictionary());
            var requestAuthenticator = radiusPacketParser.CalculateRequestAuthenticator(Encoding.UTF8.GetBytes(secret), Utils.StringToByteArray(packetBytes));
            var packet = radiusPacketParser.Parse(Utils.StringToByteArray(packetBytes), Encoding.UTF8.GetBytes(secret));

            Assert.AreEqual(packet.Authenticator.ToHexString(), requestAuthenticator.ToHexString());
        }