示例#1
0
        public void RadiusPacket_PasswordEncryption()
        {
            // Test passwords from 1 to 128 characters in length.

            for (int i = 1; i < 128; i++)
            {
                string       password = GetPassword(i);
                RadiusPacket packet;

                packet = new RadiusPacket(RadiusCode.AccessRequest, 55, Crypto.Rand(16));
                packet.Attributes.Add(new RadiusAttribute(RadiusAttributeType.UserPassword, packet.EncryptUserPassword(password, "secret")));
                Assert.AreNotEqual(password, Helper.FromAnsi(packet.Attributes[0].Value, 0, password.Length));
                Assert.AreEqual(password, packet.DecryptUserPassword(packet.Attributes[0].Value, "secret"));
            }
        }