public void TranslateEncryptedPinBlock(string pinBlock, string accountOrPadding,
                                               PinBlockFormat sourceFormat, PinBlockFormat targetFormat,
                                               string sourceClearKey, string targetClearKey, string expected)
        {
            var pb  = new PinBlock(pinBlock, accountOrPadding, sourceFormat, new HexKey(sourceClearKey));
            var key = new HexKey(targetClearKey);

            Assert.AreEqual(expected, pb.Translate(key, targetFormat));
        }
        public void DieboldPinBlock()
        {
            var pb1 = new PinBlock("1234", "550000025321", PinBlockFormat.Diebold);

            Assert.AreEqual("1234FFFFFFFFFFFF", pb1.ClearPinBlock);

            var pb2 = new PinBlock("4DBA042DD998BE4D", "550000025321", PinBlockFormat.Diebold,
                                   new HexKey("0123456789ABCDEFABCDEF0123456789"));

            Assert.AreEqual("1234", pb2.Pin);
        }
        public void AnsiX98PinBlock()
        {
            var pb1 = new PinBlock("1234", "550000025321", PinBlockFormat.AnsiX98);

            Assert.AreEqual("041261FFFFFDACDE", pb1.ClearPinBlock);

            var pb2 = new PinBlock("CAE9C83F58DDC12D", "550000025321", PinBlockFormat.AnsiX98,
                                   new HexKey("0123456789ABCDEFABCDEF0123456789"));

            Assert.AreEqual("1234", pb2.Pin);
        }
        private void ConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            var pinblock = new PinBlock();

            byte[] pinBlockbytes = pinblock.CalculatePINBlock(TransactionInfo.Pan, 16, PasswordBox.Password, 4);

            string resultPibblock = pinblock.EncryptDESIpg(pinBlockbytes);

            TransactionInfo.Pinblock = resultPibblock;

            TransactionInfo.GoToPage(Pages.SelectOperationPage);
        }
        public void TranslateClearPinBlock(string pin, string accountOrPadding, PinBlockFormat sourceFormat, PinBlockFormat targetFormat, string expected)
        {
            var pb = new PinBlock(pin, accountOrPadding, sourceFormat);

            Assert.AreEqual(expected, pb.Translate(targetFormat));
        }
 public void TestPinBlockCreation()
 {
     var pb1 = new PinBlock("1234", "550000025321", PinBlockFormat.AnsiX98);
 }